Difficulty: Easy
Correct Answer: Incorrect
Explanation:
Introduction / Context:
SELECT DISTINCT is commonly used to eliminate duplicate rows in result sets. Misunderstanding this leads to the opposite of the desired output. This question checks whether you know the exact role of DISTINCT.
Given Data / Assumptions:
Concept / Approach:
SELECT DISTINCT applies a set operation over the projected columns, removing duplicate rows and returning only unique combinations. If the goal is to see duplicates, one would use GROUP BY with HAVING COUNT() > 1 or window functions (for example, COUNT() OVER(PARTITION BY ...)) to identify duplicates, not DISTINCT. Therefore, the statement claiming DISTINCT shows duplicates is the opposite of reality.
Step-by-Step Solution:
Verification / Alternative check:
Run sample data with repeated values; DISTINCT returns unique rows, while GROUP BY/HAVING reveals duplicates.
Why Other Options Are Wrong:
Common Pitfalls:
Using DISTINCT to “fix” unintended duplicates created by joins instead of correcting the join logic; assuming DISTINCT is per-column.
Final Answer:
Incorrect
Discussion & Comments