Using the customers table, you need to generate a report that shows 50% of each credit amount in
each income level. The report should NOT show any repeated credit amounts in each income level.
Which query would give the required result?
A.
Option A
B.
Option B
C.
Option C
D.
Option D
Explanation:
Duplicate Rows
Unless you indicate otherwise, SQL displays the results of a query without eliminating the
duplicate rows.
To eliminate duplicate rows in the result, include the DISTINCT keyword in the SELECT clause
immediately after the SELECT keyword.
You can specify multiple columns after the DISTINCT qualifier. The DISTINCT qualifier affects all
the selected columns, and the result is every distinct combination of the columns.
Yes, C is the correct answer.
– A cannot be correct -> DISTINCT is not immediately following SELECT
– B cannot be correct -> more than one DISTINCT keyword in this statement
– D cannot be correct -> DISTINCT keyword is absent