problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Please list the full names of all the customers who live in Italy.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy'
Write SQL query to solve given problem: Which country does Mary Smith live in?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH'
Write SQL query to solve given problem: What is the biggest amount of payment for a rental made by Mary Smith?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1
Write SQL query to solve given problem: How many times has Mary Smith rented a film?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
Write SQL query to solve given problem: What is the total amount of money Mary Smith has spent on film rentals?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
Write SQL query to solve given problem: Among the times Mary Smith had rented a movie, how many of them happened in June, 2005?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6'
Write SQL query to solve given problem: Please give the full name of the customer who had made the biggest amount of payment in one single film rental.. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1
Write SQL query to solve given problem: How much in total had the customers in Italy spent on film rentals?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
Write SQL query to solve given problem: Among the payments made by Mary Smith, how many of them are over 4.99?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99
Write SQL query to solve given problem: What is the average amount of money spent by a customer in Italy on a single film rental?. Keep the solution inside sql tag ```sql [SQL-Query] ```
movie_3
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'