How to Use BETWEEN Correctly

The BETWEEN clause is used to validate if a value is in a range. For example

WITH sales AS (
  SELECT DATETIME '2022-01-03 12:34:56' AS sold_at, 600.00 as revenue UNION ALL
  SELECT DATETIME '2021-12-31 11:21:04', 120.20 UNION ALL
  SELECT DATETIME '2022-03-28 10:42:09', 520.00
)
 
select sold_at, revenue 
from   sales 
where  revenue between 500.00 and 1000.00

Is equivalent to:

WITH sales AS (
  SELECT DATETIME '2022-01-03 12:34:56' AS sold_at, 600.00 as revenue UNION ALL
  SELECT DATETIME '2021-12-31 11:21:04', 120.20 UNION ALL
  SELECT DATETIME '2022-03-28 10:42:09', 520.00
)
 
select sold_at, revenue 
from   sales  
where revenue >= 500.00 and revenue <= 1000.00

IN THIS PAGE