There are a slew of mathematical functions in SQL such as avg(), max() and sum. We have already made use of count() which will return the total number of records.
Let’s look at some common functions in SQL.
CREATE TABLE artist ( id int auto_increment primary key, artiste varchar(30), album varchar(50), price decimal(3, 2) ); INSERT INTO artist (artiste, album, price) VALUES ('Rod Stewart', 'Maggie May', 8.90 ), ('New Order', 'Substance', 7.50), ('Nirvana', 'Smell Like Teen Spirit', 9.80);
select sum(price) from artist select avg(price) from artist select max(price) from artist select min(price) from artist select count(price) from artist