Questions: DISTINCT: Eliminating Duplicate Rows

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A table has columns: first_name, last_name, department. Compared to SELECT DISTINCT first_name FROM employees, how will SELECT DISTINCT first_name, department FROM employees affect the row count?

AIt will decrease, since more filtering criteria are applied
BIt will stay the same, since first_name already determines uniqueness
CIt will increase or stay the same, since more column combinations can be unique
DIt will always exactly double, since department doubles the grouping dimensions
Question 2 Multiple Choice

A JOIN between orders and customers is returning unexpected duplicate rows. A developer adds DISTINCT to the SELECT to fix it. What is the most likely underlying problem?

AThe orders table has corrupted data entries that need to be cleaned
BA missing or incorrect join condition is causing unintended many-to-many matches
CDISTINCT is being applied before the WHERE clause, producing wrong results
DThe database engine is not correctly processing the specified join type
Question 3 True / False

SELECT DISTINCT city, state FROM customers can return more rows than SELECT DISTINCT city FROM the same table.

TTrue
FFalse
Question 4 True / False

The DISTINCT keyword modifies the underlying table data by permanently removing duplicate rows.

TTrue
FFalse
Question 5 Short Answer

When should you be suspicious that DISTINCT is hiding a bug rather than solving a legitimate problem?

Think about your answer, then reveal below.