SQL MCQs – Data Manipulation and Querying

11.) What is the purpose of the BETWEEN operator?

A) Matches a range of values
B) Joins tables
C) Filters NULL values
D) Sorts rows

Answer: Option A

Explanation: BETWEEN filters records within a specified range.

12.) Which keyword is used to match patterns in SQL?

A) MATCH
B) LIKE
C) PATTERN
D) SEARCH

Answer: Option B

Explanation: LIKE is used in WHERE clauses to match patterns in string data.

13.) How do you rename a column in the result set?

A) USING
B) AS
C) RENAME
D) ALIAS

Answer: Option B

Explanation: AS creates an alias for a column in the query output.

14.) Which operator is used to combine the results of two queries?

A) CONNECT
B) JOIN
C) MERGE
D) UNION

Answer: Option D

Explanation: UNION combines the results of two queries and removes duplicates.

15.) What does the NOT IN operator do?

A) Excludes values from a list
B) Filters rows
C) Joins tables
D) Sorts rows

Answer: Option A

Explanation: NOT IN excludes rows with values in a specified list.

16.) How do you retrieve unique values from a column?

A) FILTER
B) UNIQUE
C) DISTINCT
D) GROUP BY

Answer: Option C

Explanation: DISTINCT retrieves unique values from a column.

17.) How do you find the highest value in a column?

A) MIN()
B) MAX()
C) TOP()
D) HIGHEST()

Answer: Option B

Explanation: MAX() returns the highest value in a specified column.

18.) What does the IN operator do?

A) Matches a value within a set
B) Filters rows
C) Sorts rows
D) Deletes rows

Answer: Option A

Explanation: IN checks if a value exists in a list of specified values.

19.) How do you check if a column contains NULL values?

A) CHECK NULL
B) = NULL
C) HAS NULL
D) IS NULL

Answer: Option D

Explanation: IS NULL is used to check for NULL values in a column.

20.) What is the result of a CROSS JOIN?

A) Cartesian product of two tables
B) Intersection of two tables
C) Difference of two tables
D) Union of two tables

Answer: Option A

Explanation: A CROSS JOIN generates a Cartesian product of two tables.

Leave a Reply

Your email address will not be published. Required fields are marked *