db_id stringclasses 68 values | question stringlengths 24 325 | evidence stringlengths 0 580 | SQL stringlengths 23 728 |
|---|---|---|---|
movie_3 | How many customers are active? | active refers to active = 1 | SELECT COUNT(customer_id) FROM customer WHERE active = 1 |
movie_3 | Among all the customers of store no.1, how many of them are active? | active refers to active = 1 | SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND store_id = 1 |
movie_3 | What is the address of Mary Smith? | SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' | |
movie_3 | Among all the active customers, how many of them live in Arlington? | active refers to active = 1; Arlington refers to city = 'Arlington' | SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington' |
movie_3 | Please list the full names of all the customers who live in Italy. | full name refers to first_name, last_name; Italy refers to country = 'Italy' | 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' |
movie_3 | Which country does Mary Smith live in? | 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' | |
movie_3 | What is the biggest amount of payment for a rental made by Mary Smith? | the biggest amount refers to max(amount) | 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 |
movie_3 | How many times has Mary Smith rented a film? | 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' | |
movie_3 | What is the total amount of money Mary Smith has spent on film rentals? | the total amount = sum(amount) | 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' |
movie_3 | Please give the full name of the customer who had made the biggest amount of payment in one single film rental. | full name refers to first_name, last_name; the biggest amount refers to max(amount) | 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 |
movie_3 | How much in total had the customers in Italy spent on film rentals? | total = sum(amount); Italy refers to country = 'Italy' | 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' |
movie_3 | Among the payments made by Mary Smith, how many of them are over 4.99? | over 4.99 refers to amount > 4.99 | 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 |
movie_3 | What is the average amount of money spent by a customer in Italy on a single film rental? | Italy refers to country = 'Italy'; average amount = divide(sum(amount), count(customer_id)) where country = 'Italy' | 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' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.