db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
difficulty
stringclasses
1 value
question_id
int64
0
9.43k
sql_constructs
listlengths
2
17
sql_complexity
int64
2
46
sql_complexity_buckets
stringclasses
3 values
sqlglot_schema
stringclasses
69 values
table_in_sql
listlengths
1
6
column_in_sql
listlengths
1
25
columns_used_to_join_in_sql
listlengths
0
10
schema
dict
schema_no_exp
dict
movie_3
Give the total amount of rent for the movie Clockwork Paradice.
'Clockwork Paradice' is a title of a film
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'CLOCKWORK PARADICE'
na
9,254
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "FROM" ]
13
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "inventory", "payment", "rental" ]
[ "film.film_id", "film.title", "inventory.film_id", "inventory.inventory_id", "payment.amount", "payment.rental_id", "rental.inventory_id", "rental.rental_id" ]
[ "film.film_id", "inventory.film_id", "inventory.inventory_id", "payment.rental_id", "rental.inventory_id", "rental.rental_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Find and list the full name of customers who rented more than five types of movies.
full name refers to first_name, last_name; types of movies means category of movies; rented more than five types of movies refers to COUNT(film_category) > 5
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id GROUP BY T1.first_name, T1.last_name ) AS T WHERE T.num > 5
na
9,255
[ "GROUP BY", "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
21
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "film", "film_category", "inventory", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "film.film_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id", "t.first_name", "t.last_name", "t.num" ]
[ "customer.customer_id", "film.film_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the average number of actors acted in comedy movies?
comedy is the name of a category; average number of actors refers to AVG(actor_id)
SELECT AVG(T1.actor_id) FROM film_actor AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN actor AS T4 ON T4.actor_id = T1.actor_id WHERE T3.name = 'comedy'
na
9,256
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
13
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "category", "film_actor", "film_category" ]
[ "actor.actor_id", "category.category_id", "category.name", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id" ]
[ "actor.actor_id", "category.category_id", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
In children's movies, which was rented the most?
children is the name of the category; rented the most refers to MAX(COUNT(title))
SELECT T.title FROM ( SELECT T4.title, COUNT(T4.title) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id INNER JOIN category AS T6 ON T5.category_id = T6.category_id WHERE T6.name = 'Children' GROUP BY T4.title ) AS T ORDER BY T.num DESC LIMIT 1
na
9,257
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
27
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "customer", "film", "film_category", "inventory", "rental" ]
[ "category.category_id", "category.name", "customer.customer_id", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id", "t.num", "t.title" ]
[ "category.category_id", "customer.customer_id", "film.film_id", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Calculate the percentage of customers who paid more than the average rent amount in store 1.
store 1 refers to store_id = 1; average rent amount refers to AVG(amount); calculation = DIVIDE(amount > AVG(amount), COUNT(customer_id)) * 100
SELECT CAST(( SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T2.amount > ( SELECT AVG(amount) FROM payment ) ) AS REAL) * 100 / ( SELECT COUNT(customer_id) FROM customer )
na
9,258
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "CAST", "COUNT", "FROM" ]
16
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "payment" ]
[ "customer.customer_id", "payment.amount", "payment.customer_id" ]
[ "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Find and list the full name of customers who rented more family movies than Sci-Fi movies.
full name refers to first_name, last_name; 'family' AND 'Sci-Fi' are names of the category; customers who rented more family movies than Sci-Fi movies refers to count(name = 'Family') > count(name = 'Sci-Fi')
SELECT DISTINCT IIF(SUM(IIF(T5.name = 'Family', 1, 0)) - SUM(IIF(T5.name = 'Sci-Fi', 1, 0)) > 0, T1.first_name, 0) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film_category AS T4 ON T4.film_id = T3.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id GROUP BY T1.customer_id
na
9,259
[ "GROUP BY", "AS", "SELECT", "SUM", "-", "INNER JOIN", "ON", "FROM" ]
19
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "customer", "film_category", "inventory", "rental" ]
[ "category.category_id", "category.name", "customer.customer_id", "customer.first_name", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id" ]
[ "category.category_id", "customer.customer_id", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Indicate the title of all the films rated as 'Adults Only'.
'Adults Only' refers to rating = 'NC-17'
SELECT title FROM film WHERE rating = 'NC-17'
na
9,260
[ "-", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.rating", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many actors with the surname Kilmer are there?
surname means last_name;
SELECT COUNT(actor_id) FROM actor WHERE last_name = 'Kilmer'
na
9,261
[ "COUNT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor" ]
[ "actor.actor_id", "actor.last_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many movies have a length longer than 100?
length longer than 100 refers to length > 100
SELECT COUNT(film_id) FROM film WHERE length > 100
na
9,262
[ "COUNT", "length", "SELECT", "FROM" ]
4
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.film_id", "film.length" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many payments were made throughout the month of August 2005?
payments made refers to amount; throughout the month of August 2005 refers to payment_date like '2005-08%'
SELECT SUM(amount) FROM payment WHERE payment_date LIKE '2005-08%'
na
9,263
[ "SELECT", "SUM", "LIKE", "-", "FROM" ]
5
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "payment" ]
[ "payment.amount", "payment.payment_date" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
To which country does the address '1386 Nakhon Sawan Boulevard' belong?
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id WHERE T3.address = '1386 Nakhon Sawan Boulevard'
na
9,264
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city", "country" ]
[ "address.address", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id" ]
[ "address.city_id", "city.city_id", "city.country_id", "country.country_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What language was the most used in movies released in 2006?
released in 2006 refers to release_year = 2006; the most used language refers to MAX(COUNT(language_id))
SELECT T.language_id FROM ( SELECT T1.language_id, COUNT(T1.language_id) AS num FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE STRFTIME('%Y',T1.release_year) = '2006' GROUP BY T1.language_id ) AS T ORDER BY T.num DESC LIMIT 1
na
9,265
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "STRFTIME", "COUNT", "FROM" ]
16
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.language_id", "film.release_year", "language.language_id", "t.language_id", "t.num" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Indicate the title of all the films that are in the Classics category.
'classics' is the name of category
SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'
na
9,266
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many rentals did Ella Oliver hire in June 2016?
'Ella Oliver' is a full name of a customer; full name refers to first_name, last_name; rental hired in June 2016 refers to rental_date BETWEEN '2005-06-01' AND '2005-06-30'
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'ELLA' AND T2.last_name = 'ELLA' AND date(T1.rental_date) BETWEEN '2005-06-01' AND '2005-06-30'
na
9,267
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "COUNT", "BETWEEN", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "rental.customer_id", "rental.rental_date", "rental.rental_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many different clients have rented materials from Jon Stephens?
'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name;
SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
na
9,268
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "rental", "staff" ]
[ "rental.customer_id", "rental.staff_id", "staff.first_name", "staff.last_name", "staff.staff_id" ]
[ "rental.staff_id", "staff.staff_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the total amount paid for rentals made on July 29, 2005?
July 29, 2005 refers to rental_date like '2005-07-29'
SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'
na
9,269
[ "AS", "SELECT", "SUM", "-", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "payment", "rental" ]
[ "payment.amount", "payment.rental_id", "rental.rental_date", "rental.rental_id" ]
[ "payment.rental_id", "rental.rental_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the first name of the customers whose address is in the postal code that begins with 76?
postal code that begins with 76 refers to postal_code like '76%'
SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'
na
9,270
[ "AS", "SELECT", "INNER JOIN", "ON", "SUBSTR", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address_id", "address.postal_code", "customer.address_id", "customer.first_name" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
On what date was the rented material for the movie BLOOD ARGONAUTS returned?
'BLOOD ARGONAUTS' is a title of a film; date a movie was returned refers to return_date
SELECT T1.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'
na
9,271
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "inventory", "rental" ]
[ "film.film_id", "film.title", "inventory.film_id", "inventory.inventory_id", "rental.inventory_id", "rental.rental_date" ]
[ "film.film_id", "inventory.film_id", "inventory.inventory_id", "rental.inventory_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the title of the films in which Cuba Allen acted?
'Cuba Allen' is a full name of an actor; full name refers to first_name, last_name
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Cuba' AND T1.last_name = 'Allen'
na
9,272
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many actors acted in movies in the Music category?
Music' is a name of a category
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'
na
9,273
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
16
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "category", "film", "film_actor", "film_category" ]
[ "actor.actor_id", "category.category_id", "category.name", "film.film_id", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id" ]
[ "actor.actor_id", "category.category_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the full name of the actor who has acted the most times in comedy films?
full name refers to first_name, last_name; 'comedy' is a name of a category;
SELECT T.first_name, T.last_name FROM ( SELECT T4.first_name, T4.last_name, COUNT(T2.actor_id) AS num FROM film_category AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN actor AS T4 ON T2.actor_id = T4.actor_id WHERE T3.name = 'Comedy' GROUP BY T4.first_name, T4.last_name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,274
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
21
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "category", "film_actor", "film_category" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "category.category_id", "category.name", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id", "t.first_name", "t.last_name", "t.num" ]
[ "actor.actor_id", "category.category_id", "film_actor.actor_id", "film_actor.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many customers did not rent material at Mike's store?
not at Mike's store refers to staff.first_name ! = 'Mike'
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id WHERE T3.first_name != 'Mike'
na
9,275
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "staff", "store" ]
[ "customer.customer_id", "customer.store_id", "staff.first_name", "staff.staff_id", "store.manager_staff_id", "store.store_id" ]
[ "customer.store_id", "staff.staff_id", "store.manager_staff_id", "store.store_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Indicate the name of the actors of the films rated as 'Parents Strongly Precautioned' with the highest replacement cost.
name refers to first_name, last_name; Parents Strongly Precautioned' refers to rating = 'PG-13'; highest replacement cost refers to MAX(replacement_cost)
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'PG-13' ORDER BY T3.replacement_cost DESC LIMIT 1
na
9,276
[ "AS", "SELECT", "ORDER BY", "LIMIT", "-", "INNER JOIN", "ON", "DESC", "FROM" ]
13
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.rating", "film.replacement_cost", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the name of the client who has the largest quantity of rented material without returning it?
name refers to first_name, last_name; without returning a rented material refers to return_date is null
SELECT T.first_name FROM ( SELECT T2.first_name, COUNT(T1.rental_date) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,277
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.first_name", "rental.customer_id", "rental.rental_date", "t.first_name", "t.num" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many customers live in the city of Miyakonojo?
SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Miyakonojo'
na
9,278
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city", "customer" ]
[ "address.address_id", "address.city_id", "city.city", "city.city_id", "customer.address_id", "customer.customer_id" ]
[ "address.address_id", "address.city_id", "city.city_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many non-active clients have not returned the rented material?
non-active clients refers to active = 0; not returning a rented material refers to rental_date is null
SELECT COUNT(T2.customer_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.active = 0
na
9,279
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.active", "customer.customer_id", "rental.customer_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the title of the animated films that have the shortest length?
animated film means animation; animation is a name of a category
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id ORDER BY T1.length LIMIT 1
na
9,280
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "length", "FROM" ]
12
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "film.film_id", "film.length", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
In which country is the store where Hector Poinexter rents equipment located?
'Hector Poinexter' is a full name of a customer; full name refers to first_name, last_name;
SELECT T5.country FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id INNER JOIN city AS T4 ON T3.city_id = T4.city_id INNER JOIN country AS T5 ON T4.country_id = T5.country_id WHERE T1.first_name = 'HECTOR' AND T1.last_name = 'POINDEXTER'
na
9,281
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
16
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city", "country", "customer", "store" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id", "customer.first_name", "customer.last_name", "customer.store_id", "store.address_id", "store.store_id" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country_id", "customer.store_id", "store.address_id", "store.store_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the average rental payment in Horror movies?
'Horror' is a name of a category; average rental payment refers to AVG(amount)
SELECT AVG(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.name = 'Horror'
na
9,282
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
16
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film_category", "inventory", "payment", "rental" ]
[ "category.category_id", "category.name", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "payment.amount", "payment.rental_id", "rental.inventory_id", "rental.rental_id" ]
[ "category.category_id", "film_category.category_id", "film_category.film_id", "inventory.film_id", "inventory.inventory_id", "payment.rental_id", "rental.inventory_id", "rental.rental_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the average amount of rent that Christy Vargas paid?
'Christy Vargas' is a full name of a customer; full name refers to first_name, last_name; average amount of rent refers to AVG(amount)
SELECT AVG(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'CHRISTY' AND T1.Last_name = 'VARGAS'
na
9,283
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
8
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.amount", "payment.customer_id" ]
[ "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What percentage of films with a length of less than 100 belong to the Drama category?
Drama' is a name of a category; calculation = DIVIDE(SUM(length < 100 AND name = 'Drama'), COUNT(film_id)) * 100
SELECT CAST(SUM(IIF(T2.length < 100 AND T3.name = 'Drama', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id
na
9,284
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "length", "CAST", "COUNT", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.length", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the actors that have the same forename as Johnny? Please include in your answer the full names of these actors.
forename means first_name; full name refers to first_name, last_name
SELECT first_name, last_name FROM actor WHERE first_name = 'Johnny'
na
9,285
[ "SELECT", "FROM" ]
2
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor" ]
[ "actor.first_name", "actor.last_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the address numbers that are located in Gansu district?
address numbers refers to address_id;
SELECT address_id FROM address WHERE district = 'Gansu'
na
9,286
[ "SELECT", "FROM" ]
2
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address" ]
[ "address.address_id", "address.district" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please list three types of film along with their IDs and the latest update.
types of film refers to the name of a category; IDs refers to category_id; latest update refers to last_update.
SELECT DISTINCT name, category_id, last_update FROM category LIMIT 3
na
9,287
[ "LIMIT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category" ]
[ "category.category_id", "category.last_update", "category.name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please list the full names of any three inactive customers.
full name refers to first_name, last_name; inactive customers refers to active = 0
SELECT first_name, last_name FROM customer WHERE active = 0 LIMIT 3
na
9,288
[ "LIMIT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer" ]
[ "customer.active", "customer.first_name", "customer.last_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the rental price per day for Airplane Sierra?
rental price per day refers to DIVIDE(rental_price, rental_duration); 'Airplane Sierra' is a title of a film
SELECT rental_rate / rental_duration AS result FROM film WHERE title = 'AIRPLANE SIERRA'
na
9,289
[ "AS", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.rental_duration", "film.rental_rate", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Where is store number 2 located?
store number 2 refers to store_id = 2; where is a store located refers to address, address2, district
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2
na
9,290
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "store" ]
[ "address.address", "address.address2", "address.address_id", "address.district", "store.address_id", "store.store_id" ]
[ "address.address_id", "store.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which city does the address 1623 Kingstown Drive belong to?
SELECT T1.city FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id WHERE T2.address = '1623 Kingstown Drive'
na
9,291
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city" ]
[ "address.address", "address.city_id", "city.city", "city.city_id" ]
[ "address.city_id", "city.city_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please name three cities that belong to Algeria.
Algeria is a country
SELECT T2.city FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'Algeria'
na
9,292
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "city", "country" ]
[ "city.city", "city.country_id", "country.country", "country.country_id" ]
[ "city.country_id", "country.country_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the category of the film Agent Truman?
'Agent Truman' is a title of a film; category refers to name
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'AGENT TRUMAN'
na
9,293
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please list the titles of any three action films.
action is a name of category
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Action' LIMIT 3
na
9,294
[ "AS", "SELECT", "LIMIT", "INNER JOIN", "ON", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the difference between the number of children's films and action films?
'children' AND 'action' are names of a category; Calculation = SUBTRACT(AVG('children'), AVG('action'))
SELECT SUM(IIF(T2.name = 'Children', 1, 0)) - SUM(IIF(T2.name = 'Action', 1, 0)) AS diff FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
na
9,295
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film_category" ]
[ "category.category_id", "category.name", "film_category.category_id" ]
[ "category.category_id", "film_category.category_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which district does Maria Miller live in?
'Maria Miller' is a name of a customer; full name refers to first_name, last_name
SELECT T2.district FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'
na
9,296
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address_id", "address.district", "customer.address_id", "customer.first_name", "customer.last_name" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Who is the customer that is active and lives at 1795 Santiago de Compostela Way, Texas?
active refers to active = 1; '1795 Santiago de Compostela Way' is an address; Texas is a district; who refers to first_name, last_name
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T2.address = '1795 Santiago de Compostela Way' AND T1.active = 1
na
9,297
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address", "address.address_id", "customer.active", "customer.address_id", "customer.first_name", "customer.last_name" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many English films have a duration of over 50 minutes and the cost of replacement are under 10.99?
English is a name of a language; duration of over 50 minutes refers to length > 50; cost of replacement are under 10.99 refers to replacement_cost < 10.99
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.length > 50 AND T1.replacement_cost < 10.99
na
9,298
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "length", "COUNT", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.film_id", "film.language_id", "film.length", "film.replacement_cost", "language.language_id", "language.name" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Who are the actors that act in the ACADEMY DINOSAUR film?
Who are the actors refers to full name; full name refers to first_name, last_name; 'ACADEMY DINOSAUR' is a title of a film
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'ACADEMY DINOSAUR'
na
9,299
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please list any two films that Penelope Guiness acted in.
film refers to title of the film; 'Penelope Guiness' is a full name of an actor; full name refers to first_name, last_name
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Penelope' AND T1.last_name = 'Guiness' LIMIT 2
na
9,300
[ "AS", "AND", "SELECT", "LIMIT", "INNER JOIN", "ON", "FROM" ]
11
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the percentage of documentary films?
documentary' is a name of a category; calculation = DIVIDE(SUM(name = 'Documentary'), COUNT(film_id)) * 100
SELECT CAST(SUM(IIF(T2.name = 'Documentary', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
na
9,301
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film_category" ]
[ "category.category_id", "category.name", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film_category.category_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many films in English are for adults only?
English is a name of a language; for adults only refers to rating = 'NC-17'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.rating = 'NC-17'
na
9,302
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.film_id", "film.language_id", "film.rating", "language.language_id", "language.name" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which film has the longest duration?
film refers to the title; the longest duration refers to MAX(length)
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )
na
9,303
[ "length", "SELECT", "FROM", "MAX" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.length", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many of the actors are named "Dan"?
'Dan' is a first_name of an actor
SELECT COUNT(actor_id) FROM actor WHERE first_name = 'Dan'
na
9,304
[ "COUNT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor" ]
[ "actor.actor_id", "actor.first_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the most common first name among the customers?
the most common first name refers to MAX(COUNT(first_name))
SELECT first_name FROM customer GROUP BY first_name ORDER BY COUNT(first_name) DESC LIMIT 1
na
9,305
[ "GROUP BY", "SELECT", "ORDER BY", "LIMIT", "COUNT", "FROM", "DESC" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer" ]
[ "customer.first_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the ratings of the film featuring behind the scenes?
film featuring behind the scenes refers to special_features = 'Behind the Scenes'
SELECT rating FROM film WHERE special_features LIKE '%Behind the Scenes%'
na
9,306
[ "LIKE", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.rating", "film.special_features" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the largest number of films rented per customer?
the largest number of films refers to MAX(rental_id)
SELECT COUNT(rental_id) FROM rental GROUP BY customer_id ORDER BY COUNT(rental_id) DESC LIMIT 1
na
9,307
[ "GROUP BY", "SELECT", "ORDER BY", "LIMIT", "COUNT", "FROM", "DESC" ]
8
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "rental" ]
[ "rental.customer_id", "rental.rental_id" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List all the films with the word "Lacklusture" in their description.
films refers to title
SELECT title FROM film_text WHERE description LIKE '%Lacklusture%'
na
9,308
[ "LIKE", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film_text" ]
[ "film_text.description", "film_text.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many films did a customer named Francis Sikes rent?
'Francis Sikes' is a full name of a customer; full name refers to first_name, last_name;
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'FRANCIS' AND T1.last_name = 'SIKES'
na
9,309
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "rental.customer_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Who is the manager of the store with the largest collection of films?
Who refers to first_name, last_name; the largest collection of films refers to MAX(film_id)
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.film_id) AS num FROM inventory AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,310
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
18
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "inventory", "staff", "store" ]
[ "inventory.film_id", "inventory.store_id", "staff.first_name", "staff.last_name", "staff.staff_id", "store.manager_staff_id", "store.store_id", "t.first_name", "t.last_name", "t.num" ]
[ "inventory.store_id", "staff.staff_id", "store.manager_staff_id", "store.store_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the addresses of the inactive customers?
inactive customers refers to active = 0;
SELECT T2.address FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.active = 0
na
9,311
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address", "address.address_id", "customer.active", "customer.address_id" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which category is the most common?
most common category refers to MAX(COUNT(category.name))
SELECT T.name FROM ( SELECT T2.name, COUNT(T2.name) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,312
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film_category" ]
[ "category.category_id", "category.name", "film_category.category_id", "t.name", "t.num" ]
[ "category.category_id", "film_category.category_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Provide the cast for the film "Jason trap".
'Jason trap' is a title of a film; cast means actor; actor refers to first_name, last_name
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'JASON TRAP'
na
9,313
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Who is the customer with the largest payment for rental films?
Who refers to first_name, last_name; the largest payment for rental refers to MAX(SUM(amount))
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, SUM(T2.amount) AS num FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,314
[ "GROUP BY", "AS", "SELECT", "SUM", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.amount", "payment.customer_id", "t.first_name", "t.last_name", "t.num" ]
[ "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List the top 5 most-rented films.
film refers to title; most rented refers to MAX(inventory_id)
SELECT T.title FROM ( SELECT T3.title, COUNT(T2.inventory_id) AS num FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T3.title ) AS T ORDER BY T.num DESC LIMIT 5
na
9,315
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
18
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "inventory", "rental" ]
[ "film.film_id", "film.title", "inventory.film_id", "inventory.inventory_id", "rental.inventory_id", "t.num", "t.title" ]
[ "film.film_id", "inventory.film_id", "inventory.inventory_id", "rental.inventory_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which country does Sasebo belong to?
'Sasebo' is a city
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Sasebo'
na
9,316
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "city", "country" ]
[ "city.city", "city.country_id", "country.country", "country.country_id" ]
[ "city.country_id", "country.country_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the addresses for the stores?
SELECT T2.address FROM store AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id
na
9,317
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "store" ]
[ "address.address", "address.address_id", "store.address_id" ]
[ "address.address_id", "store.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List all the animation titles.
'animation' is a name of a category
SELECT T3.title AS per FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Animation'
na
9,318
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the city with the most customers?
the most customers refers to MAX(COUNT(customer_id))
SELECT T.city FROM ( SELECT T1.city, COUNT(T3.customer_id) AS num FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id GROUP BY T1.city ) AS T ORDER BY T.num DESC LIMIT 1
na
9,319
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
18
challenging
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city", "customer" ]
[ "address.address_id", "address.city_id", "city.city", "city.city_id", "customer.address_id", "customer.customer_id", "t.city", "t.num" ]
[ "address.address_id", "address.city_id", "city.city_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which actor acted in the most films?
actor refers to first_name, last_name; the most film refers to MAX(SUM(film_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, SUM(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
na
9,320
[ "GROUP BY", "AS", "SELECT", "SUM", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
15
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film_actor.actor_id", "film_actor.film_id", "t.first_name", "t.last_name", "t.num" ]
[ "actor.actor_id", "film_actor.actor_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What percentage of films are horror films?
horror' is a name of a category; calculation = DIVIDE(SUM(name = 'Horror'), COUNT(film_id)) * 100
SELECT CAST(SUM(IIF(T2.name = 'Horror', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id
na
9,321
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
13
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please indicate the full name of actor id 5.
full name refers to first_name, last_name
SELECT first_name, last_name FROM actor WHERE actor_id = 5
na
9,322
[ "SELECT", "FROM" ]
2
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many id movies have category id 11?
id movies refers to film_id
SELECT COUNT(film_id) FROM film_category WHERE category_id = 11
na
9,323
[ "COUNT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film_category" ]
[ "film_category.category_id", "film_category.film_id" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which category does BABY HALL film belong to?
category refers to name; BABY HALL film refers to title = 'BABY HALL'
SELECT T3.`name` FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T1.title = 'BABY HALL'
na
9,324
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Give the full name of the actor with the highest rental rate.
full name refers to first_name, last_name; the highest rental rate refers to max(rental_rate)
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T3.film_id = T2.film_id ORDER BY T3.rental_rate DESC LIMIT 1
na
9,325
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
12
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.rental_rate", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please give the description of the movie starring JENNIFER DAVIS.
SELECT T3.description FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T3.film_id = T2.film_id WHERE T1.first_name = 'JOHNNY' AND T1.last_name = 'DAVIS'
na
9,326
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.description", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List the full names of customers who have paid more than 10$.
full name refers to first_name, last_name; more than 10$ refers to amount > 10
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.amount > 10
na
9,327
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.amount", "payment.customer_id" ]
[ "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please provide the address of the customer whose first name is SUSAN with the postal code 77948.
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'SUSAN' AND T1.postal_code = 77948
na
9,328
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address", "address.address_id", "address.postal_code", "customer.address_id", "customer.first_name" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many customers have an address in Abu Dhabi city? List those customer names.
name refers to first_name, last_name
SELECT COUNT(T1.city_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Abu Dhabi'
na
9,329
[ "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "city", "customer" ]
[ "address.address_id", "address.city_id", "city.city", "city.city_id", "customer.address_id" ]
[ "address.address_id", "address.city_id", "city.city_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Please provide the full name of the customer at 692 Joliet Street.
full name refers to first_name, last_name; 692 Joliet Street refers to address = '692 Joliet Street'
SELECT T2.first_name, T2.last_name FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '692 Joliet Street'
na
9,330
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer" ]
[ "address.address", "address.address_id", "customer.address_id", "customer.first_name", "customer.last_name" ]
[ "address.address_id", "customer.address_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List movie titles with duration over 120 minutes that are in the action category.
duration over 120 minutes refers to length > 120; action category refers to category.name = 'action'
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.`name` = 'action' AND T1.length > 120
na
9,331
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "length", "FROM" ]
11
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.film_id", "film.length", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which actor acted in ANONYMOUS HUMAN?
actor refers to first_name, last_name; ANONYMOUS HUMAN refers to title = 'ANONYMOUS HUMAN'
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T3.film_id = T2.film_id WHERE T3.title = 'ANONYMOUS HUMAN'
na
9,332
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which movie title has the lowest movie rental in the horror category?
the lowest movie rental refers to min(rental_rate); the horror category refers to category.name = 'Horror'
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.`name` = 'Horror' ORDER BY T1.rental_rate LIMIT 1
na
9,333
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "FROM" ]
11
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.film_id", "film.rental_rate", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List the descriptions of movies under the category Travel.
the category Travel refers to category.name = 'Travel'
SELECT T1.description FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.`name` = 'Travel'
na
9,334
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.description", "film.film_id", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Calculate the total payment amount of customers in Nagasaki district.
the total payment amount refers to sum(amount)
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id WHERE T3.district = 'Nagasaki'
na
9,335
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "FROM" ]
10
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "address", "customer", "payment" ]
[ "address.address_id", "address.district", "customer.address_id", "customer.customer_id", "payment.amount", "payment.customer_id" ]
[ "address.address_id", "customer.address_id", "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Calculate the percentage of total payment of MARGARET MOORE customers.
percentage = divide(sum(amount where first_name = 'MARGARET' and last_name = 'MOORE'), sum(amount)) * 100%
SELECT CAST(SUM(IIF(T2.first_name = 'MARGARET' AND T2.last_name = 'MOORE', T1.amount, 0)) AS REAL) * 100 / SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id
na
9,336
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "FROM" ]
11
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.amount", "payment.customer_id" ]
[ "customer.customer_id", "payment.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Calculate the percentage of movie titles with a screen length of more than 120 minutes that have a category of horror movies.
screen length of more than 120 minutes refers to length > 120; category of horror refers to category.name = 'Horror'; percentage = divide(count(title where length > 120 and category.name = 'Horror'), count(title)) * 100%
SELECT CAST(SUM(IIF(T3.`name` = 'Horror', 1, 0)) * 100 / COUNT(T1.film_id) AS REAL) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T1.length > 120
na
9,337
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "length", "CAST", "COUNT", "FROM" ]
14
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.film_id", "film.length", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many film titles were released in 2006?
released in 2006 refers to release_year = 2006
SELECT COUNT(film_id) FROM film WHERE release_year = 2006
na
9,338
[ "COUNT", "SELECT", "FROM" ]
3
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.film_id", "film.release_year" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down film titles from id 1 to 10.
id 1 to 10 refers to film_id BETWEEN 1 and 10
SELECT title FROM film WHERE film_id BETWEEN 1 AND 10
na
9,339
[ "BETWEEN", "AND", "SELECT", "FROM" ]
4
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.film_id", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down all of the film IDs with highest rental duration.
highest rental duration refers to max(rental_duration)
SELECT film_id FROM film WHERE rental_duration = ( SELECT MAX(rental_duration) FROM film )
na
9,340
[ "SELECT", "FROM", "MAX" ]
5
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.film_id", "film.rental_duration" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
Which film titles have the most expensive rental rate?
the most expensive rental rate refers to max(rental_rate)
SELECT title FROM film WHERE rental_rate = ( SELECT MAX(rental_rate) FROM film )
na
9,341
[ "SELECT", "FROM", "MAX" ]
5
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.rental_rate", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down all of the film titles that are rated for general audiences.
rated for general audiences means rating = 'G'
SELECT title FROM film WHERE rating = 'G'
na
9,342
[ "SELECT", "FROM" ]
2
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film" ]
[ "film.rating", "film.title" ]
[]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the language for film titled "CHILL LUCK"?
SELECT T2.`name` FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'CHILL LUCK'
na
9,343
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.language_id", "film.title", "language.\"name\"", "language.language_id" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What are the last updated date for English film titles that were released in 2006?
the last updated date refers to last_update; English is name of language; released in 2006 refers to release_year = 2006
SELECT DISTINCT T1.last_update FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T2.`name` = 'English' AND T1.release_year = 2006
na
9,344
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.language_id", "film.last_update", "film.release_year", "language.\"name\"", "language.language_id" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many Italian film titles were special featured with deleted scenes?
Italian is name of language; special featured with deleted scenes refers to special_features = 'deleted scenes'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T2.`name` = 'Italian' AND T1.special_features = 'deleted scenes'
na
9,345
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "film", "language" ]
[ "film.film_id", "film.language_id", "film.special_features", "language.\"name\"", "language.language_id" ]
[ "film.language_id", "language.language_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
How many animation film titles are rated for adults only?
animation film refers to category.name = 'animation'; for adults only means rating = 'NC-17'
SELECT COUNT(T1.title) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'animation' AND T1.rating = 'NC-17'
na
9,346
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "COUNT", "FROM" ]
12
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.rating", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down all ratings of action film titles.
for General Audiences means rating = 'G'; Parental Guidance Suggested means rating = 'PG'; Parents Strongly Cautioned means rating = 'PG-13'; Restricted means rating = 'R'; Adults Only means rating = 'NC-17'; action film refers to category.name = 'action'
SELECT T1.description FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'action'
na
9,347
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.description", "film.film_id", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down all film IDs of comedy film titles.
comedy is name of category
SELECT T1.film_id FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.name = 'comedy'
na
9,348
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
State the documentary film titles with longest length.
documentary film refers to name = 'documentary'; longest length refers to max(length)
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.name = 'documentary' ORDER BY T1.length DESC LIMIT 1
na
9,349
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "length", "FROM" ]
13
medium
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.length", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is the category of film titled "BLADE POLISH"?
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T1.title = 'BLADE POLISH'
na
9,350
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "category", "film", "film_category" ]
[ "category.category_id", "category.name", "film.film_id", "film.title", "film_category.category_id", "film_category.film_id" ]
[ "category.category_id", "film.film_id", "film_category.category_id", "film_category.film_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
What is Mary Smith's rental ID?
SELECT T2.rental_id FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'MARY' AND T1.last_name = 'SMITH'
na
9,351
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "rental.customer_id", "rental.rental_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down all of the customers' first name who were attended by staff with ID 1.
SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.staff_id = 1
na
9,352
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "rental.customer_id", "rental.staff_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
movie_3
List down email address of customers who were attended by staff with ID 2.
email address refers to email
SELECT DISTINCT T1.email FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.staff_id = 2
na
9,353
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
[ "customer", "rental" ]
[ "customer.customer_id", "customer.email", "rental.customer_id", "rental.staff_id" ]
[ "customer.customer_id", "rental.customer_id" ]
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }
{ "schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)" }