Skip to main contentSkip to solution

Which of the following SQL query will filter products (ProductName) having Cost more than 1000 from the table PRODUCTS?

Solution

✅ Correct Option: 1

The WHERE clause filters individual rows before they are returned. Cost>1000\text{Cost} > 1000 is a row-level condition, so SELECT ProductName FROM PRODUCTS WHERE Cost>1000; returns the names of products costing more than 1000.


Options 3 and 4: HAVING filters groups after GROUP BY (usually with aggregate functions like SUM or COUNT). It is not meant for plain row conditions, and without GROUP BY a non-aggregated column like Cost in HAVING is invalid in standard SQL.

Option 2: GROUP BY only groups rows. It does not filter them, and a condition like Cost>1000 is not a valid grouping column.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question