Which Transact-SQL code segments should you use?

You have a table named ProductCounts that contains 1000 products as well as the number of units that have been sold for each product.
You need to write a query that displays the top 5% of products that have been sold most frequently.
Which Transact-SQL code segments should you use?
A. WITH Percentages AS
(SELECT *, NTILE(5) OVER (ORDER BY UnitsSold) AS groupingColumn
FROM ProductCounts)
SELECT *
FROM percentages
WHERE groupingColumn =1;
B. WITH Percentages AS
( SELECT *, NTILE(20) OVER (ORDER BY UnitsSold) AS groupingColumn
FROM ProductCounts)
SELECT *
FROM Percentages
WHERE groupingColumn = 20;
C. WITH Percentages AS
(SELECT *, NTILE(20) OVER (ORDER BY UnitsSold) AS groupingColumn
FROM ProductCounts)
SELECT *
FROM Percentages
WHERE groupingColumn = 1;
D. WITH Percentages AS
(SELECT *, NTILE(5) OVER (ORDER BY UnitsSold) AS groupingColumn
FROM ProductCounts)
SELECT *
FROM Percentages
WHERE groupingColumn = 5;

microsoft-exams

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.