Exercise 11 of 17

Filter with a set of values

Fixed training server

Count the sequences from Germany, France and Italy, broken down by country, most frequent first.

The output should have this shape:

country | count
------- | -----
Germany | 1234
France  | 987
Italy   | 654

Write a query and run it. The result is compared with the reference answer without considering row order.

Loading query editor…
Explanation

Filter the table with in to keep sequences from Germany, France and Italy. Then, use groupBy to count the sequences for each country and order the rows by their counts.

Reference answer
default
  .filter(country.in({'Germany', 'France', 'Italy'}))
  .groupBy({count:=count()}, {country})
  .orderBy({count.desc()})