Question:medium

Which of the following SQL query will filter products having cost more than 500?

Show Hint

Always use WHERE for conditions on individual records.
Always use HAVING for conditions on aggregated groups!
WHERE comes before GROUP BY, while HAVING comes after GROUP BY!
Updated On: Jun 11, 2026
  • SELECT ProductName FROM PRODUCTS WHERE Cost$>$500;
  • SELECT ProductName FROM PRODUCTS GROUP BY Cost$>$500;
  • SELECT ProductName FROM PRODUCTS HAVING Cost$>$500;
  • SELECT DISTINCT ProductName FROM PRODUCTS HAVING Cost$>$500;
Show Solution

The Correct Option is A

Solution and Explanation


Step 1: Understanding the Concept:

The ‘WHERE‘ clause is the standard method for filtering individual records in an SQL table based on specific conditions before any grouping occurs.

Step 2: Detailed Explanation:

1. ‘WHERE‘ filters rows based on a condition (Cost > 500).
2. ‘HAVING‘ is used specifically for filtering *aggregated* data (after a ‘GROUP BY‘ clause).
3. ‘GROUP BY‘ is used for aggregating data, not filtering rows.

Step 3: Final Answer:

The correct query is (A).
Was this answer helpful?
0


Questions Asked in CUET (UG) exam