Introduction
Function COUNT
Function AVG
Functions SUM, MAX, MIN
Revision

Instruction

It worked, didn't it? Good job.

Usually, COUNT is used together with GROUP BY. Do you remember how GROUP BY works? It groups together all the rows which share a common value in the column which we specified. We apply GROUP BY to obtain some statistics for entire groups of rows, like the number of items in these groups:

SELECT translator_id, COUNT(project_id)
FROM project
GROUP BY translator_id;

The above query will group the projects carried out by specific translators and will provide the number of projects completed by each translator.

Exercise

Show each client's id together with the number of projects they have commissioned.

Stuck? Here's a hint!

Use COUNT(project_id) and group the rows by the client id.

Console

Code editor

Result

TableConsole