SELECT GREATEST(200, 10, 40); -- returns 200
An example of needing this might be to calculate shipping costs.
SELECT name, weight, GREATEST(30, 2 * weight) AS shipping_cost FROM products;
SELECT LEAST(200, 10, 40); -- returns 10
"If price > 600 then 'high, if price > 300 then 'medium' else 'cheap'"
SELECT name, price, CASE price WHEN 600 THEN 'high' WHEN 300 THEN 'medium' ELSE 'cheap' END AS price_category FROM products;