laika222
11/2/2016 - 4:19 PM

MIN() and MAX() allow you to pull minimum and maximum values from a column in a table. Line 1 shows a MIN() example, which selects the minim

MIN() and MAX() allow you to pull minimum and maximum values from a column in a table. Line 1 shows a MIN() example, which selects the minimum (earliest) date from the OrderDate column found in the Orders table. Line 6 shows a MAX() example, which selects the maximum (highest) price from the Price column found in the Orders table.

-- MIN EXAMPLE
SELECT MIN(OrderDate) AS EarliestOrderDate
FROM Orders;


-- MAX EXAMPLE
SELECT MAX(Price) AS HighestPrice
FROM Orders;