Examine the description of the PROMOTIONS table:
You want to display the unique promotion costs in each promotion category.
Which two queries can be used? (Choose two.)
Examine the description of the PROMOTIONS table:
You want to display the unique promotion costs in each promotion category.
Which two queries can be used? (Choose two.)
To display the unique promotion costs in each promotion category, the DISTINCT keyword should be used correctly. Option A correctly uses DISTINCT to ensure unique combinations of promo_category and promo_cost, even with concatenation. Option C uses DISTINCT correctly on the combination of promo_category and promo_cost. Other options either misuse the DISTINCT keyword or do not achieve the required result of displaying unique costs for each category.
The correct options for displaying the unique promotion costs in each promotion category are A and C.
-- 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.
Distinct is used to get distinct set of values for one or more columns mentioned in select statement
AC are correct. DB have Distinct in a wrong position in the query and E returns all because of the missing DISTINCT
AC are correct. DB have Distinct in a wrong position in the query and E returns all because of the missing DISTINCT
ac are correct answers
A and C are correct.
Agree that right answers are A and C
Agree that right answers are A and C
The correct answers
AC are correct
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.
I tried all the options.The ORDER BY still works in this concatenations and the table shows what its required
distinct must come soon after the select keyword and only one per select statement