Examveda

Which keyword used with UNION does not retain duplicate rows?

A. ALL

B. NARROW

C. STRICT

D. DISTINCT

Answer: Option D

Solution (By Examveda Team)

This question is about combining the results of multiple SQL queries in MySQL.
The UNION keyword is used to combine the results of two or more SELECT statements. However, by default, UNION removes any duplicate rows that appear in the combined result.
To retain duplicate rows, we can use the ALL keyword with UNION. So, the answer to this question is Option A: ALL.
Here's a breakdown:
UNION: This combines the results of multiple queries, removing duplicates.
UNION ALL: This combines the results of multiple queries, including duplicates.
Option B: NARROW, Option C: STRICT are not valid keywords in this context.
Option D: DISTINCT is used to remove duplicate rows within a single SELECT statement, not with UNION.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous