
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