🙏 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 9:

Customer Store Preference

Analyze customer rental data to determine each customer's preferred store based on the ratio of rentals at each branch.
Store affiliation is determined through the employee (field store_id in the staff table) who processed the rental. A preferred store is one where the number of rentals is at least 1.25 times greater than at another store.
The output table should contain the following columns:
- customer_id: Unique identifier for the customer.
- preferred_store_id: Identifier of the preferred store (1, 2, or NULL if no preference exists).

Sort the results by the customer_id column 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.