The correct answer is that the HAVING clause filters groups after GROUP BY based on aggregate conditions. This is because SQL processes WHERE before grouping, so WHERE cannot evaluate aggregate functions like SUM or COUNT—those values only exist after rows are grouped. HAVING steps in precisely at that point, allowing you to restrict groups by their aggregated results, such as only showing departments with a total salary over $100,000. On the Microsoft Azure Data Fundamentals DP-900 exam, this concept often appears in a query exhibit where a WHERE clause is mistakenly used with an aggregate, testing your understanding of SQL execution order. A common trap is confusing HAVING with WHERE; remember that WHERE filters rows, HAVING filters groups. For a quick memory tip, think “WHERE works on rows, HAVING works on groups—HAVING comes after GROUP BY.”
DP-900 Describe core data concepts Practice Question
This DP-900 practice question tests your understanding of describe core data concepts. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
```sql
SELECT ProductID, SUM(Quantity) AS TotalQuantity
FROM Sales
WHERE OrderDate >= '2023-01-01'
GROUP BY ProductID
HAVING SUM(Quantity) > 100
ORDER BY TotalQuantity DESC;
```
The exhibit shows a SQL query run against Azure SQL Database. What is the purpose of the HAVING clause in this query?
Refer to the exhibit.
```sql
SELECT ProductID, SUM(Quantity) AS TotalQuantity
FROM Sales
WHERE OrderDate >= '2023-01-01'
GROUP BY ProductID
HAVING SUM(Quantity) > 100
ORDER BY TotalQuantity DESC;
```
A
To filter rows before grouping
Why wrong: That's the WHERE clause.
B
To sort the result set
Why wrong: Sorting is done by ORDER BY.
C
To join two tables
Why wrong: Joins use JOIN clause.
D
To filter groups based on aggregate conditions
HAVING filters groups after GROUP BY using aggregate functions.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
To filter groups based on aggregate conditions
The HAVING clause in SQL is used to filter groups after the GROUP BY clause has been applied, based on aggregate conditions such as SUM, COUNT, or AVG. In this query against Azure SQL Database, HAVING restricts the result to only those groups that satisfy the specified aggregate condition, which cannot be done with a WHERE clause because WHERE filters individual rows before grouping.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
To filter rows before grouping
Why it's wrong here
That's the WHERE clause.
✗
To sort the result set
Why it's wrong here
Sorting is done by ORDER BY.
✗
To join two tables
Why it's wrong here
Joins use JOIN clause.
✓
To filter groups based on aggregate conditions
Why this is correct
HAVING filters groups after GROUP BY using aggregate functions.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often confuse HAVING with WHERE, mistakenly thinking HAVING can filter individual rows before grouping, when in fact WHERE must be used for that purpose.
Detailed technical explanation
How to think about this question
Under the hood, SQL processes queries in a specific order: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. The HAVING clause is evaluated after grouping and aggregation, allowing conditions like HAVING COUNT(*) > 5 to exclude groups that don't meet the threshold. In Azure SQL Database, HAVING can also reference aliases from the SELECT list in some contexts, but it cannot reference non-aggregated columns that are not in the GROUP BY clause.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this DP-900 question in full detail.
Describe core data concepts — This question tests Describe core data concepts — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: To filter groups based on aggregate conditions — The HAVING clause in SQL is used to filter groups after the GROUP BY clause has been applied, based on aggregate conditions such as SUM, COUNT, or AVG. In this query against Azure SQL Database, HAVING restricts the result to only those groups that satisfy the specified aggregate condition, which cannot be done with a WHERE clause because WHERE filters individual rows before grouping.
What should I do if I get this DP-900 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. The exhibit shows a T-SQL query against an Azure SQL Database. What is the purpose of the HAVING clause in this query?
medium
A.To sort the result set by TotalSales descending
B.To join two tables
✓ C.To filter groups after aggregation
D.To filter rows before grouping
Why C: The HAVING clause is used in T-SQL to filter groups after the GROUP BY clause has performed aggregation. In this query, it restricts the result set to only those product categories whose total sales (SUM(Amount)) exceed 1000, which is a condition on the aggregated value, not on individual rows.
Last reviewed: Jun 24, 2026
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This DP-900 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DP-900 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.