-- Distinct keyword is used to select the unique values of the column/combination of columns mentioned after the DISTINCT clause.
Thus Option E is incorrect , as this does not use DISTINCT clause and might include duplicates.
-- Distinct should be used once in a SELECT statement and should be used IMMEDIATELY after the SELECT clause. NOT to be used before every column.
Thus Options D and B are incorrect, as the positioning of the DISTINCT clause is incorrect.
-- Option A and C are correct.
Option A: Even though there is a string ' has ' in everyrow returned , the combination of promo_category || ' has ' || promo_cost will still be distinct.
Option C: correct use case. ORDER BY clause does not affect the uniqueness in the returned result set.
Option A is not correct because the query uses the "||" operator to concatenate the promo_category and promo_cost columns with a string ' has ' in between. This creates a new column "COSTS" that combines the values from the two columns in a way that is not useful for the task of displaying unique promotion costs in each promotion category. The SELECT DISTINCT statement is used on this combined column, so it will return unique values for the concatenated column, but it does not address the requirement of showing unique promotion costs in each promotion category. Additionally, it uses an ORDER BY 1 which in this case doesn't make sense since the column COSTS doesn't exist.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
5cff9a8
2 months agoDrexan
2 months, 1 week agofuck_india
7 months, 1 week agoalelejaja
7 months, 2 weeks agoStevenciu
9 months, 2 weeks agoLee_jong_suk
1 year agoKizTine
1 year, 3 months agotradersmj1
1 year, 7 months agoOracle_373
1 year, 7 months agoalic_alex
1 year, 10 months agosubtype11
1 year, 11 months agoJ4vi
1 year, 8 months agoelchiko
2 years, 1 month agoRik92
2 years, 2 months agoArtur1991
2 years, 4 months ago