Database: sakila_1

Question: Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.
SQL: SELECT T1.first_name ,  T1.last_name ,  T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) ASC LIMIT 1

Question: What is the genre name of the film HUNGER ROOF?
SQL: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id  =  T2.category_id JOIN film AS T3 ON T2.film_id  =  T3.film_id WHERE T3.title  =  'HUNGER ROOF'

Question: How many films are there in each category? List the genre name, genre id and the count.
SQL: SELECT T2.name ,  T1.category_id ,  count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id  =  T2.category_id GROUP BY T1.category_id

Question: Which film has the most copies in the inventory? List both title and id.
SQL: SELECT T1.title ,  T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1

Question: What is the film title and inventory id of the item in the inventory which was rented most frequently?
SQL: SELECT T1.title ,  T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id JOIN rental AS T3 ON T2.inventory_id  =  T3.inventory_id GROUP BY T2.inventory_id ORDER BY count(*) DESC LIMIT 1

Question: Where is store 1 located?
SQL: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id  =  T2.address_id WHERE store_id  =  1

Question: Which staff handled least number of payments? List the full name and the id.
SQL: SELECT T1.first_name ,  T1.last_name ,  T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) ASC LIMIT 1

Question: Which language does the film AIRPORT POLLOCK use? List the language name.
SQL: SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id  =  T2.language_id WHERE T1.title  =  'AIRPORT POLLOCK'

Question: Which movies have 'Deleted Scenes' as a substring in the special feature?
SQL: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'

Question: When did the first payment happen?
SQL: SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1

Question: Where does the customer with the first name Linda live? And what is her email?
SQL: SELECT T2.address ,  T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id  =  T1.address_id WHERE T1.first_name  =  'LINDA'

Question: Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles.
SQL: SELECT title FROM film WHERE LENGTH  >  100 OR rating  =  'PG' EXCEPT SELECT title FROM film WHERE replacement_cost  >  200

Question: What is the first name and the last name of the customer who made the earliest rental?
SQL: SELECT T1.first_name ,  T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id  =  T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1