Difficulty: Easy
Correct Answer: DISTINCT
Explanation:
Introduction / Context:
Queries that project fewer columns than the primary key may return duplicate rows. SQL provides a direct way to collapse duplicates in the result set without additional grouping logic.
Given Data / Assumptions:
Concept / Approach:
The DISTINCT keyword modifies SELECT to return only unique rows across the selected columns. Some systems accept SELECT DISTINCT ON (columns) with special semantics, but the general keyword is DISTINCT. UNIQUE is not the standard keyword for SELECT and may be reserved for constraints; ONLY, SINGLE, or NODUP are not standard.
Step-by-Step Solution:
Verification / Alternative check:
Compare row counts with and without DISTINCT to confirm deduplication.
Why Other Options Are Wrong:
Common Pitfalls:
Using DISTINCT to mask poor join conditions. Always ensure joins are correct; DISTINCT should not be a band-aid for cartesian products.
Final Answer:
DISTINCT
Discussion & Comments