Aggregations in SQL

Problem #245

Tags: special practical sql

Who solved this?

No translations... yet

One of the tables used by this site's database keeps user's data: name, country and solved - the last is the number of solved problems.

We want to create a brief report per country - telling total number of users belonging to every country - and total number of problems solved by them. There are two small additional requirements however:

Example

Suppose we have the following data:

name        country     solved
-------     -------     ------
Liza        UK          18
Joe         USA         5
Abe         USA         15
Daniel      UK          0
Moha        India       20

Report should be like this:

USA,2,20
India,1,20
UK,1,18
You need to login to get test data and submit solution.