Hi! Could we please enable some services and cookies to improve your experience and our website?
Privacy & Cookie Policy.Create an SQL query to find customers who have rented more movies than the average number of rentals among all customers. Use a subquery to calculate the average number of rentals. The resulting table should contain the following columns: customer_id - unique customer identifier, first_name - customer name, last_name - client’s last name. rental_count - number of films rented.
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.ER diagram of the Sakila database
The Sakila database contains 15 main tables describing various aspects of a DVD rental company.
| actor_id | first_name | last_name | last_update |
|---|---|---|---|
| 1 | John | Doe | 2023-01-01 12:00:00 |
| address_id | address | address2 | district | city_id | postal_code | phone | last_update |
|---|---|---|---|---|---|---|---|
| 1 | 123 Main St | [null] | Downtown | 1 | 12345 | +1234567890 | 2023-01-01 12:00:00 |
| category_id | name | last_update |
|---|---|---|
| 1 | Action | 2023-01-01 12:00:00 |
| city_id | city | country_id | last_update |
|---|---|---|---|
| 1 | Metropolis | 1 | 2023-01-01 12:00:00 |
| country_id | country | last_update |
|---|---|---|
| 1 | United States | 2023-01-01 12:00:00 |
| customer_id | store_id | first_name | last_name | address_id | active | create_date | last_update | |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | John | Doe | john.doe@example.com | 1 | 1 | 2023-01-01 12:00:00 | 2023-01-01 12:00:00 |
| film_id | title | description | release_year | language_id | original_language_id | rental_duration | rental_rate | length | replacement_cost | rating | special_features | last_update |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Film Title | A brief description of the film. | 2000 | 1 | 2 | 5 | 4.99 | 120 | 19.99 | PG-13 | Trailers, Commentaries | 2023-01-01 12:00:00 |
| actor_id | film_id | last_update |
|---|---|---|
| 1 | 1 | 2023-01-01 12:00:00 |
| film_id | category_id | last_update |
|---|---|---|
| 1 | 1 | 2023-01-01 12:00:00 |
| inventory_id | film_id | store_id | last_update |
|---|---|---|---|
| 1 | 23 | 2 | 2023-01-01 12:00:00 |
| language_id | name | last_update |
|---|---|---|
| 1 | English | 2023-01-01 12:00:00 |
| payment_id | customer_id | staff_id | rental_id | amount | payment_date | last_update |
|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 4.99 | 2023-01-01 12:13:14 | 2023-01-01 12:14:15 |
| rental_id | rental_date | inventory_id | customer_id | return_date | staff_id | last_update |
|---|---|---|---|---|---|---|
| 1 | 2023-01-01 16:15:21 | 1 | 1 | 2023-01-10 09:12:36 | 1 | 2023-01-01 12:00:00 |
| staff_id | first_name | last_name | address_id | picture | store_id | active | username | password | last_update | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | John | Doe | 1 | [null] | john.doe@example.com | 1 | 1 | johndoe | ******** | 2023-01-01 12:00:00 |
| store_id | manager_staff_id | address_id | last_update |
|---|---|---|---|
| 1 | 1 | 1 | 2023-01-01 12:00:00 |