Which query would achieve the required result?

Examine the structure of the PROMOTIONS table:

The management wants to see a report of unique promotion costs in each promotion category.
Which query would achieve the required result?

Examine the structure of the PROMOTIONS table:

The management wants to see a report of unique promotion costs in each promotion category.
Which query would achieve the required result?

A.
SELECT DISTINCT promo_cost, promo_category FROM promotions;

B.
SELECT promo_category, DISTINCT promo_cost FROM promotions;

C.
SELECT DISTINCT promo_cost, DISTINCT promo_category FROM promotions;

D.
SELECT DISTINCT promo_category, promo_cost FROM promotions ORDER BY 1;



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Robin

Robin

I think A is also correct, since the columns order doesn’t matter on DISTINCT statement (it will retrieve unique combinations for promo_category and promo_cost). And I don’t see why would be necessary the ORDER BY clause based on what was asked on the question. So, I think A and D.

Hola

Hola

A is wrong because, the results would be something like below

Promo_cost Promo_category
1000 A
2000 A
1000 B
2000 B

The answer is D