Microsoft Fabric Data Engineer Associate DP-700 Practice Question
While testing a report in Microsoft Fabric warehouse, you run this T-SQL: SELECT OrderDate, COUNT(*) AS TotalOrders FROM dbo.SalesOrders WHERE OrderStatus = 'Completed';
It returns error 8120 stating that column 'OrderDate' must appear in the GROUP BY clause. You need the simplest fix so the query returns one row per day with the correct count. Which change should you make?
Insert the DISTINCT keyword after SELECT to eliminate duplicates.
Replace COUNT(*) with COUNT(OrderDate) to include the column in the aggregate.
Rewrite the aggregate as COUNT(*) OVER (PARTITION BY OrderDate).
The error is raised because the query mixes an aggregated column (COUNT()) with a non-aggregated column (OrderDate) without grouping. Adding OrderDate to a GROUP BY clause resolves the violation of the SQL aggregation rules and produces one summary row per distinct date. Merely switching to COUNT(OrderDate) does not remove the need to group; DISTINCT would still leave the aggregate unresolved; using a windowed COUNT() OVER (PARTITION BY OrderDate) calculates counts but returns a row for every order, not the required single row per day. Therefore, adding GROUP BY OrderDate is the correct and minimal correction.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the GROUP BY clause in SQL?
Open an interactive chat with Bash
Why does the query produce SQL error 8120 if GROUP BY is missing?
Open an interactive chat with Bash
How does COUNT(*) differ from COUNT(column_name) in T-SQL?
Open an interactive chat with Bash
Microsoft Fabric Data Engineer Associate DP-700
Monitor and optimize an analytics solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .