Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Function COUNT
Function AVG
Functions SUM, MAX, MIN
Review

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 clients IDs (client_id) together with the number of projects they have commissioned. Name the second column projects_no. Don't show clients without any project.

Stuck? Here's a hint!

Use COUNT(project_id) and group the rows by the client_id column. Use only the project table.