Kata 7kyu

Given a demographics table in the following format:

** demographics table schema **

  • id
  • name
  • birthday
  • race

you need to return a table that shows a count of each race represented, ordered by the count in descending order as:

** output table schema **

  • race
  • count

Hint: “group by race” can give us the unique race in the input table!

Solution:

select count(*) as count, race
from demographics
group by race
order by count desc;

Link

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Isabelle

Isabelle

In love with telling stories with data