wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Database Query Language and procedural Language MCQS

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is used to retrieve data from a database in SQL?

a)

INSERT

b)

SELECT

c)

UPDATE

d)

DELETE

2.

Which SQL statement is used to retrieve all columns from the "students" table?

a)

SELECT * FROM students;

b)

SELECT students FROM *;

c)

GET ALL students;

d)

SELECT ALL FROM students;

3.

What is the purpose of the WHERE clause in SQL?

a)

To sort the data

b)

To filter the data

c)

To modify data

d)

To insert new data

4.

Which SQL clause is used to sort the result-set?

a)

ORDER BY

b)

SORT BY

c)

GROUP BY

d)

FILTER BY

5.

What is the function of the GROUP BY clause in SQL?

a)

To update data

b)

To filter records

c)

To join tables

d)

To aggregate data

6.

Which SQL command is used to remove a table from a database?

a)

ALTER TABLE table_name;

b)

REMOVE TABLE table_name;

c)

DROP TABLE table_name;

d)

DELETE TABLE table_name;

7.

What does the DISTINCT keyword do in a SQL query?

a)

Removes duplicate records

b)

Sorts the results

c)

Filters records based on a condition

d)

Groups records together

8.

Which SQL function is used to count the number of rows in a result set?

a)

COUNT()

b)

ROWS()

c)

SUM()

d)

AVG()

9.

What is the purpose of the JOIN clause in SQL?

a)

To sort the results

b)

To combine rows from two or more tables

c)

To update data

d)

To filter records

10.

Which SQL statement is used to update existing records in a table?

a)

CHANGE table_name;

b)

MODIFY table_name;

c)

UPDATE table_name SET;

d)

ALTER table_name;

11.

Which of the following statements in PL/SQL is used to exit a loop?

a)

BREAK

b)

EXIT

c)

CONTINUE

d)

STOP

12.

What is the use of the exception handling block in PL/SQL?

a)

To raise errors in the code

b)

To prevent errors from occurring

c)

To handle runtime errors gracefully

d)

To optimize queries

13.

What type of PL/SQL block is used to define a unit of work with inputs, outputs, and logic?

a)

Function

b)

Trigger

c)

Procedure

d)

Package

14.

Which SQL function is used to find the maximum value in a column?

a)

MAX()

b)

HIGHEST()

c)

GREATEST()

d)

TOP()

15.

What is the purpose of the HAVING clause in SQL?

a)

To filter records after aggregation

b)

To update records

c)

To join tables

d)

To sort the results

16.

Which SQL statement is used to create a new table in a database?

a)

CREATE TABLE table_name;

b)

NEW TABLE table_name;

c)

INSERT TABLE table_name;

d)

ADD TABLE table_name;

17.

Which SQL statement is used to delete records from a table?

a)

ERASE FROM table_name;

b)

DROP FROM table_name;

c)

DELETE FROM table_name;

d)

REMOVE FROM table_name;

18.

What is the purpose of the LIMIT clause in SQL?

a)

To group records together

b)

To filter records based on a condition

c)

To sort the results

d)

To restrict the number of records returned

19.

Which SQL function is used to calculate the average value of a numeric column?

a)

AVG()

b)

MEAN()

c)

SUM()

d)

MEDIAN()

20.

Which of the following is true about a stored procedure in SQL?

a)

It can only be called once

b)

It cannot accept input parameters

c)

It can be reused multiple times

d)

It must return a value