wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ISYS6892003

Total questions: 40

Worksheet time: 21mins

Name
Class
Date
1.

What is a subquery?

a)

A type of join

b)

A query within another query

c)

A view definition

d)

A sequence generator

e)

A synonym

2.

Which query finds names that end with 'son'?

a)

SELECT * FROM employees WHERE name LIKE '%son%';

b)

SELECT * FROM employees WHERE name LIKE 'son%';

c)

SELECT * FROM employees WHERE name REGEXP_LIKE(name, 'son$');

d)

SELECT * FROM employees WHERE name LIKE '%son';

e)

SELECT * FROM employees WHERE name IN 'son';

3.

Which of the following best defines a view?

a)

A virtual table based on a query

b)

A physical copy of a table

c)

A stored procedure

d)

A trigger function

e)

A synonym for a column

4.

Which query performs an inner join between orders and customers on customer_id?

a)

SELECT * FROM orders JOIN customers ON orders.id = customers.id;

b)

SELECT * FROM orders FULL JOIN customers;

c)

SELECT * FROM orders NATURAL JOIN customers;

d)

SELECT * FROM orders INNER JOIN customers ON orders.customer_id = customers.customer_id;

e)

SELECT * FROM orders, customers WHERE orders.id = customers.id;

5.

What does the UPPER function do in SQL?

a)

Converts all characters to lowercase

b)

Capitalizes the first letter of each word

c)

Removes spaces from a string

d)

Converts all characters to uppercase

e)

Replaces NULL values

6.

Which query creates a sequence starting at 100 and incrementing by 10?

a)

CREATE SYNONYM seq_id FOR 100 INCREMENT 10;

b)

CREATE SEQUENCE seq_id START WITH 100 INCREMENT BY 10;

c)

SEQUENCE seq_id BEGIN 100 STEP 10;

d)

CREATE SEQUENCE seq_id VALUES 100 TO 1000;

e)

START SEQUENCE seq_id AT 100 BY 10;

7.

Which group function returns the highest value in a column?

a)

MIN

b)

AVG

c)

SUM

d)

MAX

e)

COUNT

8.

Which query calculates the average salary per department?

a)

SELECT department_id, AVG(salary) FROM employees GROUP BY department_id;

b)

SELECT AVG(salary) FROM employees;

c)

SELECT department_id, AVG(salary) FROM employees;

d)

SELECT department_id, salary FROM employees GROUP BY salary;

e)

SELECT AVG(salary) GROUP BY department_id FROM employees;

9.

Which function is used to search a string with a pattern?

a)

SUBSTR

b)

REGEXP_LIKE

c)

TO_CHAR

d)

UPPER

e)

NVL

10.

Which query returns employees who earn more than the average salary?

a)

SELECT * FROM employees WHERE salary = AVG(salary);

b)

SELECT AVG(salary) FROM employees WHERE salary > 5000;

c)

SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);

d)

SELECT salary FROM employees HAVING salary > AVG(salary);

e)

SELECT * FROM employees JOIN (SELECT AVG(salary) FROM employees);

11.

What is a sequence used for in Oracle SQL?

a)

To store temporary data

b)

To create joins

c)

To sort records

d)

To generate unique numeric values

e)

To define foreign keys

12.

Which query creates a view showing employees with salary over 10000?

a)

VIEW high_salary_employees AS SELECT * FROM employees WHERE salary > 10000;

b)

CREATE VIEW FROM employees WHERE salary > 10000;

c)

CREATE VIEW high_salary_employees AS SELECT * FROM employees WHERE salary > 10000;

d)

SELECT * INTO high_salary_employees FROM employees WHERE salary > 10000;

e)

CREATE VIEW high_salary_employees WHERE salary > 10000;

13.

Which type of join returns only matching rows from both tables?

a)

CROSS JOIN

b)

FULL OUTER JOIN

c)

RIGHT JOIN

d)

LEFT JOIN

e)

INNER JOIN

14.

Which query returns the uppercase version of all employee names?

a)

SELECT LOWER(name) FROM employees;

b)

SELECT UPPER(name) FROM employees;

c)

SELECT INITCAP(name) FROM employees;

d)

