Home / code / sql

Aggregate functions

With aggregate function you can do some calculations. Like how many entries are there, what is the maximum, what is the minimum, ...

SELECT count(*) FROM table
There are no column names now, if you to add a column name then we need to us as(alias).
SELECT count(*) AS number FROM table

You can do more then just show the number:
SELECT avg(field) AS average, max(field) AS maxi, min(field) AS mini, sum(field) AS sumi FROM table

 

TOP

Latest script:

 

Books: