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.)
A.
SELECT DISTINCT promo_category || ' has ' || promo_cost AS COSTS FROM promotions ORDER BY 1;
B.
SELECT DISTINCT promo_cost || ' in ' || DISTINCT promo_category FROM promotions ORDER BY 1;
C.
SELECT DISTINCT promo_category, promo_cost FROM promotions ORDER BY 1;
D.
SELECT promo_category DISTINCT promo_cost, FROM promotions ORDER BY 2;
E.
SELECT promo_cost, promo_category FROM promotions ORDER BY 1;
-- 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.
This section is not available anymore. Please use the main Exam Page.1z0-071 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.
A_Qazi786
1 week, 1 day agokartajin
2 months, 2 weeks agopushpaksarode
3 months, 2 weeks agodici79
6 months ago5cff9a8
8 months, 2 weeks agoDrexan
8 months, 2 weeks agofuck_india
1 year, 1 month agoalelejaja
1 year, 1 month agoStevenciu
1 year, 3 months agoLee_jong_suk
1 year, 7 months agoKizTine
1 year, 9 months agotradersmj1
2 years, 1 month agoOracle_373
2 years, 1 month agoalic_alex
2 years, 4 months agosubtype11
2 years, 5 months agoJ4vi
2 years, 2 months agoelchiko
2 years, 7 months agoRik92
2 years, 8 months ago