Course Content
SQL Tutorial for Beginners
SQL Tutorial for Beginners
SQL Min and Max
Aggregate Functions
There are functions in SQL that returns single line result among a group of the rows. These functions are called aggregate functions.
MIN() and MAX() functions return the minimum and maximum result from the query, and this is always a single line.
Let's find the release date of the oldest song in our table:
SELECT MIN(year) FROM songs
Now, let's select the price
of the most expensive song of 21st century:
SELECT MAX(price) FROM songs WHERE year > 2000
Swipe to show code editor
Find the price
of the most expensive song.
Thanks for your feedback!
SQL Min and Max
Aggregate Functions
There are functions in SQL that returns single line result among a group of the rows. These functions are called aggregate functions.
MIN() and MAX() functions return the minimum and maximum result from the query, and this is always a single line.
Let's find the release date of the oldest song in our table:
SELECT MIN(year) FROM songs
Now, let's select the price
of the most expensive song of 21st century:
SELECT MAX(price) FROM songs WHERE year > 2000
Swipe to show code editor
Find the price
of the most expensive song.
Thanks for your feedback!
SQL Min and Max
Aggregate Functions
There are functions in SQL that returns single line result among a group of the rows. These functions are called aggregate functions.
MIN() and MAX() functions return the minimum and maximum result from the query, and this is always a single line.
Let's find the release date of the oldest song in our table:
SELECT MIN(year) FROM songs
Now, let's select the price
of the most expensive song of 21st century:
SELECT MAX(price) FROM songs WHERE year > 2000
Swipe to show code editor
Find the price
of the most expensive song.
Thanks for your feedback!
Aggregate Functions
There are functions in SQL that returns single line result among a group of the rows. These functions are called aggregate functions.
MIN() and MAX() functions return the minimum and maximum result from the query, and this is always a single line.
Let's find the release date of the oldest song in our table:
SELECT MIN(year) FROM songs
Now, let's select the price
of the most expensive song of 21st century:
SELECT MAX(price) FROM songs WHERE year > 2000
Swipe to show code editor
Find the price
of the most expensive song.