Recall & Review
beginner
What does the MIN() function do in SQL?
The MIN() function returns the smallest value from a column in a table.
Click to reveal answer
beginner
What does the MAX() function do in SQL?
The MAX() function returns the largest value from a column in a table.
Click to reveal answer
intermediate
Can MIN() and MAX() be used with text columns?
Yes, MIN() and MAX() can be used with text columns. They return the smallest or largest value based on alphabetical order.
Click to reveal answer
intermediate
How do MIN() and MAX() behave with 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 highest salary from an 'employees' table.
SELECT MAX(salary) AS highest_salary FROM employees;
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 age.
Which SQL function returns the largest value in a column?
✗ Incorrect
MAX() returns the largest value in a column.
If a column contains NULL values, how do MIN() and MAX() treat them?
✗ Incorrect
MIN() and MAX() ignore NULL values when calculating results.
What does SELECT MAX(name) FROM customers; return if 'name' is a text column?
✗ Incorrect
MAX() on text returns the alphabetically last value.
Which of these queries finds the smallest price in a 'products' table?
✗ Incorrect
MIN(price) returns the smallest price.
Explain how the MIN() and MAX() functions work in SQL and give an example of each.
Think about finding lowest and highest values in a list.
You got /4 concepts.
Describe how NULL values affect the results of MIN() and MAX() functions in SQL.
Consider what happens if some data is missing.
You got /3 concepts.