Exam DP-600 Topic 2 Question 86 Discussion
Actual exam question for Microsoft's DP-600 exam
Question #: 86
Topic #: 2
Question #: 86
Topic #: 2
You have a Fabric lakehouse named Lakehouse1 that contains the following data.

You need build a T-SQL statement that will return the total sales amount by OrderDate only for the days that are holidays in Australia. The total sales amount must sum the quantity multiplied by the price on each row in the dbo.sales table.
How should you complete the statement? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.


You need build a T-SQL statement that will return the total sales amount by OrderDate only for the days that are holidays in Australia. The total sales amount must sum the quantity multiplied by the price on each row in the dbo.sales table.
How should you complete the statement? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Suggested Answer:

Explanation:

Step 1: Requirement
We need to calculate total sales amount by OrderDate.
Total Sales Amount = Quantity × UnitPrice per row.
Then SUM over all rows per OrderDate.
Only include rows where the OrderDate matches a public holiday in Australia.
Step 2: Calculation Logic
If we select s.Quantity * s.UnitPrice, it only computes row-level values.
To calculate the total sales amount per OrderDate, we need:
SUM(s.Quantity * s.UnitPrice) AS TotalSalesAmt
Thus, the correct calculation: SUM(s.Quantity * s.UnitPrice)
Step 3: Join Type
We want to return only those sales that occurred on public holidays in Australia.
If we used a LEFT JOIN, we'd include all sales regardless of holiday.
A FULL OUTER JOIN would include non-matching rows, not required.
A CROSS JOIN would duplicate results unnecessarily.
A RIGHT OUTER JOIN would include holidays with no sales, which is not needed.
The correct choice is an INNER JOIN on matching dates.
Step 4: Final Query
SELECT
s.OrderDate,
SUM(s.Quantity * s.UnitPrice) AS TotalSalesAmt
FROM dbo.sales AS s
INNER JOIN dbo.publicholidays AS ph
ON s.OrderDate = ph.Date
WHERE ph.countryOrRegion = 'Australia'
GROUP BY s.OrderDate;
Why This is Correct
SUM(s.Quantity * s.UnitPrice) # ensures sales are aggregated correctly.
INNER JOIN # ensures only rows where OrderDate matches a holiday are included.
WHERE ph.countryOrRegion = 'Australia' # filters holidays to Australia only.
References
SUM (Transact-SQL)
JOIN operations in T-SQL
by Leo at May 08, 2026, 01:59 PM
0
0
0
10
Comments
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.
Report Comment
Commenting
You can sign-up / login (it's free).