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

Instruction

Correct again. When we write COUNT(project_id), we actually mean COUNT(ALL project_id), including all non-NULL values. If a value is duplicated, then each duplicate is counted separately.

We can also use the keyword DISTINCT to remove duplicates.

SELECT COUNT(DISTINCT client_id)
FROM project;

The above query will count the number of clients that have commissioned at least one project from the table project.

Note that we had to include the keyword DISTINCT – if we hadn't, we would've got the number of all projects where client_id was not NULL.

Exercise

Count the number of translators that did translate at least one project.

Console

Code editor

Result

TableConsole