Skip to main contentSkip to solution

Out of the following SQL statements, which one will give the range of prices from the 'Products' table?

Solution

✅ Correct Option: 1

Range is the highest value minus the lowest value. The aggregate functions MAX()\text{MAX}() and MIN()\text{MIN}() give these directly, so MAX(Price) - MIN(Price) returns the range in a single valid query, and AS Pricerange names the result column.


Option 2: standard SQL has no built-in RANGE() aggregate function.

Option 3: two separate SELECT statements cannot be subtracted with -; each would need to be a bracketed subquery, and LIMIT 1 - SELECT ... is not valid syntax.

Option 4: the idea is right (subtracting two subqueries), but the extra SELECT before the second bracket makes the syntax invalid.

Keyboard Shortcuts

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