Out of the following SQL statements, which one will give the range of prices from the 'Products' table?
Out of the following SQL statements, which one will give the range of prices from the 'Products' table?
Solution
Range is the highest value minus the lowest value. The aggregate functions and 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.
Related questions:
2025: 13 May Shift 2
2026: 23 May Shift 1
2026: 11 May Shift 2
2026: 23 May Shift 2