MIN() and MAX() find the smallest and largest values in a numeric or date column. They're handy for finding the lowest/highest price, the earliest/latest date, or the smallest/largest ID.
sql
SELECT MIN(CustomerID) AS SmallestID,
MAX(CustomerID) AS LargestID
FROM Customers;You should see
+------------+-----------+ | SmallestID | LargestID | +------------+-----------+ | 1 | 4 | +------------+-----------+ What this code does: Finds the smallest and largest CustomerID in the Customers table and shows them under aliased names. Practical use: In a product table, you can use MIN(price) and MAX(price) to power a price range filter.