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

Instruction

That's right! The keyword DISTINCT can, of course, be used in queries that apply GROUP BY. Take a look:

SELECT client_id, COUNT(DISTINCT translator_id)
FROM project
GROUP BY client_id;

The above query will show each client together with the number of translators who have ever worked on at least one project for that client.

Exercise

Let's check the statistics the other way round. For each translator in table project, show their id and the number of clients they have worked for.

Console

Code editor

Result

TableConsole