🙏 Help keep this project alive. Last month we raised only $32 - enough for servers only. Without your support, there will be no new lessons or features. Support now →
SQL code copied to buffer
RU PT FR
Task 45:

Customer Store Preference

Analyze customer rental data to determine each customer's preferred store based on their rental counts from two specific stores. The ratio is calculated as the count of rentals in one store divided by the count of rentals in the second store. A store is preferred when the ratio of rentals in that store is greater than 1.25.

Your output should include the following columns:
- customer_id: The unique identifier for each customer.
- preferred_store: A label indicating the preferred store ('store 1', 'store 2', or 'no preferred') based on the rental counts. 

Sort the results by customer_id in ascending order.

Use MySQL syntax to write your answer. Descriptions of tables are provided in the right pane.

Write your request in the field below and click the "Check it!" button.
Get hint
Copy code Clear editor

Hi! Could we please enable some services and cookies to improve your experience and our website?

Privacy & Cookie Policy.