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
List down the actor IDs of film titled "BOUND CHEAPER".
SELECT T2.actor_id FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'BOUND CHEAPER'
na
9,354
[ "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", "film_actor" ]
[ "film.film_id", "film.title", "film_actor.actor_id", "film_actor.film_id" ]
[ "film.film_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 inventory ID of Karen Jackson?
SELECT T2.inventory_id FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'KAREN' AND T1.last_name = 'JACKSON'
na
9,355
[ "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.inventory_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 film titles starred by Jane Jackman.
SELECT T1.title FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T2.actor_id = T3.actor_id WHERE T3.first_name = 'JANE' AND T3.last_name = 'JACKMAN'
na
9,356
[ "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
Who are the actors of film titled "BIRD INDEPENDENCE"?
actor refers to first_name, last_name
SELECT T3.first_name, T3.last_name FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T2.actor_id = T3.actor_id WHERE T1.title = 'BIRD INDEPENDENCE'
na
9,357
[ "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
Calculate the total rental rate for animation film titles.
animation film refers to category.name = 'Animation'; total rental rate = sum(rental_rate)
SELECT SUM(T1.rental_rate) 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'
na
9,358
[ "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"}}
[ "category", "film", "film_category" ]
[ "category.\"name\"", "category.category_id", "film.film_id", "film.rental_rate", "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 average rental rate of sci-fi film titles?
sci-fi film refers to category.name = 'Sci-Fi'; average rental rate = avg(rental_rate)
SELECT AVG(T1.rental_rate) 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` = 'Sci-Fi'
na
9,359
[ "AS", "SELECT", "-", "INNER JOIN", "ON", "AVG", "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_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 percentage of horror film titles in English film titles?
horror film refers to category.name = 'Horror'; English film refers to language.name = 'English'; percentage = divide(count(film_id where category.name = 'Horror'), count(film_id)) where language.name = 'English' * 100%
SELECT CAST(SUM(IIF(T3.name = 'Horror', 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 INNER JOIN language AS T4 ON T2.language_id = T4.language_id WHERE T4.name = 'English'
na
9,360
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "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"}}
[ "category", "film", "film_category", "language" ]
[ "category.category_id", "category.name", "film.film_id", "film.language_id", "film_category.category_id", "film_category.film_id", "language.language_id", "language.name" ]
[ "category.category_id", "film.film_id", "film.language_id", "film_category.category_id", "film_category.film_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
Among the adult films, how many of them have a rental duration of fewer than 4 days?
adult film refers to rating = 'NC-17'; rental duration of fewer than 4 days refers to rental_duration < 4
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND rental_duration < 4
na
9,361
[ "AND", "SELECT", "-", "COUNT", "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"}}
[ "film" ]
[ "film.film_id", "film.rating", "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
What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99?
restricted means rating = 'R'; length is 71 minutes refers to length = 71; replacement cost is $29.99 refers to replacement_cost = 29.99
SELECT title FROM film WHERE replacement_cost = 29.99 AND rating = 'R' AND length = 71
na
9,362
[ "length", "AND", "SELECT", "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"}}
[ "film" ]
[ "film.length", "film.rating", "film.replacement_cost", "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
Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM.
email address refers to email; active refers to active = 1; between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM refers to rental_date between '2005-5-25 07:37:47' and '2005-5-26 10:06:49'
SELECT T2.email FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.rental_date BETWEEN '2005-5-25 07:37:47' AND '2005-5-26 10:06:49' AND T2.active = 1
na
9,363
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "BETWEEN", "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"}}
[ "customer", "rental" ]
[ "customer.active", "customer.customer_id", "customer.email", "rental.customer_id", "rental.rental_date" ]
[ "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
Compute the total payment made by Sarah Lewis for film rentals so far.
total payment = sum(amount)
SELECT SUM(T3.amount) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN payment AS T3 ON T1.rental_id = T3.rental_id WHERE T2.first_name = 'SARAH' AND T2.last_name = 'LEWIS'
na
9,364
[ "AS", "AND", "SELECT", "SUM", "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"}}
[ "customer", "payment", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.amount", "payment.rental_id", "rental.customer_id", "rental.rental_id" ]
[ "customer.customer_id", "payment.rental_id", "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
From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals?
from 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM refers to payment_date between '2005-05-30 03:43:54' and '2005-07-31 10:08:29'
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_date BETWEEN '2005-05-30 03:43:54' AND '2005-07-31 10:08:29'
na
9,365
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "COUNT", "BETWEEN", "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"}}
[ "customer", "payment" ]
[ "customer.customer_id", "payment.customer_id", "payment.payment_date" ]
[ "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
Tally the full names of actors in the film "Alabama Devil."
full name refers to first_name, last_name; "Alabama Devil" refers to title = 'ALABAMA DEVIL'
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ALABAMA DEVIL'
na
9,366
[ "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
Tell me the title of the film in which Sandra Kilmer is one of the actors.
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'SANDRA' AND T2.last_name = 'KILMER'
na
9,367
[ "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 documentary films are rated PG-13?
documentary film refers to category.name = 'documentary'; rated PG-13 refers to rating = 'PG-13'
SELECT COUNT(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 T2.category_id = T3.category_id WHERE T3.name = 'Documentary' AND T1.rating = 'PG-13'
na
9,368
[ "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_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 me the title and category name of films whose price per day is more than $30. Please include their special features.
category name refers to category.name; price per day is more than $30 refers to multiply(rental_duration, rental_rate) > 30
SELECT T1.title, T3.name, T1.special_features 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.rental_duration * T1.rental_rate > 30
na
9,369
[ "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.rental_duration", "film.rental_rate", "film.special_features", "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
Name the cast members of the movie 'African Egg'.
cast member name refers to first_name, last_name; 'African Egg' refers to title = 'AFRICAN EGG'
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'AFRICAN EGG'
na
9,370
[ "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
Identify the number of movies rented by Maria Miller.
SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'
na
9,371
[ "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", "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
Name the most recent movie rented by Dorothy Taylor.
movie name refers to title; the most recent refers to max(rental_date)
SELECT T4.title 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 WHERE T1.first_name = 'DOROTHY' AND T1.last_name = 'TAYLOR' ORDER BY T2.rental_date DESC LIMIT 1
na
9,372
[ "AS", "AND", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "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", "film", "inventory", "rental" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "film.film_id", "film.title", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id", "rental.rental_date" ]
[ "customer.customer_id", "film.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
Determine the number of action movies available for rent.
action movie refers to category.name = 'Action'
SELECT COUNT(T2.film_id) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id WHERE T1.name = 'Action'
na
9,373
[ "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"}}
[ "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
Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate.
'Wyoming Storm' refers to title = 'WYOMING STORM'
SELECT T2.store_id, T1.address, T4.rental_rate FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id INNER JOIN inventory AS T3 ON T2.store_id = T3.store_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'WYOMING STORM'
na
9,374
[ "AS", "SELECT", "INNER JOIN", "ON", "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"}}
[ "address", "film", "inventory", "store" ]
[ "address.address", "address.address_id", "film.film_id", "film.rental_rate", "film.title", "inventory.film_id", "inventory.store_id", "store.address_id", "store.store_id" ]
[ "address.address_id", "film.film_id", "inventory.film_id", "inventory.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
How long did Austin Cintron take to return the movie 'Destiny Saturday'?
'Destiny Saturday' refers to title = 'DESTINY SATURDAY'; length = subtract(return_date, rental_date)
SELECT T2.rental_date - T2.return_date 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 WHERE T1.first_name = 'AUSTIN' AND T4.title = 'DESTINY SATURDAY'
na
9,375
[ "AS", "AND", "SELECT", "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"}}
[ "customer", "film", "inventory", "rental" ]
[ "customer.customer_id", "customer.first_name", "film.film_id", "film.title", "inventory.film_id", "inventory.inventory_id", "rental.customer_id", "rental.inventory_id", "rental.rental_date", "rental.return_date" ]
[ "customer.customer_id", "film.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
Identify the number of movies that starred Nick Stallone.
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id AND T2.first_name = 'NICK' AND T2.last_name = 'STALLONE'
na
9,376
[ "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"}}
[ "actor", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film_actor.actor_id", "film_actor.film_id" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "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
Name the movie with the highest rental revenue among the shortest films.
movie name refers to title; the highest rental revenue refers to max(multiply(rental_duration, rental_rate)); the shortest film refers to min(length)
SELECT title FROM film WHERE length = ( SELECT MIN(length) FROM film ) ORDER BY rental_duration * rental_rate DESC LIMIT 1
na
9,377
[ "SELECT", "ORDER BY", "LIMIT", "length", "MIN", "FROM", "DESC" ]
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" ]
[ "film.length", "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
Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005.
the total amount = sum(amount); in June 2005 refers to payment_date like '2005-06%'
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'STEPHANIE' AND T2.last_name = 'MITCHELL' AND SUBSTR(T1.payment_date, 1, 7) = '2005-06'
na
9,378
[ "AS", "AND", "SELECT", "SUM", "-", "INNER JOIN", "ON", "SUBSTR", "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", "payment.payment_date" ]
[ "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 is the average replacement cost for the movies with a rental rate of 4.99?
a rental rate of 4.99 refers to rental_rate = 4.99; average replacement cost = avg(replacement_cost)
SELECT AVG(replacement_cost) FROM film WHERE rental_rate = 4.99
na
9,379
[ "SELECT", "FROM", "AVG" ]
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_rate", "film.replacement_cost" ]
[]
{ "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 rate for PG-13 rated movies?
PG-13 rated movie refers to rating = 'PG-13'; average rental rate = avg(rental_rate)
SELECT AVG(rental_rate) FROM film WHERE rating = 'PG-13'
na
9,380
[ "-", "SELECT", "FROM", "AVG" ]
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.rating", "film.rental_rate" ]
[]
{ "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 percentage of inactive customers at store no.1.
inactive refers to active = 0; store no.1 refers to store_id = 1; percentage = divide(count(customer_id where active = 0), count(customer_id)) * 100% where store_id = 1
SELECT CAST(SUM(CASE WHEN active = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(customer_id) FROM customer WHERE store_id = 1
na
9,381
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "CAST", "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" ]
[ "customer.active", "customer.customer_id", "customer.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
For how long can you rent the movie 'Dirty Ace'?
length refers to rental_duration; 'Dirty Ace' refers to title = 'DIRTY ACE'
SELECT rental_duration FROM film WHERE title = 'DIRTY ACE'
na
9,382
[ "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.rental_duration", "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
Identify the full name of the customer, who has the following email address: [email protected].
full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = '[email protected]'
na
9,383
[ "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"}}
[ "customer" ]
[ "customer.email", "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
Provide the list of the longest movies. Arrange these titles in alphabetical order.
the longest refers to max(length)
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )
na
9,384
[ "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 film categories are there?
SELECT COUNT(DISTINCT category_id) FROM category
na
9,385
[ "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"}}
[ "category" ]
[ "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 titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
in June 2005 refers to month(rental_date) = 6 and year(rental_date) = 2005; percentage = divide(count(inventory_id where month(rental_date) = 6 and year(rental_date) = 2005), count(inventory_id)) * 100%
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005'
na
9,386
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "STRFTIME", "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", "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 customers are still active?
active refers to active = 1
SELECT COUNT(customer_id) FROM customer WHERE active = 1
na
9,387
[ "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"}}
[ "customer" ]
[ "customer.active", "customer.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 all the films that are rated as PG-13.
film refers to title; rated as PG-13 refers to rating = 'PG-13'
SELECT title FROM film WHERE rating = 'PG-13'
na
9,388
[ "-", "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
List at least 10 films that the customers can rent for more than 5 days.
film refers to title; rent for more than 5 days refers to rental_duration > 5
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10
na
9,389
[ "GROUP BY", "AS", "SELECT", "INNER JOIN", "ON", "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"}}
[ "film", "inventory", "rental" ]
[ "film.film_id", "film.rental_duration", "film.title", "inventory.film_id", "inventory.inventory_id", "rental.customer_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
List all the cities that belong to United Arab Emirates.
United Arab Emirates refers to country = 'United Arab Emirates'
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'United Arab Emirates'
na
9,390
[ "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
List at least 5 customers who paid greater than $10. Provide the full name of the customers.
full name refers to first_name, last_name; greater 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,391
[ "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
What films did Burt Dukakis got star in?
film refers to title
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'BURT' AND T2.last_name = 'DUKAKIS'
na
9,392
[ "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
Provide the full name of all the actors of the film "Ending Crowds".
full name refers to first_name, last_name; film "Ending Crowds" refers to title = 'ENDING CROWDS'
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ENDING CROWDS'
na
9,393
[ "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 are the actors starred in the film "Bound Cheaper"?
actor refers to first_name, last_name; film "Bound Cheaper" refers to title = 'BOUND CHEAPER'
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 = 'BOUND CHEAPER'
na
9,394
[ "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
List all the films that Karl Berr starred in and rated as PG.
film refers to title; rated as PG refers to rating = 'PG'
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 = 'KARL' AND T1.last_name = 'BERRY' AND T3.rating = 'PG'
na
9,395
[ "AS", "AND", "SELECT", "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.rating", "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
List at least 3 cities under the country of Philippines.
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'Philippines'
na
9,396
[ "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 films that are least rented by the customers?
film refers to title; least rented refers to count(min(customer_id))
SELECT T.title FROM ( SELECT T3.title, COUNT(T1.customer_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 1
na
9,397
[ "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.customer_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
List all the description of the films starring Lucille Tracy?
SELECT T1.film_id FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'LUCILLE' AND T2.last_name = 'TRACY'
na
9,398
[ "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"}}
[ "actor", "film_actor" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film_actor.actor_id", "film_actor.film_id" ]
[ "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
Which category is the film "Beach Heartbreakers" falls into?
category refers to name; film "Beach Heartbreakers" refers to title = 'BEACH HEARTBREAKERS'
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 = 'BEACH HEARTBREAKERS'
na
9,399
[ "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
List at least 10 films that falls into the Horror category.
film refers to title; 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'
na
9,400
[ "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
Who among the actors starred in a NC-17 rated film? Provide only the last name of the actors.
NC-17 rated refers to rating = 'NC-17'
SELECT 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 = 'NC-17'
na
9,401
[ "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"}}
[ "actor", "film", "film_actor" ]
[ "actor.actor_id", "actor.last_name", "film.film_id", "film.rating", "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
Calculate the average rate of renting the film that Lucille Tracy got starred.
average rate = divide(sum(rental_rate), count(film_id))
SELECT AVG(T3.rental_rate) 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 = 'LUCILLE' AND T1.last_name = 'TRACY'
na
9,402
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "AVG", "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.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
How many films have a duration between 100 to 110 minutes?
duration between 100 to 110 minutes refers to length between 100 and 110
SELECT COUNT(film_id) FROM film WHERE length BETWEEN 100 AND 110
na
9,403
[ "AND", "SELECT", "length", "COUNT", "BETWEEN", "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" ]
[ "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
List down the actor ID of actors with Dee as their last name.
SELECT actor_id FROM actor WHERE last_name = 'Dee'
na
9,404
[ "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.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
Among the active customers, how many of them have Nina as their first name?
active refers to active = 1
SELECT COUNT(customer_id) FROM customer WHERE first_name = 'Nina' AND active = 1
na
9,405
[ "COUNT", "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"}}
[ "customer" ]
[ "customer.active", "customer.customer_id", "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
In store ID 2, how many of the films are R rating?
R rating refers to rating = 'R'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 AND T1.rating = 'R'
na
9,406
[ "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", "inventory" ]
[ "film.film_id", "film.rating", "inventory.film_id", "inventory.store_id" ]
[ "film.film_id", "inventory.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 store ID of the films starred by Reese West with a duration of 100 minutes and below?
a duration of 100 minutes and below refers to length < 100
SELECT T4.store_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 inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length < 100 AND T1.first_name = 'Reese' AND T1.last_name = 'West'
na
9,407
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "length", "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", "film_actor", "inventory" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film.length", "film_actor.actor_id", "film_actor.film_id", "inventory.film_id", "inventory.store_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id", "inventory.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 duration of the film starred by Nick Wahlberg with the highest rental rate.
duration refers to length; the highest rental rate refers to max(rental_rate)
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 = 'Nick' AND T1.last_name = 'Wahlberg' ORDER BY T3.rental_rate DESC LIMIT 1
na
9,408
[ "AS", "AND", "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.rental_rate", "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 are the titles of the films starred by Russell Close?
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'Russell' AND T2.last_name = 'Close'
na
9,409
[ "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
List the store ID of the film titled "Amadeus Holy".
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'Amadeus Holy'
na
9,410
[ "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", "inventory" ]
[ "film.film_id", "film.title", "inventory.film_id", "inventory.store_id" ]
[ "film.film_id", "inventory.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 films with a rental rate of 2.99, how many of the films are starred by Nina Soto?
a rental rate of 2.99 refers to rental_rate = 2.99
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate = 2.99 AND T2.first_name = 'Nina' AND T2.last_name = 'Soto'
na
9,411
[ "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"}}
[ "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
Among the films starred by Reese West, what is the difference between the films that have store ID of 1 and store ID of 2?
result = subtract(count(film_id where store_id = 1), count(film_id where store_id = 2))
SELECT SUM(IIF(T4.film_id = 1, 1, 0)) - SUM(IIF(T4.film_id = 2, 1, 0)) AS diff FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T2.first_name = 'Reese' AND T2.last_name = 'West'
na
9,412
[ "AS", "AND", "SELECT", "SUM", "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"}}
[ "actor", "film", "film_actor", "inventory" ]
[ "actor.actor_id", "actor.first_name", "actor.last_name", "film.film_id", "film_actor.actor_id", "film_actor.film_id", "inventory.film_id" ]
[ "actor.actor_id", "film.film_id", "film_actor.actor_id", "film_actor.film_id", "inventory.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 postal code of the address 692 Joliet Street?
SELECT postal_code FROM address WHERE address = '692 Joliet Street'
na
9,413
[ "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", "address.postal_code" ]
[]
{ "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 are active?
active refers to active = 1
SELECT COUNT(customer_id) FROM customer WHERE active = 1
na
9,414
[ "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"}}
[ "customer" ]
[ "customer.active", "customer.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
Among all the customers of store no.1, how many of them are active?
active refers to active = 1
SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND store_id = 1
na
9,415
[ "COUNT", "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"}}
[ "customer" ]
[ "customer.active", "customer.customer_id", "customer.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 address of Mary Smith?
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
na
9,416
[ "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.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
Among all the active customers, how many of them live in Arlington?
active refers to active = 1; Arlington refers to city = 'Arlington'
SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington'
na
9,417
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "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"}}
[ "address", "city", "customer" ]
[ "address.address_id", "address.city_id", "city.city", "city.city_id", "customer.active", "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
Please list the full names of all the customers who live in Italy.
full name refers to first_name, last_name; Italy refers to country = 'Italy'
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy'
na
9,418
[ "AS", "SELECT", "INNER JOIN", "ON", "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"}}
[ "address", "city", "country", "customer" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id", "customer.address_id", "customer.first_name", "customer.last_name" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country_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 country does Mary Smith live in?
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH'
na
9,419
[ "AS", "AND", "SELECT", "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"}}
[ "address", "city", "country", "customer" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id", "customer.address_id", "customer.first_name", "customer.last_name" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country_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
What is the biggest amount of payment for a rental made by Mary Smith?
the biggest amount refers to max(amount)
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1
na
9,420
[ "AS", "AND", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "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", "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
How many times has Mary Smith rented a film?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
na
9,421
[ "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", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "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 is the total amount of money Mary Smith has spent on film rentals?
the total amount = sum(amount)
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
na
9,422
[ "AS", "AND", "SELECT", "SUM", "INNER JOIN", "ON", "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
Among the times Mary Smith had rented a movie, how many of them happened in June, 2005?
in June 2005 refers to year(payment_date) = 2005 and month(payment_date) = 6
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6'
na
9,423
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "STRFTIME", "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"}}
[ "customer", "payment" ]
[ "customer.customer_id", "customer.first_name", "customer.last_name", "payment.customer_id", "payment.payment_date" ]
[ "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 give the full name of the customer who had made the biggest amount of payment in one single film rental.
full name refers to first_name, last_name; the biggest amount refers to max(amount)
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1
na
9,424
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "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"}}
[ "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
How much in total had the customers in Italy spent on film rentals?
total = sum(amount); Italy refers to country = 'Italy'
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
na
9,425
[ "AS", "SELECT", "SUM", "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", "payment" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id", "customer.address_id", "customer.customer_id", "payment.amount", "payment.customer_id" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country_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
Among the payments made by Mary Smith, how many of them are over 4.99?
over 4.99 refers to amount > 4.99
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99
na
9,426
[ "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"}}
[ "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 is the average amount of money spent by a customer in Italy on a single film rental?
Italy refers to country = 'Italy'; average amount = divide(sum(amount), count(customer_id)) where country = 'Italy'
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
na
9,427
[ "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"}}
[ "address", "city", "country", "customer", "payment" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country", "country.country_id", "customer.address_id", "customer.customer_id", "payment.amount", "payment.customer_id" ]
[ "address.address_id", "address.city_id", "city.city_id", "city.country_id", "country.country_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)" }