The RANGE function

The RANGE function computes the difference between the maximum and the minimum values for the selected rows.

You can apply the RANGE function only to numeric columns. The following query finds the range of prices for items in the stock table.
Figure 1: Query
SELECT RANGE(unit_price) FROM stock;
Figure 2: Query result
(range)

955.50
As with other aggregates, the RANGE function applies to the rows of a group when the query includes a GROUP BY clause, which the following query shows.
Figure 3: Query
SELECT RANGE(unit_price) FROM stock
   GROUP BY manu_code;
Figure 4: Query result
(range)

820.20
595.50
720.00
225.00
632.50
  0.00
460.00
645.90
425.00