MIN and MAX Functions in SQL
Level 3101 keystrokes
MIN and MAX find the smallest and largest values in a column.
SQL code
1SELECT -- MIN returns the lowest price among the filtered rows2 MIN(price) AS min_price, -- MAX returns the highest price; together they give one result row3 MAX(price) AS max_price4FROM5 products-- WHERE runs before the aggregates, so only Electronics products count6WHERE7 category = 'Electronics';Output
+-----------+-----------+ | min_price | max_price | +-----------+-----------+ | 29.99 | 999.99 | +-----------+-----------+ 1 row in set
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this SQL code and how often they appear.
_× 2'× 2(× 2)× 2,× 1;× 1=× 1