Get startedGet started for free

Groups of customers

Use the CUBE operator to extract the content of a pivot table from the database. Create a table with the total number of male and female customers from each country.

This exercise is part of the course

Data-Driven Decision Making in SQL

View Course

Exercise instructions

  • Create a table with the total number of customers, of all female and male customers, of the number of customers for each country and the number of men and women from each country.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

SELECT ___, -- Extract information of a pivot table of gender and country for the number of customers
	   ___,
	   ___
FROM customers
GROUP BY CUBE (___, ___)
ORDER BY country;
Edit and Run Code