SELECT REPLACE(name, 'a', 'A') FROM employees;

e)

SELECT SUBSTR(name, 1) FROM employees;

15.

Which of the following is used to replace NULL values in Oracle SQL?

a)

NVL

b)

SUBSTR

c)

COALESCE

d)

INITCAP

e)

REPLACE

16.

Which query returns employees whose name starts with 'J'?

a)

SELECT * FROM employees WHERE name LIKE '%J';

b)

SELECT * FROM employees WHERE name = 'J%';

c)

SELECT * FROM employees WHERE name CONTAINS 'J';

d)

SELECT * FROM employees WHERE name STARTS WITH 'J';

e)

SELECT * FROM employees WHERE name REGEXP_LIKE(name, '^J');

17.

What is the purpose of a synonym in Oracle?

a)

To define user privileges

b)

To create an alias for a database object

c)

To create foreign keys

d)

To define views

e)

To create triggers

18.

Which function returns the number of rows in a table?

a)

SUM()

b)

MAX()

c)

AVG()

d)

LENGTH(*)

e)

COUNT()

19.

Which query creates a synonym for the employees table?

a)

CREATE ALIAS emp AS employees;

b)

DEFINE SYNONYM employees AS emp;

c)

CREATE SYNONYM emp FOR employees;

d)

SET SYNONYM emp TO employees;

e)

RENAME employees TO emp;

20.

Which of the following is not a group function?

a)

LENGTH

b)

MAX

c)

MIN

d)

AVG

e)

SUM

21.

Which query selects departments having more than 10 employees?

a)

SELECT department_id FROM employees WHERE COUNT(*) > 10;

b)

SELECT department_id GROUP BY COUNT(*) > 10;

c)

SELECT department_id HAVING COUNT(*) > 10;

d)

SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(*) > 10;

e)

SELECT department_id FROM employees COUNT(*) > 10;

22.

What is the purpose of the INITCAP function in SQL?

a)

Converts text to uppercase

b)

Capitalizes the first letter of each word in a string

c)

Converts text to lowercase

d)

Returns the number of characters

e)

Trims white space

23.

Which query creates a view of employees in department 10?

a)

CREATE VIEW employees WHERE department_id = 10;

b)

CREATE VIEW dept10_employees AS employees IN department 10;

c)

VIEW dept10_employees FROM employees WHERE department_id = 10;

d)

CREATE VIEW dept10_employees AS SELECT * FROM employees WHERE department_id = 10;

e)

CREATE VIEW dept10_employees FROM employees WHERE department_id = 10;

24.

Which query shows all employees who work in the same department as 'John'?

a)

SELECT * FROM employees WHERE name = 'John' AND department_id IS NOT NULL;

b)

SELECT FROM employees WHERE EXISTS (SELECT FROM employees WHERE name = 'John');

c)

SELECT * FROM employees WHERE department_id = (SELECT department_id FROM employees WHERE name = 'John');

d)

SELECT * FROM employees JOIN departments ON employees.department_id = departments.id WHERE name = 'John';

e)

SELECT * FROM employees WHERE department_id IN (name = 'John');

25.

Which function returns the number of characters in a string?

a)

LENGTH

b)

COUNT

c)

CHAR

d)

MAX

e)

WIDTH

26.

Which query joins the orders and customers tables using a natural join?

a)

SELECT * FROM orders NATURAL JOIN customers;

b)

SELECT * FROM orders INNER JOIN customers ON orders.id = customers.id;

c)

SELECT * FROM orders FULL JOIN customers ON orders.customer_id = customers.customer_id;

d)

SELECT * FROM orders, customers WHERE orders.customer_id = customers.customer_id;

e)

SELECT * FROM orders LEFT OUTER JOIN customers;

27.

Which of the following is the correct use of the COALESCE function?

a)

SELECT COALESCE('Hello', NULL, NULL) AS greeting;

b)

SELECT COALESCE(NULL, NULL, 'Hello') FROM dual;

c)

SELECT COALESCE FROM table_name;

d)

SELECT * FROM COALESCE('x', 'y');

e)

COALESCE('a', 'b') SELECT * FROM dual;

28.

