IntermediateWHERE & Filtering
Find products with price ending in .99
The query
SQL
SELECT name, price
FROM products
WHERE price::TEXT LIKE '%.99'
OR MOD(price * 100, 100) = 99
ORDER BY price;Note
“Two approaches: casting to TEXT and LIKE, or using MOD arithmetic. MOD is more accurate for decimals.