-- Created on savesnippets.com · https://savesnippets.com/RcgnjgKA5cZo8w -- Numeric range (inclusive) SELECT * FROM orders WHERE amount BETWEEN 100 AND 500; -- equivalent to: amount >= 100 AND amount <= 500 -- Date range — be explicit about times! SELECT * FROM orders WHERE created_at BETWEEN '2025-01-01' AND '2025-01-31'; -- ⚠️ This MISSES anything on Jan 31 after 00:00:00. -- Correct way for "the month of January" SELECT * FROM orders WHERE created_at >= '2025-01-01' AND created_at < '2025-02-01'; -- half-open interval is safer -- NOT BETWEEN excludes the range (inclusive endpoints) SELECT * FROM products WHERE price NOT BETWEEN 0 AND 9.99;