Which query counts the number of employees in each department?

a)

SELECT COUNT(department_id) FROM employees;

b)

SELECT COUNT(*) GROUP BY department_id FROM employees;

c)

SELECT department_id, COUNT(*) FROM employees;

d)

SELECT department_id, COUNT(*) FROM employees GROUP BY department_id;

e)

SELECT COUNT(*) FROM employees WHERE department_id IS NOT NULL;

29.

Which of the following statements about views is TRUE?

a)

Views can insert directly into sequences

b)

Views always contain indexes

c)

Views cannot be queried

d)

Views do not store data physically

e)

Views are faster than tables

30.

Which function combines first and last name with a space in between?

a)

SELECT CONCAT(first_name, last_name) FROM employees;

b)

SELECT first_name || ' ' || last_name FROM employees;

c)

SELECT first_name + last_name FROM employees;

d)

SELECT CONCAT_WS(' ', first_name, last_name) FROM employees;

e)

SELECT first_name & ' ' & last_name FROM employees;

31.

What does the following subquery return?

SELECT * FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE department_id = 30);

a)

All employees in department 30

b)

Employees with the highest salary

c)

Employees earning less than average

d)

Employees earning more than the highest salary in department 30

e)

Employees with NULL salary

32.

Which query returns all employees not in department 50?

a)

SELECT * FROM employees WHERE department_id != 50;

b)

SELECT * FROM employees WHERE department_id = 50;

c)

SELECT * FROM employees WHERE department_id NOT IN 50;

d)

SELECT * FROM employees EXCEPT department_id = 50;

e)

SELECT * FROM employees WHERE department_id <> 50;

33.

Which clause is used with GROUP BY to filter grouped rows?

a)

WHERE

b)

HAVING

c)

ORDER BY

d)

SELECT

e)

GROUP FILTER

34.

Which query creates a sequence that increments by 1 and starts at 1?

a)

CREATE SEQUENCE seq1 BEGIN 1 STEP 1;

b)

CREATE SEQUENCE seq1 START WITH 1 INCREMENT BY 1;

c)

CREATE SEQUENCE seq1 VALUES (1, 1);

d)

SEQUENCE seq1 START = 1 INCREMENT = 1;

e)

CREATE NEW SEQUENCE seq1 STARTING AT 1;

35.

What does the TO_CHAR function do in Oracle SQL?

a)

Converts text to date format

b)

Changes the case of a character

c)

Converts a number or date to a string

d)

Replaces characters in a string

e)

Trims white space

36.

Which query shows the highest salary in each department?

a)

SELECT department_id, MAX(salary) FROM employees GROUP BY department_id;

b)

SELECT department_id, salary FROM employees WHERE salary = MAX(salary);

c)

SELECT MAX(salary) FROM employees;

d)

SELECT department_id FROM employees GROUP BY MAX(salary);

e)

SELECT * FROM employees GROUP BY department_id MAX(salary);

37.

What is the result of this query?

SELECT NVL(commission_pct, 0) FROM employees;

a)

Deletes NULL commission values

b)

Shows only non-NULL commissions

c)

Filters rows with 0 commission

d)

Replaces salary with 0

e)

Replaces NULL commission values with 0

38.

What does the DISTINCT keyword do?

a)

Sorts the data

b)

Converts NULL to a value

c)

Filters based on condition

d)

Removes duplicate rows from the result

e)

Reverses the result order

39.

What does this query do?

SELECT * FROM employees WHERE REGEXP_LIKE(email, '^[a-zA-Z0-9._%+-]+@oracle.com$');

a)

Validates phone numbers

b)

Filters emails ending with @oracle.com using regular expressions

c)

Finds employees without email addresses

d)

Changes email domain to oracle.com

e)

Converts email to lowercase

40.

Which query lists all departments that have no employees?

a)

SELECT FROM departments WHERE NOT EXISTS (SELECT FROM employees);

b)

SELECT * FROM departments WHERE COUNT(employees) = 0;

c)

SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(*) = 0;

d)

SELECT * FROM departments WHERE department_id = 0;

e)

SELECT * FROM departments WHERE department_id NOT IN (SELECT DISTINCT department_id FROM employees);