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
|
The actor Dan Harris played in a 77 minute film with replacement cost of 9.99, what was the rating for that film?
|
77 min film refers to length = 77
|
SELECT T3.rating 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 = 'DAN' AND T1.last_name = 'HARRIS' AND T3.length = 77 AND T3.replacement_cost = '9.99'
|
na
| 9,154
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"length",
"FROM"
] | 13
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.length",
"film.rating",
"film.replacement_cost",
"film_actor.actor_id",
"film_actor.film_id"
] |
[
"actor.actor_id",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many films did actor Daryl Wahlberg appear in?
|
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'DARYL' AND T2.last_name = 'WAHLBERG'
|
na
| 9,155
|
[
"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"}}
|
[
"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
|
Sherri Rhodes rented a film at 12:27:27 on 2005/7/28, when did she/he return that film?
|
rented at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'
|
SELECT T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'SHERRI' AND T1.last_name = 'RHODES' AND T2.rental_date = '2005-07-28 12:27:27'
|
na
| 9,156
|
[
"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"}}
|
[
"customer",
"rental"
] |
[
"customer.customer_id",
"customer.first_name",
"customer.last_name",
"rental.customer_id",
"rental.rental_date",
"rental.return_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
|
Give the name of the manager staff for store No.1.
|
store no. 1 refers to store_id = 1; name refers to first_name, last_name
|
SELECT T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1
|
na
| 9,157
|
[
"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"}}
|
[
"staff",
"store"
] |
[
"staff.first_name",
"staff.last_name",
"staff.store_id",
"store.store_id"
] |
[
"staff.store_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
|
State the address location of store No.1.
|
store no. 1 refers to store_id = 1; address location refers to address, address2, district
|
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1
|
na
| 9,158
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address",
"store"
] |
[
"address.address",
"address.address2",
"address.address_id",
"address.district",
"store.address_id",
"store.store_id"
] |
[
"address.address_id",
"store.address_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Where does the staff Jon Stephens live?
|
location refers to address, address2, district
|
SELECT T1.address, T1.address2 FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
|
na
| 9,159
|
[
"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",
"staff"
] |
[
"address.address",
"address.address2",
"address.address_id",
"staff.address_id",
"staff.first_name",
"staff.last_name"
] |
[
"address.address_id",
"staff.address_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many addresses are there in Woodridge city?
|
"Woodridge" is the city
|
SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'
|
na
| 9,160
|
[
"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"}}
|
[
"address",
"city"
] |
[
"address.address_id",
"address.city_id",
"city.city",
"city.city_id"
] |
[
"address.city_id",
"city.city_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many films are in English?
|
"English" is the name of language
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'
|
na
| 9,161
|
[
"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"}}
|
[
"film",
"language"
] |
[
"film.film_id",
"film.language_id",
"language.language_id",
"language.name"
] |
[
"film.language_id",
"language.language_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Give the address location of Heather Morris.
|
address location refers to address
|
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'
|
na
| 9,162
|
[
"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
|
Give the email address of the person who lives in "1411 Lillydale Drive".
|
"1411 Lillydate Drive" is the address
|
SELECT T2.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'
|
na
| 9,163
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 6
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address",
"staff"
] |
[
"address.address",
"address.address_id",
"staff.address_id",
"staff.email"
] |
[
"address.address_id",
"staff.address_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?
|
customer no. 297 refers to customer_id = 297; at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'; money pay for rent refers to amount
|
SELECT T1.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297
|
na
| 9,164
|
[
"AS",
"AND",
"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"}}
|
[
"payment",
"rental"
] |
[
"payment.amount",
"payment.rental_id",
"rental.customer_id",
"rental.rental_date",
"rental.rental_id"
] |
[
"payment.rental_id",
"rental.rental_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Which category does the film Working Microcosmos belong to?
|
"WORKING MICROCOSMOS" is the title of film; category refers to name
|
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'WORKING MICROCOSMOS'
|
na
| 9,165
|
[
"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
|
Give the number of documentary films.
|
"Documentary" is the name of category; number of film refers to Count(film_id)
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Documentary'
|
na
| 9,166
|
[
"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
|
State the name of the category which has the most number of films.
|
category refers to name; most number of films refers to Max(Count(film_id))
|
SELECT T.name FROM ( SELECT T2.name, COUNT(T1.film_id) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,167
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 15
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"film_category"
] |
[
"category.category_id",
"category.name",
"film_category.category_id",
"film_category.film_id",
"t.name",
"t.num"
] |
[
"category.category_id",
"film_category.category_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Give the name of the film for inventory No.3479.
|
inventory no. 3479 refers to inventory_id = '3479'; name of film refers to title
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479
|
na
| 9,168
|
[
"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.inventory_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
|
What is the percentage more for the rental payment for store No.2 than store No.1?
|
store no. 1 refers to store_id = 1; store no.2 refers to store_id = 2; rental payment refers to amount; percent more = Divide (Subtract(amount where store_id = 2, amount where store_id = 1), amount where store_id = 1) *100
|
SELECT CAST((SUM(IIF(T2.store_id = 2, T1.amount, 0)) - SUM(IIF(T2.store_id = 1, T1.amount, 0))) AS REAL) * 100 / SUM(IIF(T2.store_id = 1, T1.amount, 0)) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN store AS T3 ON T2.store_id = T3.store_id
|
na
| 9,169
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"FROM"
] | 14
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"customer",
"payment",
"store"
] |
[
"customer.customer_id",
"customer.store_id",
"payment.amount",
"payment.customer_id",
"store.store_id"
] |
[
"customer.customer_id",
"customer.store_id",
"payment.customer_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 many times is the number of Indian cities than Italian cities?
|
indian refers to country = 'India'; Italian refers to country = 'Italy'; times = Divide(Count(city where country = 'India), Count(city where country = 'Italy'))
|
SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) / SUM(IIF(T1.country = 'Italy', 1, 0)) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id
|
na
| 9,170
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"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"}}
|
[
"city",
"country"
] |
[
"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
|
How many times is the number of films Gina DeGeneres acted in than Penelope Guinness?
|
"Gina DeGeneres" and "Penelope Guinness" are both full name of actor; times number of film = Divide (Count (film_id where first_name = 'GINA' and last_name = 'DEGENERES'), Count(film_id where first_name = 'PENELOPE' and last_name = 'GUINESS'))
|
SELECT CAST(SUM(IIF(T2.first_name = 'GINA' AND T2.last_name = 'DEGENERES', 1, 0)) AS REAL) * 100 / SUM(IIF(T2.first_name = 'PENELOPE' AND T2.last_name = 'GUINESS', 1, 0)) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id
|
na
| 9,171
|
[
"AS",
"AND",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"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_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film_actor.actor_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
|
In 2006, how many restricted films were released?
|
restricted refers to rating = 'R'; release refers to release_year; in 2006 refers to release_year = 2006; film refers to title
|
SELECT COUNT(film_id) FROM film WHERE rating = 'R' AND release_year = 2006
|
na
| 9,172
|
[
"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"}}
|
[
"film"
] |
[
"film.film_id",
"film.rating",
"film.release_year"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many actors starred in the film id 508?
|
SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508
|
na
| 9,173
|
[
"COUNT",
"SELECT",
"FROM"
] | 3
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film_actor"
] |
[
"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 special features for the film "Smoochy Control"?
|
"SMOOCHY CONTROL" is the title of film
|
SELECT special_features FROM film WHERE title = 'SMOOCHY CONTROL'
|
na
| 9,174
|
[
"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.special_features",
"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 customers paid over the amount of 10 on August 2005?
|
over the amount of 10 refers to amount > 10; paid on August 2005 refers to payment_date like '2005_08%'; customer refers to customer_id
|
SELECT COUNT(customer_id) FROM payment WHERE SUBSTR(payment_date, 1, 7) LIKE '2005-08'
|
na
| 9,175
|
[
"SELECT",
"LIKE",
"-",
"SUBSTR",
"COUNT",
"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"}}
|
[
"payment"
] |
[
"payment.customer_id",
"payment.payment_date"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
List the names of the films that are more than 180 minutes long.
|
more than 180 min long refers to length > 180; name of film refers to title
|
SELECT title FROM film WHERE length > 180
|
na
| 9,176
|
[
"length",
"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.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 much is the total rental payment for the first 10 rentals?
|
first 10 rental refers to rental id between 1 and 10; total rental payment refers to sum(amount)
|
SELECT SUM(amount) FROM payment WHERE rental_id BETWEEN 1 AND 10
|
na
| 9,177
|
[
"AND",
"SELECT",
"SUM",
"BETWEEN",
"FROM"
] | 5
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"payment"
] |
[
"payment.amount",
"payment.rental_id"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
What are the full names of all the active employees?
|
active employee refers to active = 1; full name refers to first_name, last_name
|
SELECT first_name, last_name FROM staff WHERE active = 1
|
na
| 9,178
|
[
"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"}}
|
[
"staff"
] |
[
"staff.active",
"staff.first_name",
"staff.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
|
Who is the staff manager in store id 2?
|
staff manager refers to manager_staff_id
|
SELECT manager_staff_id FROM store WHERE store_id = 2
|
na
| 9,179
|
[
"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"}}
|
[
"store"
] |
[
"store.manager_staff_id",
"store.store_id"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many rentals were returned on 5/27/2005?
|
return on 5/27/2005 refers to return_date = '2005-05-27'; rental refers to rental_id
|
SELECT COUNT(rental_id) FROM rental WHERE rental_date = '2005-05-27'
|
na
| 9,180
|
[
"COUNT",
"-",
"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"}}
|
[
"rental"
] |
[
"rental.rental_date",
"rental.rental_id"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
What are the names of the movies which Laura Brody starred in?
|
name of movie refers to title
|
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 = 'Laura' AND T1.last_name = 'Brody'
|
na
| 9,181
|
[
"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 name of the films that can only be found in store id 2.
|
name of film refers to title
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2
|
na
| 9,182
|
[
"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
|
What is the full name of the customer who rented movies for 7 consecutive days?
|
rented for 7 consecutive days refers to Subtract(return_date, rental_date) = 7; full name refers to first_name, last_name
|
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN ( SELECT customer_id, COUNT(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS T2 ON T1.customer_id = T2.customer_id
|
na
| 9,183
|
[
"GROUP BY",
"AS",
"SELECT",
"HAVING",
"ORDER BY",
"INNER JOIN",
"ON",
"PARTITION BY",
"OVER",
"COUNT",
"FROM"
] | 24
|
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",
"rental"
] |
[
"_q_0.customer_id",
"_q_0.days",
"_q_1.customer_id",
"_q_1.days",
"_q_1.rn",
"_q_2.customer_id",
"_q_2.results",
"customer.customer_id",
"customer.first_name",
"customer.last_name",
"rental.customer_id",
"rental.rental_date",
"t2.customer_id"
] |
[
"customer.customer_id",
"t2.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 films are categorized as horror?
|
"Horror" is the name of category
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'
|
na
| 9,184
|
[
"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
|
What is the name of the most rented movie?
|
most rented movie refers to title where Max(Count(rental_id))
|
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_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 GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,185
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 18
|
challenging
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"inventory",
"rental"
] |
[
"film.film_id",
"film.title",
"inventory.film_id",
"inventory.inventory_id",
"rental.inventory_id",
"rental.rental_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
|
What is the most common special features of science-fiction movies?
|
"science fiction" is the name of category; most common special features refers to Max(frequency(special_features))
|
SELECT 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 T3.name = 'sci-fi' ORDER BY T1.special_features DESC LIMIT 1
|
na
| 9,186
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"-",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 13
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"film",
"film_category"
] |
[
"category.category_id",
"category.name",
"film.film_id",
"film.special_features",
"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 full name of the actor who starred in most movies?
|
full name refers to first_name, last_name; actor who starred in the most movies refers to actor_id where Max(Count(film_id))
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,187
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 15
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film_actor.actor_id",
"film_actor.film_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"actor.actor_id",
"film_actor.actor_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Among the films with a rental duration of 7 days, how many are comedies?
|
rental duration of 7 refers to rental_duration = 7; comedies refers to name = 'Comedy'
|
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 T1.rental_duration = 7 AND T3.name = 'Comedy'
|
na
| 9,188
|
[
"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"}}
|
[
"category",
"film",
"film_category"
] |
[
"category.category_id",
"category.name",
"film.film_id",
"film.rental_duration",
"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 is the staff manager of the store with the most non-active customers?
|
most non-active customer refers to Max(Count(active = 0))
|
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,189
|
[
"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"}}
|
[
"customer",
"staff",
"store"
] |
[
"customer.active",
"customer.customer_id",
"customer.store_id",
"staff.first_name",
"staff.last_name",
"staff.store_id",
"store.store_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"customer.store_id",
"staff.store_id",
"store.store_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
What is the rental price per day of the most expensive children's film?
|
children's film refers to name = 'Children'; average price per day of most expensive film = Max(Divide(rental_rate, rental_duration))
|
SELECT 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 = 'Children' ORDER BY T1.rental_rate / T1.rental_duration DESC LIMIT 1
|
na
| 9,190
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"FROM"
] | 12
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"film",
"film_category"
] |
[
"category.category_id",
"category.name",
"film.film_id",
"film.rental_duration",
"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 complete address of store id 1?
|
complete address refers to address, address2, district
|
SELECT T3.address, T3.address2, T3.district FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN store AS T4 ON T3.address_id = T4.address_id WHERE T4.store_id = 1
|
na
| 9,191
|
[
"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",
"store"
] |
[
"address.address",
"address.address2",
"address.address_id",
"address.city_id",
"address.district",
"city.city_id",
"city.country_id",
"country.country_id",
"store.address_id",
"store.store_id"
] |
[
"address.address_id",
"address.city_id",
"city.city_id",
"city.country_id",
"country.country_id",
"store.address_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many customers are from the city of Lethbridge?
|
customer refers to customer_id
|
SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Lethbridge'
|
na
| 9,192
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address",
"city",
"customer"
] |
[
"address.address_id",
"address.city_id",
"city.city",
"city.city_id",
"customer.address_id",
"customer.customer_id"
] |
[
"address.address_id",
"address.city_id",
"city.city_id",
"customer.address_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many cities are there in the United States?
|
"United States" is the country
|
SELECT COUNT(T2.city) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'United States'
|
na
| 9,193
|
[
"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"}}
|
[
"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 the names of the customers from India.
|
"India" is the country; name refers to first_name, last_name
|
SELECT T4.first_name, T4.last_name FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id WHERE T1.country = 'India'
|
na
| 9,194
|
[
"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
|
Among the classic movies, how many movies have a rental rate of less than 1?
|
classic movie refers to name = 'Classics'; rental rate of less than 1 refers to rental_rate < 1; movie refers to film_id
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate < 1 AND T2.name = 'Classics'
|
na
| 9,195
|
[
"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"}}
|
[
"category",
"film",
"film_category"
] |
[
"category.category_id",
"category.name",
"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 full name of the customer who rented the highest number of movies of all time?
|
full name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,196
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 15
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"customer",
"rental"
] |
[
"customer.customer_id",
"customer.first_name",
"customer.last_name",
"rental.customer_id",
"rental.rental_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"customer.customer_id",
"rental.customer_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many times was "Blanket Beverly" rented?
|
"BLANKET BEVERLY" is the title of film; rented times refers to count(rental_id)
|
SELECT COUNT(T3.rental_id) 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.title = 'Blanket Beverly'
|
na
| 9,197
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"inventory",
"rental"
] |
[
"film.film_id",
"film.title",
"inventory.film_id",
"inventory.inventory_id",
"rental.inventory_id",
"rental.rental_id"
] |
[
"film.film_id",
"inventory.film_id",
"inventory.inventory_id",
"rental.inventory_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
What is the full name of the actor who has the highest number of restricted films?
|
restricted refers to rating = 'R'; highest number of film refers to Max(Count(film_id)); full name refers to first_name, last_name
|
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num 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 = 'R' GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,198
|
[
"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"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.rating",
"film_actor.actor_id",
"film_actor.film_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"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 top 5 actors with the highest number of films? List their full names and calculate the average number of films for each of the actors.
|
actors with highest number of films refers to actor_id with Max(Count(film_id)); full name refers to first_name, last_name; average number of film = Divide (Count(film_id), 5)
|
SELECT T.first_name, T.last_name, num FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num 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 GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 5
|
na
| 9,199
|
[
"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"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"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 actors' IDs who have "KILMER" as last name.
|
SELECT actor_id FROM actor WHERE last_name = 'KILMER'
|
na
| 9,200
|
[
"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
|
List down the films titles with the lowest replacement cost under the general audiences rating.
|
lowest replacement cost refers to Min(replacement_cost); under general audience rating refers to rating = G
|
SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) FROM film )
|
na
| 9,201
|
[
"MIN",
"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.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
|
Among the films with the longest duration, list any five title with their descriptions and special features.
|
longest duration of film refers to Max(length)
|
SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) LIMIT 5
|
na
| 9,202
|
[
"SELECT",
"LIMIT",
"length",
"FROM",
"MAX"
] | 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"
] |
[
"film.description",
"film.length",
"film.special_features",
"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 films rented on 26th May, 2005 were returned on 30th May, 2005?
|
rented on 26th May 2005 refers to rental_date = '2005-05-26'; return on 30th May, 2005 refers to return_date = '2005-05-30'; number of rented film refers to Count (rental_id)
|
SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-30'
|
na
| 9,203
|
[
"AND",
"SELECT",
"-",
"COUNT",
"BETWEEN",
"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"}}
|
[
"rental"
] |
[
"rental.rental_date",
"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
|
Calculate the average payment amount per customer.
|
average payment refers to AVG(amount)
|
SELECT AVG(amount) FROM payment GROUP BY customer_id
|
na
| 9,204
|
[
"GROUP BY",
"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"}}
|
[
"payment"
] |
[
"payment.amount",
"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 name and email of the staff in store ID 2?
|
name refers to first_name, last_name
|
SELECT first_name, last_name, email FROM staff WHERE store_id = 2
|
na
| 9,205
|
[
"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"}}
|
[
"staff"
] |
[
"staff.email",
"staff.first_name",
"staff.last_name",
"staff.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 many percent of customers were inactive?
|
inactive refers to active = 0; percent = Divide (Count (customer_id where active = 0), Count(customer_id)) * 100
|
SELECT CAST(SUM(IIF(active = 0, 1, 0)) AS REAL) * 100 / COUNT(customer_id) FROM customer
|
na
| 9,206
|
[
"AS",
"SELECT",
"SUM",
"CAST",
"COUNT",
"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"
] |
[
"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
|
What is the description and film title of ID 996?
|
ID 996 refers to film_id = 996
|
SELECT description, title FROM film_text WHERE film_id = 996
|
na
| 9,207
|
[
"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_text"
] |
[
"film_text.description",
"film_text.film_id",
"film_text.title"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Calculate customers' total payment amount in August, 2005.
|
in August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount)
|
SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'
|
na
| 9,208
|
[
"SELECT",
"SUM",
"-",
"SUBSTR",
"FROM"
] | 5
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"payment"
] |
[
"payment.amount",
"payment.payment_date"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
List down the film titles performed by Emily Dee.
|
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 = 'Emily' AND T1.last_name = 'Dee'
|
na
| 9,209
|
[
"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 down the actors' full names who performed in "CHOCOLATE DUCK" film.
|
"CHOCOLATE DUCK" is the title of film; full name refers to first_name, last_name
|
SELECT T3.first_name, T3.last_name FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = 'CHOCOLATE DUCK'
|
na
| 9,210
|
[
"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
|
How many films in the horror category were included in PG-13-rated?
|
"Horror" is the name of category; PG-13 rated 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 = 'Horror' AND T1.rating = 'PG-13'
|
na
| 9,211
|
[
"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
|
Distinguish the films performed by Judy Dean according to category.
|
films performed refers to film
|
SELECT T5.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 INNER JOIN film_category AS T4 ON T2.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T1.first_name = 'Judy' AND T1.last_name = 'Dean'
|
na
| 9,212
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 16
|
challenging
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"category",
"film",
"film_actor",
"film_category"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"category.category_id",
"category.name",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.category_id",
"film_category.film_id"
] |
[
"actor.actor_id",
"category.category_id",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.category_id",
"film_category.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Write down any five film names under the documentary category.
|
"Documentary" is the name of category; film name refers to title
|
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 = 'Documentary' LIMIT 5
|
na
| 9,213
|
[
"AS",
"SELECT",
"LIMIT",
"INNER JOIN",
"ON",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"film",
"film_category"
] |
[
"category.category_id",
"category.name",
"film.film_id",
"film.title",
"film_category.category_id",
"film_category.film_id"
] |
[
"category.category_id",
"film.film_id",
"film_category.category_id",
"film_category.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Mention the language of Untouchables Sunrise film and calculate its rental cost per day.
|
"UNTOUCHABLES SUNRISE" is the title of film; language refers to name; rental cost per day = Divide (rental_cost, rental_duration)
|
SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'
|
na
| 9,214
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 7
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"language"
] |
[
"film.language_id",
"film.rental_duration",
"film.replacement_cost",
"film.title",
"language.language_id",
"language.name"
] |
[
"film.language_id",
"language.language_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
List the films' titles which were rented on 24th May,2005.
|
rented on 24th May 2005 refers to rental_date = '2005-05-24%'
|
SELECT T1.title 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 SUBSTR(T3.rental_date, 1, 10) = '2005-05-24'
|
na
| 9,215
|
[
"AS",
"SELECT",
"-",
"INNER JOIN",
"ON",
"SUBSTR",
"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"}}
|
[
"film",
"inventory",
"rental"
] |
[
"film.film_id",
"film.title",
"inventory.film_id",
"inventory.inventory_id",
"rental.inventory_id",
"rental.rental_date"
] |
[
"film.film_id",
"inventory.film_id",
"inventory.inventory_id",
"rental.inventory_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
List the films' titles which were rented by Brian Wyman in July, 2005.
|
rented in July 2005 refers to year (rental_date) = 2005 and month (rental_date) = 7
|
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 = 'BRIAN' AND T1.last_name = 'WYMAN' AND STRFTIME('%Y', T2.rental_date) = '2005' AND STRFTIME('%m',T2.rental_date) = '7'
|
na
| 9,216
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"STRFTIME",
"FROM"
] | 17
|
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
|
Write down the inventories' IDs and actors' names of "STREETCAR INTENTIONS".
|
"STREETCAR INTENTIONS" is the title of film; actor's names refers to first_name, last_name
|
SELECT T4.inventory_id, 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 INNER JOIN inventory AS T4 ON T2.film_id = T4.film_id WHERE T3.title = 'STREETCAR INTENTIONS'
|
na
| 9,217
|
[
"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"}}
|
[
"actor",
"film",
"film_actor",
"inventory"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.title",
"film_actor.actor_id",
"film_actor.film_id",
"inventory.film_id",
"inventory.inventory_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
|
Among the films rented by Natalie Meyer, describe the titles and categories of the films which were rented in February 2006.
|
category refers to name; rented in February 2006 refers to year(rental_date) = 2006 and month (rental_rate) = 2
|
SELECT T3.title, T2.name FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'Natalie' AND T5.last_name = 'Meyer' AND STRFTIME('%Y',T3.rental_rate) = '2006' AND STRFTIME('%m',T3.rental_rate) = '2'
|
na
| 9,218
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"STRFTIME",
"FROM"
] | 23
|
challenging
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"customer",
"film",
"film_category",
"inventory",
"rental"
] |
[
"category.category_id",
"category.name",
"customer.first_name",
"customer.last_name",
"customer.store_id",
"film.film_id",
"film.rental_rate",
"film.title",
"film_category.category_id",
"film_category.film_id",
"inventory.film_id",
"inventory.inventory_id",
"inventory.store_id",
"rental.inventory_id"
] |
[
"category.category_id",
"customer.store_id",
"film.film_id",
"film_category.category_id",
"film_category.film_id",
"inventory.film_id",
"inventory.inventory_id",
"inventory.store_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
|
How many rental IDs belong to Eleanor Hunt?
|
'Eleanor Hunt' is the full name of a customer; full name refers to first_name, last_name
|
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Eleanor' AND T2.last_name = 'Hunt'
|
na
| 9,219
|
[
"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
|
Describe the full names and cities of the customers who rented "DREAM PICKUP".
|
full name refers to first_name, last_name; 'DREAM PICKUP' is a title of film
|
SELECT T4.first_name, T4.last_name, T6.city 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 INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'
|
na
| 9,220
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 18
|
challenging
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address",
"city",
"customer",
"film",
"inventory",
"rental"
] |
[
"address.address_id",
"address.city_id",
"city.city",
"city.city_id",
"customer.address_id",
"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"
] |
[
"address.address_id",
"address.city_id",
"city.city_id",
"customer.address_id",
"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
|
Calculate how many percent of customers were located in India.
|
'India' is a country; calculation = DIVIDE(SUM(country = 'India'), COUNT(customer_id)) * 100
|
SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) * 100 / COUNT(T4.customer_id) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id
|
na
| 9,221
|
[
"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"}}
|
[
"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.customer_id"
] |
[
"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
|
How much percentage of the film did Mary Keitel perform more than Angela Witherspoon?
|
'Mary Keitel' AND 'Angela Witherspoon' are full name of actors; full name refers to FirstName, LastName; calculation = DIVIDE(SUBTRACT(SUM('Mary Keitel'), SUM('Angela Witherspoon')), SUM('Angela Witherspoon')) * 100
|
SELECT CAST((SUM(IIF(T1.first_name = 'ANGELA' AND T1.last_name = 'WITHERSPOON', 1, 0)) - SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0))) AS REAL) * 100 / SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0)) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id
|
na
| 9,222
|
[
"AS",
"AND",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"FROM"
] | 14
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film_actor.actor_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
|
Provide the email, address, city, and country of the customer Lillie Kim.
|
'Lillie Kim' is the full name of a customer; full name refers to first_name, last_name
|
SELECT T1.email, T2.address, T3.city, T4.country FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id WHERE T1.first_name = 'Lillie' AND T1.last_name = 'Kim'
|
na
| 9,223
|
[
"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",
"address.address_id",
"address.city_id",
"city.city",
"city.city_id",
"city.country_id",
"country.country",
"country.country_id",
"customer.address_id",
"customer.email",
"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
|
Provide any 5 customers' full names who have rented from Mike Hillyer.
|
full name refers to first_name, last_name; 'Mike Hillyer' is a full name of a staff;
|
SELECT T3.first_name, T3.last_name FROM staff AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.first_name = 'Mike' AND T1.last_name = 'Hillyer' LIMIT 5
|
na
| 9,224
|
[
"AS",
"AND",
"SELECT",
"LIMIT",
"INNER JOIN",
"ON",
"FROM"
] | 11
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address",
"customer",
"staff"
] |
[
"address.address_id",
"customer.address_id",
"customer.first_name",
"customer.last_name",
"staff.address_id",
"staff.first_name",
"staff.last_name"
] |
[
"address.address_id",
"customer.address_id",
"staff.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
|
Calculate the total payment amount by Diane Collins.
|
'Diane Collins' is a full name of a customer; full name refers to first_name, last_name
|
SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'
|
na
| 9,225
|
[
"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
|
Provide the full names and emails of customers whose payments were greater than 70% of the average.
|
full name refers to first_name, last_name; average payment refers to AVG(amount); payments were greater than 70% of the average refers to amount > (AVG(amount) MULTIPLY 0.7)
|
SELECT DISTINCT T2.first_name, T2.last_name, T2.email FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id WHERE T1.amount > ( SELECT AVG(amount) FROM payment ) * 0.7
|
na
| 9,226
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"AVG",
"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",
"customer",
"payment"
] |
[
"address.address_id",
"customer.address_id",
"customer.customer_id",
"customer.email",
"customer.first_name",
"customer.last_name",
"payment.amount",
"payment.customer_id"
] |
[
"address.address_id",
"customer.address_id",
"customer.customer_id",
"payment.customer_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
How many films have a rental rate of 0.99?
|
SELECT COUNT(film_id) FROM film WHERE rental_rate = 0.99
|
na
| 9,227
|
[
"COUNT",
"SELECT",
"FROM"
] | 3
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film"
] |
[
"film.film_id",
"film.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
|
Among the customers with customer ID of 100 and below, how many of them have Thomas as their last name?
|
customer ID of 100 and below refers to customer_id < 100
|
SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100
|
na
| 9,228
|
[
"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.customer_id",
"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
|
List the actor's last name that starred the film with the description of "A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies".
|
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.description = 'A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies'
|
na
| 9,229
|
[
"AS",
"SELECT",
"INNER JOIN",
"And",
"ON",
"in",
"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.last_name",
"film.description",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id"
] |
[
"actor.actor_id",
"film.film_id",
"film_actor.actor_id",
"film_actor.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
|
movie_3
|
Give the title of the film starred by Liza Bergman with the highest replacement cost.
|
Liza Bergman' is a full name; full name refers to first_name, last_name; highest replacement cost refers to MAX(replacement_cost)
|
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 = 'Liza' AND T1.last_name = 'Bergman' ORDER BY replacement_cost DESC LIMIT 1
|
na
| 9,230
|
[
"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.replacement_cost",
"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
|
Among films with store ID of 2, list the title of films with the highest rental rate.
|
highest rental rate refers to MAX(rental_rate)
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1
|
na
| 9,231
|
[
"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"}}
|
[
"film",
"inventory"
] |
[
"film.film_id",
"film.rental_rate",
"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
|
Among the films starred by Angelina Astaire, what is the title of the film with a replacement cost of 27.99?
|
Angelina Astaire' is a full name of an actor; full name refers to first_name, last_name
|
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Angelina' AND T1.last_name = 'Astaire' AND T3.replacement_cost = 27.99
|
na
| 9,232
|
[
"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.replacement_cost",
"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 inventory ID of the film titled "African Egg".
|
'African Egg' is a title of a film
|
SELECT T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'African Egg'
|
na
| 9,233
|
[
"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.inventory_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 length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?
|
length duration of 113 minutes refers to length = 113; 'Kirk Jovovich' is a full name of an actor; full name refers to first_name, last_name
|
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'
|
na
| 9,234
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"length",
"COUNT",
"FROM"
] | 13
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.length",
"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
|
In the film with an inventory ID between 20 to 60, how many of the films have a G rating?
|
G rating refers to rating = 'G'
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id BETWEEN 20 AND 60 AND T1.rating = 'G'
|
na
| 9,235
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"COUNT",
"BETWEEN",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"inventory"
] |
[
"film.film_id",
"film.rating",
"inventory.film_id",
"inventory.inventory_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
|
Among films with a rental rate of 4.99, what is the total number of films starred by Bob Fawcett?
|
Bob Fawcett' is a full name of an actor; full name refers to first_name, last_name
|
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rental_rate = 4.99 AND T1.first_name = 'Bob' AND T1.last_name = 'Fawcett'
|
na
| 9,236
|
[
"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
|
What is the inventory ID of the films starred by Russell Close with a duration between 110 to 150 minutes?
|
'Russell Close' is a full name of an actor; full name refers to first_name, last_name; duration between 110 to 150 minutes refers to length BETWEEN 110 AND 150
|
SELECT T4.inventory_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 BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.last_name = 'Close'
|
na
| 9,237
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"length",
"BETWEEN",
"FROM"
] | 17
|
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.length",
"film_actor.actor_id",
"film_actor.film_id",
"inventory.film_id",
"inventory.inventory_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 store and inventory ID of the film with the longest duration?
|
the longest duration refers to MAX(length)
|
SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1
|
na
| 9,238
|
[
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"length",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"inventory"
] |
[
"film.film_id",
"film.length",
"inventory.film_id",
"inventory.inventory_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 titles of the films starred by Elvis Marx.
|
'Elvis Marx' is a full name of a film; full name refers to first_name, last_name
|
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.last_name = 'Close'
|
na
| 9,239
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"length",
"BETWEEN",
"FROM"
] | 14
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.length",
"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
|
In films with rental rate of 4.99, list down the inventory ID of the films starred by Lucille Dee.
|
'Lucille Dee' is a full name of an actor; full name refers to first_name, last_name
|
SELECT T4.inventory_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 T1.first_name = 'Lucille' AND T1.last_name = 'Dee' AND T3.rental_rate = 4.99
|
na
| 9,240
|
[
"AS",
"AND",
"SELECT",
"INNER JOIN",
"ON",
"FROM"
] | 14
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film",
"film_actor",
"inventory"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film.film_id",
"film.rental_rate",
"film_actor.actor_id",
"film_actor.film_id",
"inventory.film_id",
"inventory.inventory_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
|
List the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed films.
|
average rental rate of all listed films refers to AVG(rental_rate); rental rate greater than the 60% of average rental rate refers to rental_rate > (AVG(rental_rate)) MULTIPLY 0.6
|
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 )
|
na
| 9,241
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"AVG",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film",
"inventory"
] |
[
"film.film_id",
"film.rental_rate",
"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
|
Among the films starred by Nick Wahlberg, what is the percentage of the films with G rating?
|
'Nick Wahlberg' is a full name of an actor; full name refers to first_name, last_name; G rating refers to rating = 'G'; calculation = DIVIDE(SUM(rating = 'G'), SUM(rating)) * 100
|
SELECT CAST(SUM(IIF(T3.rating = 'G', 1, 0)) AS REAL) / COUNT(T3.film_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 WHERE T1.first_name = 'Elvis' AND T1.last_name = 'Marx'
|
na
| 9,242
|
[
"AS",
"AND",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"FROM"
] | 14
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"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
|
List the address in Texas in the ascending order of city id.
|
'Texas' is a district
|
SELECT address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' )
|
na
| 9,243
|
[
"MIN",
"AND",
"SELECT",
"FROM"
] | 6
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"address"
] |
[
"address.address",
"address.city_id",
"address.district"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Find the full name and email address of inactive customers whose record was created in 2006.
|
full name refers to first_name, last_name; record created in 2006 refers to create_date = 2006; inactive customers refers to active = 0
|
SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND active = 0
|
na
| 9,244
|
[
"STRFTIME",
"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.create_date",
"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
|
What percentage of the movies are PG-13?
|
PG-13 is a rating; calculation = DIVIDE(SUM(rating = PG-13), SUM(rating)) * 100
|
SELECT CAST(SUM(IIF(rating = 'PG-13', 1, 0)) AS REAL) * 100 / COUNT(film_id) FROM film
|
na
| 9,245
|
[
"AS",
"SELECT",
"SUM",
"-",
"CAST",
"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"}}
|
[
"film"
] |
[
"film.film_id",
"film.rating"
] |
[] |
{
"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 top ten movies with the most price per day in descending order of price per day.
|
movies with the most price per day refers to MAX(rental_rate)
|
SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 10
|
na
| 9,246
|
[
"SELECT",
"ORDER BY",
"LIMIT",
"FROM",
"DESC"
] | 5
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"film"
] |
[
"film.rental_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 average rent amount paid by the customer with customer id 15.
|
average rent amount refers to AVG(amount)
|
SELECT AVG(amount) FROM payment WHERE customer_id = 15
|
na
| 9,247
|
[
"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"}}
|
[
"payment"
] |
[
"payment.amount",
"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 customers rented for an above-average period?
|
rented period refers to SUBTRACT(return_date, rental_date); calculation = rented period > (AVG(rented period))
|
SELECT COUNT(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental )
|
na
| 9,248
|
[
"COUNT",
"SELECT",
"FROM",
"AVG"
] | 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"}}
|
[
"rental"
] |
[
"rental.customer_id",
"rental.rental_date",
"rental.return_date"
] |
[] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Among the movies, what percentage are horror?
|
horror is a name of film category; calculation = DIVIDE(COUNT('horror'), COUNT(category_id)) * 100
|
SELECT CAST(SUM(IIF(T2.name = 'horror', 1, 0)) AS REAL) * 100 / COUNT(T2.category_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
|
na
| 9,249
|
[
"AS",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"FROM"
] | 10
|
simple
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"category",
"film_category"
] |
[
"category.category_id",
"category.name",
"film_category.category_id"
] |
[
"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
|
Give the full name of the actor who acted in the most number of movies?
|
full name refers to first_name, last_name; acted in the most number of movies refers to MAX(COUNT(film_id))
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,250
|
[
"GROUP BY",
"AS",
"SELECT",
"ORDER BY",
"LIMIT",
"INNER JOIN",
"ON",
"DESC",
"COUNT",
"FROM"
] | 15
|
medium
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"film_actor"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film_actor.actor_id",
"film_actor.film_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"actor.actor_id",
"film_actor.actor_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
Give the full name of the actor who acted the most in drama movies?
|
full name refers to first_name, last_name; drama is a category of a film; acted the most in a movies refers to MAX(COUNT(film_id))
|
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id WHERE T3.category_id = 7 GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
na
| 9,251
|
[
"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"}}
|
[
"actor",
"film_actor",
"film_category"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.category_id",
"film_category.film_id",
"t.first_name",
"t.last_name",
"t.num"
] |
[
"actor.actor_id",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
movie_3
|
What is the difference in the average number of films rented each day in Australia and Canada?
|
'Australia' AND 'Canada' are country; average number of films refers to AVG('Australia') AND AVG('Canada'); calculation = SUBTRACT(AVG('Australia'), AVG('Canada'))
|
SELECT AVG(IIF(T4.country = 'Australia', 1, 0)) - AVG(IIF(T4.country = 'Canada', 1, 0)) AS diff FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id
|
na
| 9,252
|
[
"AS",
"SELECT",
"INNER JOIN",
"ON",
"AVG",
"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"}}
|
[
"address",
"city",
"country",
"customer"
] |
[
"address.address_id",
"address.city_id",
"city.city_id",
"city.country_id",
"country.country",
"country.country_id",
"customer.address_id"
] |
[
"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
|
Of the movies in which Reese Kilmer acted, what percentage are action movies?
|
'Reese Kilmer' is a full name of an actor; 'action' is the name of the category; calculation = DIVIDE(COUNT('action'), COUNT(category_id)) * 100
|
SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_name = 'Kilmer'
|
na
| 9,253
|
[
"AS",
"AND",
"SELECT",
"SUM",
"INNER JOIN",
"ON",
"CAST",
"COUNT",
"FROM"
] | 17
|
challenging
|
{"film_text": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT"}, "actor": {"actor_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "last_update": "DATETIME"}, "address": {"address_id": "INTEGER", "address": "TEXT", "address2": "TEXT", "district": "TEXT", "city_id": "INTEGER", "postal_code": "TEXT", "phone": "TEXT", "last_update": "DATETIME"}, "category": {"category_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "city": {"city_id": "INTEGER", "city": "TEXT", "country_id": "INTEGER", "last_update": "DATETIME"}, "country": {"country_id": "INTEGER", "country": "TEXT", "last_update": "DATETIME"}, "customer": {"customer_id": "INTEGER", "store_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "email": "TEXT", "address_id": "INTEGER", "active": "INTEGER", "create_date": "DATETIME", "last_update": "DATETIME"}, "film": {"film_id": "INTEGER", "title": "TEXT", "description": "TEXT", "release_year": "TEXT", "language_id": "INTEGER", "original_language_id": "INTEGER", "rental_duration": "INTEGER", "rental_rate": "REAL", "length": "INTEGER", "replacement_cost": "REAL", "rating": "TEXT", "special_features": "TEXT", "last_update": "DATETIME"}, "film_actor": {"actor_id": "INTEGER", "film_id": "INTEGER", "last_update": "DATETIME"}, "film_category": {"film_id": "INTEGER", "category_id": "INTEGER", "last_update": "DATETIME"}, "inventory": {"inventory_id": "INTEGER", "film_id": "INTEGER", "store_id": "INTEGER", "last_update": "DATETIME"}, "language": {"language_id": "INTEGER", "name": "TEXT", "last_update": "DATETIME"}, "payment": {"payment_id": "INTEGER", "customer_id": "INTEGER", "staff_id": "INTEGER", "rental_id": "INTEGER", "amount": "REAL", "payment_date": "DATETIME", "last_update": "DATETIME"}, "rental": {"rental_id": "INTEGER", "rental_date": "DATETIME", "inventory_id": "INTEGER", "customer_id": "INTEGER", "return_date": "DATETIME", "staff_id": "INTEGER", "last_update": "DATETIME"}, "staff": {"staff_id": "INTEGER", "first_name": "TEXT", "last_name": "TEXT", "address_id": "INTEGER", "picture": "BLOB", "email": "TEXT", "store_id": "INTEGER", "active": "INTEGER", "username": "TEXT", "password": "TEXT", "last_update": "DATETIME"}, "store": {"store_id": "INTEGER", "manager_staff_id": "INTEGER", "address_id": "INTEGER", "last_update": "DATETIME"}}
|
[
"actor",
"category",
"film_actor",
"film_category"
] |
[
"actor.actor_id",
"actor.first_name",
"actor.last_name",
"category.category_id",
"category.name",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.category_id",
"film_category.film_id"
] |
[
"actor.actor_id",
"category.category_id",
"film_actor.actor_id",
"film_actor.film_id",
"film_category.category_id",
"film_category.film_id"
] |
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['PENELOPE', 'NICK'],\n\tlast_name TEXT NOT NULL -- example: ['WAHLBERG', 'GUINESS'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER -- example: ['2', '1'],\n\taddress TEXT NOT NULL -- example: ['47 MySakila Drive', '28 MySQL Boulevard'],\n\taddress2 TEXT -- example: [''],\n\tdistrict TEXT NOT NULL -- example: ['Alberta', 'QLD'],\n\tcity_id INTEGER NOT NULL -- example: ['576', '300'],\n\tpostal_code TEXT -- example: ['', '35200'],\n\tphone TEXT NOT NULL -- example: ['', '14033335568'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Animation', 'Action'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER -- example: ['2', '1'],\n\tcity TEXT NOT NULL -- example: ['Abha', 'A Corua (La Corua)'],\n\tcountry_id INTEGER NOT NULL -- example: ['87', '82'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER -- example: ['2', '1'],\n\tcountry TEXT NOT NULL -- example: ['Algeria', 'Afghanistan'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['MARY', 'PATRICIA'],\n\tlast_name TEXT NOT NULL -- example: ['JOHNSON', 'SMITH'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_id INTEGER NOT NULL -- example: ['5', '6'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['0', '1'],\n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\trelease_year TEXT -- example: ['2006'],\n\tlanguage_id INTEGER NOT NULL -- example: ['1'],\n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL -- example: ['6', '3'],\n\trental_rate REAL DEFAULT (4.99) NOT NULL -- example: ['0.99', '4.99'],\n\tlength INTEGER -- example: ['48', '86'],\n\treplacement_cost REAL DEFAULT (19.99) NOT NULL -- example: ['12.99', '20.99'],\n\trating TEXT DEFAULT 'G' -- example: ['PG', 'G'],\n\tspecial_features TEXT -- example: ['Trailers,Deleted Scenes', 'Deleted Scenes,Behind the Scenes'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['23', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tcategory_id INTEGER NOT NULL -- example: ['6', '11'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\ttitle TEXT NOT NULL -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER'],\n\tdescription TEXT -- example: ['A Epic Drama of a Feminist And a Mad Scientist who', 'A Astounding Epistle of a Database Administrator A'],\n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER -- example: ['2', '1'],\n\tfilm_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER -- example: ['2', '1'],\n\tname TEXT NOT NULL -- example: ['Italian', 'English'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER -- example: ['2', '1'],\n\tcustomer_id INTEGER NOT NULL -- example: ['2', '1'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\trental_id INTEGER -- example: ['573', '76'],\n\tamount REAL NOT NULL -- example: ['2.99', '0.99'],\n\tpayment_date DATETIME NOT NULL -- example: ['2005-05-28 10:35:23', '2005-05-25 11:30:37'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER -- example: ['2', '1'],\n\trental_date DATETIME NOT NULL -- example: ['2005-05-24 22:54:33', '2005-05-24 22:53:30'],\n\tinventory_id INTEGER NOT NULL -- example: ['367', '1525'],\n\tcustomer_id INTEGER NOT NULL -- example: ['130', '459'],\n\treturn_date DATETIME -- example: ['2005-05-26 22:04:30', '2005-05-28 19:40:33'],\n\tstaff_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER -- example: ['2', '1'],\n\tfirst_name TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tlast_name TEXT NOT NULL -- example: ['Stephens', 'Hillyer'],\n\taddress_id INTEGER NOT NULL -- example: ['4', '3'],\n\tpicture BLOB -- example: ['0x3F504E470D0A1A0A0000000D494844520000007900000075'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\tstore_id INTEGER NOT NULL -- example: ['2', '1'],\n\tactive INTEGER DEFAULT 1 NOT NULL -- example: ['1'],\n\tusername TEXT NOT NULL -- example: ['Jon', 'Mike'],\n\tpassword TEXT -- example: ['8cb2237d0679ca88db6464eac60da96345513964'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER -- example: ['2', '1'],\n\tmanager_staff_id INTEGER NOT NULL -- example: ['2', '1'],\n\taddress_id INTEGER NOT NULL -- example: ['2', '1'],\n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
{
"schema": "\nCREATE TABLE actor (\n\tactor_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id)\n)\n\n\nCREATE TABLE address (\n\taddress_id INTEGER, \n\taddress TEXT NOT NULL, \n\taddress2 TEXT, \n\tdistrict TEXT NOT NULL, \n\tcity_id INTEGER NOT NULL, \n\tpostal_code TEXT, \n\tphone TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (address_id), \n\tCONSTRAINT fk_address_city FOREIGN KEY(city_id) REFERENCES city (city_id)\n)\n\n\nCREATE TABLE category (\n\tcategory_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (category_id)\n)\n\n\nCREATE TABLE city (\n\tcity_id INTEGER, \n\tcity TEXT NOT NULL, \n\tcountry_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (city_id), \n\tCONSTRAINT fk_city_country FOREIGN KEY(country_id) REFERENCES country (country_id)\n)\n\n\nCREATE TABLE country (\n\tcountry_id INTEGER, \n\tcountry TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (country_id)\n)\n\n\nCREATE TABLE customer (\n\tcustomer_id INTEGER, \n\tstore_id INTEGER NOT NULL, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\temail TEXT, \n\taddress_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tcreate_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (customer_id), \n\tCONSTRAINT fk_customer_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_customer_store FOREIGN KEY(store_id) REFERENCES store (store_id)\n)\n\n\nCREATE TABLE film (\n\tfilm_id INTEGER, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\trelease_year TEXT, \n\tlanguage_id INTEGER NOT NULL, \n\toriginal_language_id INTEGER, \n\trental_duration INTEGER DEFAULT 3 NOT NULL, \n\trental_rate REAL DEFAULT (4.99) NOT NULL, \n\tlength INTEGER, \n\treplacement_cost REAL DEFAULT (19.99) NOT NULL, \n\trating TEXT DEFAULT 'G', \n\tspecial_features TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id), \n\tCONSTRAINT fk_film_language FOREIGN KEY(original_language_id) REFERENCES language (language_id),\n\tCONSTRAINT fk_film_language FOREIGN KEY(language_id) REFERENCES language (language_id)\n)\n\n\nCREATE TABLE film_actor (\n\tactor_id INTEGER NOT NULL, \n\tfilm_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (actor_id, film_id), \n\tCONSTRAINT fk_film_actor_film FOREIGN KEY(film_id) REFERENCES film (film_id),\n\tCONSTRAINT fk_film_actor_actor FOREIGN KEY(actor_id) REFERENCES actor (actor_id)\n)\n\n\nCREATE TABLE film_category (\n\tfilm_id INTEGER NOT NULL, \n\tcategory_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (film_id, category_id), \n\tCONSTRAINT fk_film_category_category FOREIGN KEY(category_id) REFERENCES category (category_id),\n\tCONSTRAINT fk_film_category_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE film_text (\n\tfilm_id INTEGER NOT NULL, \n\ttitle TEXT NOT NULL, \n\tdescription TEXT, \n\tPRIMARY KEY (film_id)\n)\n\n\nCREATE TABLE inventory (\n\tinventory_id INTEGER, \n\tfilm_id INTEGER NOT NULL, \n\tstore_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (inventory_id), \n\tCONSTRAINT fk_inventory_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_inventory_film FOREIGN KEY(film_id) REFERENCES film (film_id)\n)\n\n\nCREATE TABLE language (\n\tlanguage_id INTEGER, \n\tname TEXT NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (language_id)\n)\n\n\nCREATE TABLE payment (\n\tpayment_id INTEGER, \n\tcustomer_id INTEGER NOT NULL, \n\tstaff_id INTEGER NOT NULL, \n\trental_id INTEGER, \n\tamount REAL NOT NULL, \n\tpayment_date DATETIME NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (payment_id), \n\tCONSTRAINT fk_payment_rental FOREIGN KEY(rental_id) REFERENCES rental (rental_id),\n\tCONSTRAINT fk_payment_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_payment_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id)\n)\n\n\nCREATE TABLE rental (\n\trental_id INTEGER, \n\trental_date DATETIME NOT NULL, \n\tinventory_id INTEGER NOT NULL, \n\tcustomer_id INTEGER NOT NULL, \n\treturn_date DATETIME, \n\tstaff_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (rental_id), \n\tCONSTRAINT fk_rental_staff FOREIGN KEY(staff_id) REFERENCES staff (staff_id),\n\tCONSTRAINT fk_rental_customer FOREIGN KEY(customer_id) REFERENCES customer (customer_id),\n\tCONSTRAINT fk_rental_inventory FOREIGN KEY(inventory_id) REFERENCES inventory (inventory_id),\n\tUNIQUE (rental_date, inventory_id, customer_id)\n)\n\n\nCREATE TABLE staff (\n\tstaff_id INTEGER, \n\tfirst_name TEXT NOT NULL, \n\tlast_name TEXT NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tpicture BLOB, \n\temail TEXT, \n\tstore_id INTEGER NOT NULL, \n\tactive INTEGER DEFAULT 1 NOT NULL, \n\tusername TEXT NOT NULL, \n\tpassword TEXT, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (staff_id), \n\tCONSTRAINT fk_staff_store FOREIGN KEY(store_id) REFERENCES store (store_id),\n\tCONSTRAINT fk_staff_address FOREIGN KEY(address_id) REFERENCES address (address_id)\n)\n\n\nCREATE TABLE store (\n\tstore_id INTEGER, \n\tmanager_staff_id INTEGER NOT NULL, \n\taddress_id INTEGER NOT NULL, \n\tlast_update DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, \n\tPRIMARY KEY (store_id), \n\tCONSTRAINT fk_store_address FOREIGN KEY(address_id) REFERENCES address (address_id),\n\tCONSTRAINT fk_store_staff FOREIGN KEY(manager_staff_id) REFERENCES staff (staff_id)\n)"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.