Customers by Country (chinook database)

Medium
66
90.2% Acceptance

The dataset you're working with represents a digital media store. You'll find information about artists, albums, tracks, media types, genres, playlists, invoices, customers, and employees.

Instructions

  1. Carefully read through the challenge requirements.
  2. Stick strictly to the column and table names provided in the Chinook database schema.
  3. Always use double quotes for table and column names to avoid potential issues.
  4. After constructing your SQL query, test it to ensure it works as expected.
  5. Once you're confident in your solution, submit it for evaluation.

Challenges

Objective:

Determine the number of customers from each country.

Description:

Write an SQL query that counts the number of customers from each country. You should group the results by Country and order them alphabetically by Country.

Tables Used:

  • Customer

Expected Columns in Output:

  • Country
  • CustomerCount (this should represent the count of customers for each country)

Hints/Tips:

  • Make sure to use the COUNT function and the GROUP BY clause.
  • When writing your query, make sure to name the count column as CustomerCount.
  • Use double quotes around column names, for example: "Country".
  • Your result should be ordered by Country.

Example of Expected Output:

CountryCustomerCount
Brazil5
Canada8