Recall & Review
beginner
What does the MIN() function do in SQL?
The MIN() function returns the smallest value from a column or expression in a set of rows.
Click to reveal answer
beginner
What does the MAX() function do in SQL?
The MAX() function returns the largest value from a column or expression in a set of rows.
Click to reveal answer
intermediate
How do MIN() and MAX() functions handle NULL values?
MIN() and MAX() ignore NULL values when calculating the smallest or largest value.
Click to reveal answer
beginner
Write a SQL query to find the minimum and maximum price from a products table.
SELECT MIN(price) AS LowestPrice, MAX(price) AS HighestPrice FROM products;
Click to reveal answer
intermediate
Can MIN() and MAX() be used with GROUP BY? What does it do?
Yes, they can be used with GROUP BY to find the smallest or largest value within each group of rows.
Click to reveal answer
What will the query SELECT MIN(age) FROM users; return?
✗ Incorrect
MIN(age) returns the smallest age value, which is the youngest user.
If a column contains NULL values, how do MIN() and MAX() treat them?
✗ Incorrect
MIN() and MAX() ignore NULL values when calculating results.
Which SQL clause is used with MIN() and MAX() to get results per category?
✗ Incorrect
GROUP BY groups rows so MIN() and MAX() can find values per group.
What does this query return? SELECT MAX(salary) FROM employees;
✗ Incorrect
MAX(salary) returns the highest salary value.
Can MIN() and MAX() be used on text columns?
✗ Incorrect
MIN() and MAX() work on text columns returning alphabetically smallest and largest values.
Explain how MIN() and MAX() functions work in SQL and give an example query.
Think about finding lowest and highest values in a list.
You got /4 concepts.
Describe how you would find the highest and lowest prices for each product category using MIN() and MAX().
Grouping helps find min and max per group.
You got /3 concepts.