Keep SQLtest alive: Help cover this month's $100 server costs to keep all lessons and the SQL playground online. Support the project →
SQL code copied to buffer
Task 158:

Customer Rental Summary

MySQL
Write a query to summarize rental activity by customer, specifically counting the number of rentals from two different stores. Your output should include the following columns:
- customer_id: The unique identifier for each customer.
- store_1_rentals: The count of rentals from store 1.
- store_2_rentals: The count of rentals from store 2.

The store defined according store_id in staff table.
Sort the results by customer_id.
Expected result Columns: 3 · Rows: 599
customer_id store_1_rentals store_2_rentals

Sample rows open after wrong checks: 0 of 3

Write your query below and click "Check it!". Tables are described in the right pane.

The query result will appear here. Ctrl+Enter - Run query