db_id
stringclasses
142 values
schema
stringclasses
142 values
schemaComEx
stringclasses
142 values
question
stringlengths
3
224
query
stringlengths
18
523
answer
stringlengths
13
498k
complexity
stringclasses
4 values
distinct
bool
2 classes
like
bool
2 classes
between
bool
2 classes
order_by
bool
2 classes
limit
bool
2 classes
grouby_by
bool
2 classes
having
bool
2 classes
single_join
bool
2 classes
multiple_join
bool
2 classes
multiple_select
bool
2 classes
intersect
bool
2 classes
except
bool
2 classes
union
bool
2 classes
sql_example_80
stringclasses
658 values
sql_example_85
stringclasses
728 values
sql_example_90
stringclasses
804 values
sql_example_95
stringclasses
875 values
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
What are id and name of the products whose price is lower than 600 or higher than 900?
SELECT product_id , product_name FROM products WHERE product_price < 600 OR product_price > 900
[{'product_id': 4, 'product_name': 'blue jeans'}, {'product_id': 5, 'product_name': 'red jeans'}, {'product_id': 6, 'product_name': 'red topping'}, {'product_id': 7, 'product_name': 'black topping'}, {'product_id': 8, 'product_name': 'yellow topping'}, {'product_id': 12, 'product_name': 'drive'}, {'product_id': 15, 'product_name': 'mic'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Which shops' number products is above the average? Give me the shop names.[/QUESTION] [SQL]SELECT name FROM shop WHERE number_products > (SELECT avg(number_products) FROM shop)[/SQL]
[QUESTION]Which shops' number products is above the average? Give me the shop names.[/QUESTION] [SQL]SELECT name FROM shop WHERE number_products > (SELECT avg(number_products) FROM shop)[/SQL]
formula_1
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") )
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorResults table: constructorResultsId raceId constructorId points status 1 18 1 14.0 NULL 2 18 2 8.0 NULL */ CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorStandings table: constructorStandingsId raceId constructorId points position positionText wins 1 18 1 14.0 1 1 1 2 18 2 8.0 3 3 0 */ CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from driverStandings table: driverStandingsId raceId driverId points position positionText wins 1 18 1 10.0 1 1 1 2 18 2 8.0 2 2 0 */ CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from lapTimes table: raceId driverId lap position time milliseconds */ CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from pitStops table: raceId driverId stop lap time duration milliseconds */ CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) /* 2 rows from circuits table: circuitId circuitRef name location country lat lng alt url 1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.8497 144.968 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit 2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.738 http://en.wikipedia.org/wiki/Sepang_International_Circuit */ CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) /* 2 rows from constructors table: constructorId constructorRef name nationality url 1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren 2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber */ CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) /* 2 rows from drivers table: driverId driverRef number code forename surname dob nationality url 1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton 2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld */ CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from qualifying table: qualifyId raceId driverId constructorId number position q1 q2 q3 1 18 1 1 22 1 1:26.572 1:25.187 1:26.714 2 18 9 2 4 2 1:26.103 1:25.315 1:26.869 */ CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) /* 2 rows from races table: raceId year round circuitId name date time url 1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix 2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix */ CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from results table: resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId 1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1 2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1 */ CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) /* 2 rows from seasons table: year url 1950 http://en.wikipedia.org/wiki/1950_Formula_One_season 1951 http://en.wikipedia.org/wiki/1951_Formula_One_season */ CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") ) /* 2 rows from status table: statusId status 1 Finished 2 Disqualified */
What are the names of all the races that occurred in the year 2017?
SELECT name FROM races WHERE YEAR = 2017
[{'name': 'Australian Grand Prix'}, {'name': 'Chinese Grand Prix'}, {'name': 'Bahrain Grand Prix'}, {'name': 'Russian Grand Prix'}, {'name': 'Spanish Grand Prix'}, {'name': 'Monaco Grand Prix'}, {'name': 'Canadian Grand Prix'}, {'name': 'Azerbaijan Grand Prix'}, {'name': 'Austrian Grand Prix'}, {'name': 'British Grand Prix'}, {'name': 'Hungarian Grand Prix'}, {'name': 'Belgian Grand Prix'}, {'name': 'Italian Grand Prix'}, {'name': 'Singapore Grand Prix'}, {'name': 'Malaysian Grand Prix'}, {'name': 'Japanese Grand Prix'}, {'name': 'United States Grand Prix'}, {'name': 'Mexican Grand Prix'}, {'name': 'Brazilian Grand Prix'}, {'name': 'Abu Dhabi Grand Prix'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
network_2
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) )
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) /* 2 rows from Person table: name age city gender job Alice 25 new york city female student Bob 35 salt lake city male engineer */ CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) ) /* 2 rows from PersonFriend table: name friend year Alice Bob 10 Zach Dan 12 */
Find the name and age of all males in order of their age.
SELECT name FROM Person WHERE gender = 'male' ORDER BY age
[{'name': 'Bob'}, {'name': 'Zach'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]List the names and birth dates of people in ascending alphabetical order of name.[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]List the names and birth dates of people in ascending alphabetical order of name.[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]List the names and birth dates of people in ascending alphabetical order of name.[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]List the names and birth dates of people in ascending alphabetical order of name.[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
customer_deliveries
CREATE TABLE "Actual_Order_Products" ( actual_order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, FOREIGN KEY(actual_order_id) REFERENCES "Actual_Orders" (actual_order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Actual_Orders" ( actual_order_id INTEGER, order_status_code VARCHAR(10) NOT NULL, regular_order_id INTEGER NOT NULL, actual_order_date DATETIME, PRIMARY KEY (actual_order_id), FOREIGN KEY(regular_order_id) REFERENCES "Regular_Orders" (regular_order_id) ) CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, address_type VARCHAR(10) NOT NULL, date_to DATETIME, FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(10) NOT NULL, customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), date_became_customer DATETIME, PRIMARY KEY (customer_id) ) CREATE TABLE "Delivery_Route_Locations" ( location_code VARCHAR(10), route_id INTEGER NOT NULL, location_address_id INTEGER NOT NULL, location_name VARCHAR(50), PRIMARY KEY (location_code), FOREIGN KEY(route_id) REFERENCES "Delivery_Routes" (route_id), FOREIGN KEY(location_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Delivery_Routes" ( route_id INTEGER, route_name VARCHAR(50), other_route_details VARCHAR(255), PRIMARY KEY (route_id) ) CREATE TABLE "Employees" ( employee_id INTEGER, employee_address_id INTEGER NOT NULL, employee_name VARCHAR(80), employee_phone VARCHAR(80), PRIMARY KEY (employee_id), FOREIGN KEY(employee_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Order_Deliveries" ( location_code VARCHAR(10) NOT NULL, actual_order_id INTEGER NOT NULL, delivery_status_code VARCHAR(10) NOT NULL, driver_employee_id INTEGER NOT NULL, truck_id INTEGER NOT NULL, delivery_date DATETIME, FOREIGN KEY(driver_employee_id) REFERENCES "Employees" (employee_id), FOREIGN KEY(location_code) REFERENCES "Delivery_Route_Locations" (location_code), FOREIGN KEY(actual_order_id) REFERENCES "Actual_Orders" (actual_order_id), FOREIGN KEY(truck_id) REFERENCES "Trucks" (truck_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(20), product_price DECIMAL(19, 4), product_description VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Regular_Order_Products" ( regular_order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, FOREIGN KEY(regular_order_id) REFERENCES "Regular_Orders" (regular_order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Regular_Orders" ( regular_order_id INTEGER, distributer_id INTEGER NOT NULL, PRIMARY KEY (regular_order_id), FOREIGN KEY(distributer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Trucks" ( truck_id INTEGER, truck_licence_number VARCHAR(20), truck_details VARCHAR(255), PRIMARY KEY (truck_id) )
CREATE TABLE "Actual_Order_Products" ( actual_order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, FOREIGN KEY(actual_order_id) REFERENCES "Actual_Orders" (actual_order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Actual_Order_Products table: actual_order_id product_id 2 1 14 5 */ CREATE TABLE "Actual_Orders" ( actual_order_id INTEGER, order_status_code VARCHAR(10) NOT NULL, regular_order_id INTEGER NOT NULL, actual_order_date DATETIME, PRIMARY KEY (actual_order_id), FOREIGN KEY(regular_order_id) REFERENCES "Regular_Orders" (regular_order_id) ) /* 2 rows from Actual_Orders table: actual_order_id order_status_code regular_order_id actual_order_date 1 Success 8 2018-03-02 23:26:19 2 Cancel 15 2018-03-02 08:33:39 */ CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details city zip_postcode state_province_county country 1 92283 Lora Forges Suite 322 Mohrville 271 Nebraska USA 2 17135 Jaida Fork Suite 798 East Brody 940 Colorado USA */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, address_type VARCHAR(10) NOT NULL, date_to DATETIME, FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from address_type date_to 5 6 2016-09-06 19:23:46 House 2018-02-25 15:34:58 14 5 2016-12-21 03:49:54 House 2018-03-13 21:20:21 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(10) NOT NULL, customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), date_became_customer DATETIME, PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method customer_name customer_phone customer_email date_became_customer 1 Visa Ron Emard 1-382-503-5179x53639 [email protected] 2011-04-25 22:20:35 2 MasterCard Gabe Schroeder 1-728-537-4293x0885 [email protected] 2011-10-17 16:08:25 */ CREATE TABLE "Delivery_Route_Locations" ( location_code VARCHAR(10), route_id INTEGER NOT NULL, location_address_id INTEGER NOT NULL, location_name VARCHAR(50), PRIMARY KEY (location_code), FOREIGN KEY(route_id) REFERENCES "Delivery_Routes" (route_id), FOREIGN KEY(location_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Delivery_Route_Locations table: location_code route_id location_address_id location_name 27 City Rd 11 5 Labadie-Crooks 30 Sam Rd 7 13 VonRueden, Schmeler and Fay */ CREATE TABLE "Delivery_Routes" ( route_id INTEGER, route_name VARCHAR(50), other_route_details VARCHAR(255), PRIMARY KEY (route_id) ) /* 2 rows from Delivery_Routes table: route_id route_name other_route_details 1 Torphy Ltd 16893 Wilderman Terrace Port Lucasburgh, ND 55978-5550 2 Heidenreich Group 6534 Cheyenne Trace Suite 242 Koryburgh, PA 21391-9164 */ CREATE TABLE "Employees" ( employee_id INTEGER, employee_address_id INTEGER NOT NULL, employee_name VARCHAR(80), employee_phone VARCHAR(80), PRIMARY KEY (employee_id), FOREIGN KEY(employee_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Employees table: employee_id employee_address_id employee_name employee_phone 1 4 Kacie 716-650-2081 2 12 Dejuan 211.289.9042 */ CREATE TABLE "Order_Deliveries" ( location_code VARCHAR(10) NOT NULL, actual_order_id INTEGER NOT NULL, delivery_status_code VARCHAR(10) NOT NULL, driver_employee_id INTEGER NOT NULL, truck_id INTEGER NOT NULL, delivery_date DATETIME, FOREIGN KEY(driver_employee_id) REFERENCES "Employees" (employee_id), FOREIGN KEY(location_code) REFERENCES "Delivery_Route_Locations" (location_code), FOREIGN KEY(actual_order_id) REFERENCES "Actual_Orders" (actual_order_id), FOREIGN KEY(truck_id) REFERENCES "Trucks" (truck_id) ) /* 2 rows from Order_Deliveries table: location_code actual_order_id delivery_status_code driver_employee_id truck_id delivery_date 27 City Rd 11 Ready 6 11 2018-03-21 00:57:22 27 City Rd 1 On Road 4 10 2018-02-26 01:32:49 */ CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(20), product_price DECIMAL(19, 4), product_description VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_name product_price product_description 1 dvds 1322.7800 good condition 2 cloth 6402.0900 good condition */ CREATE TABLE "Regular_Order_Products" ( regular_order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, FOREIGN KEY(regular_order_id) REFERENCES "Regular_Orders" (regular_order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Regular_Order_Products table: regular_order_id product_id 5 3 2 3 */ CREATE TABLE "Regular_Orders" ( regular_order_id INTEGER, distributer_id INTEGER NOT NULL, PRIMARY KEY (regular_order_id), FOREIGN KEY(distributer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Regular_Orders table: regular_order_id distributer_id 1 12 2 15 */ CREATE TABLE "Trucks" ( truck_id INTEGER, truck_licence_number VARCHAR(20), truck_details VARCHAR(255), PRIMARY KEY (truck_id) ) /* 2 rows from Trucks table: truck_id truck_licence_number truck_details 1 58110 Frida 2 33822 Randy */
List the names of all routes in alphabetic order.
SELECT route_name FROM Delivery_Routes ORDER BY route_name
[{'route_name': 'Abshire Ltd'}, {'route_name': 'Adams, Macejkovic and Carroll'}, {'route_name': 'Brekke, Powlowski and Fritsch'}, {'route_name': 'Gerhold Inc'}, {'route_name': 'Gorczany Group'}, {'route_name': 'Grady, King and Price'}, {'route_name': 'Hegmann-Waters'}, {'route_name': 'Heidenreich Group'}, {'route_name': 'Hermiston, Feeney and Daugherty'}, {'route_name': 'Huel, Armstrong and Senger'}, {'route_name': 'Nader, Leuschke and Huels'}, {'route_name': 'Renner-Kovacek'}, {'route_name': 'Schowalter Group'}, {'route_name': 'Streich, Spencer and Brakus'}, {'route_name': 'Torphy Ltd'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.[/QUESTION] [SQL]SELECT flno , origin , destination FROM Flight ORDER BY origin[/SQL]
[QUESTION]Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.[/QUESTION] [SQL]SELECT flno , origin , destination FROM Flight ORDER BY origin[/SQL]
[QUESTION]Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.[/QUESTION] [SQL]SELECT flno , origin , destination FROM Flight ORDER BY origin[/SQL]
[QUESTION]Show flight number, origin, destination of all flights in the alphabetical order of the departure cities.[/QUESTION] [SQL]SELECT flno , origin , destination FROM Flight ORDER BY origin[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what states have towns named springfield
SELECT state_name FROM city WHERE city_name = "springfield";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
Show me some recent papers on deep learning ?
SELECT DISTINCT t3.paperid , t3.year FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid WHERE t1.keyphrasename = "deep learning" ORDER BY t3.year DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
false
false
false
true
false
false
false
false
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
What are the distinct names of products purchased by at least two different customers?
SELECT DISTINCT T3.product_name FROM customer_orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id JOIN products AS T3 ON T2.product_id = T3.product_id GROUP BY T3.product_id HAVING COUNT (DISTINCT T1.customer_id) >= 2
[{'product_name': 'blue jeans'}, {'product_name': 'monitor'}, {'product_name': 'keyboard'}]
Hard
true
false
false
false
false
true
true
false
true
false
false
false
false
[QUESTION]What are the minimum and maximum number of products across all the shops?[/QUESTION] [SQL]SELECT min(Number_products) , max(Number_products) FROM shop[/SQL]
[QUESTION]What are the minimum and maximum number of products across all the shops?[/QUESTION] [SQL]SELECT min(Number_products) , max(Number_products) FROM shop[/SQL]
[QUESTION]What are the minimum and maximum number of products across all the shops?[/QUESTION] [SQL]SELECT min(Number_products) , max(Number_products) FROM shop[/SQL]
wrestler
CREATE TABLE "Elimination" ( "Elimination_ID" TEXT, "Wrestler_ID" TEXT, "Team" TEXT, "Eliminated_By" TEXT, "Elimination_Move" TEXT, "Time" TEXT, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY("Wrestler_ID") REFERENCES wrestler ("Wrestler_ID") ) CREATE TABLE wrestler ( "Wrestler_ID" INTEGER, "Name" TEXT, "Reign" TEXT, "Days_held" TEXT, "Location" TEXT, "Event" TEXT, PRIMARY KEY ("Wrestler_ID") )
CREATE TABLE "Elimination" ( "Elimination_ID" TEXT, "Wrestler_ID" TEXT, "Team" TEXT, "Eliminated_By" TEXT, "Elimination_Move" TEXT, "Time" TEXT, PRIMARY KEY ("Elimination_ID"), FOREIGN KEY("Wrestler_ID") REFERENCES wrestler ("Wrestler_ID") ) /* 2 rows from Elimination table: Elimination_ID Wrestler_ID Team Eliminated_By Elimination_Move Time 1 1 Team Orton Punk Go To Sleep 00:11 2 2 Team Batista Benjamin Paydirt 07:38 */ CREATE TABLE wrestler ( "Wrestler_ID" INTEGER, "Name" TEXT, "Reign" TEXT, "Days_held" TEXT, "Location" TEXT, "Event" TEXT, PRIMARY KEY ("Wrestler_ID") ) /* 2 rows from wrestler table: Wrestler_ID Name Reign Days_held Location Event 1 Rey Misterio Sr. 1 344 Tijuana , Mexico Live event 2 Fishman 1 113 Tijuana , Mexico Live event */
What are the names and location of the wrestlers?
SELECT Name , LOCATION FROM wrestler
[{'Name': 'Rey Misterio Sr.', 'Location': 'Tijuana , Mexico'}, {'Name': 'Fishman', 'Location': 'Tijuana , Mexico'}, {'Name': 'Villaño IV', 'Location': 'Tijuana , Mexico'}, {'Name': 'Gran Hamada', 'Location': 'Tokyo , Japan'}, {'Name': 'El Samurai', 'Location': 'Tokyo , Japan'}, {'Name': 'The Great Sasuke §', 'Location': 'Tokyo , Japan'}, {'Name': 'Último Dragón §', 'Location': 'Osaka , Japan'}, {'Name': 'Jushin Liger §', 'Location': 'Tokyo , Japan'}, {'Name': 'El Samurai §', 'Location': 'Sapporo , Japan'}, {'Name': 'Shinjiro Otani §', 'Location': 'Nagoya , Japan'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
dorm_1
CREATE TABLE "Dorm" ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE "Dorm_amenity" ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE "Has_amenity" ( dormid INTEGER, amenid INTEGER, FOREIGN KEY(amenid) REFERENCES "Dorm_amenity" (amenid), FOREIGN KEY(dormid) REFERENCES "Dorm" (dormid) ) CREATE TABLE "Lives_in" ( stuid INTEGER, dormid INTEGER, room_number INTEGER, FOREIGN KEY(dormid) REFERENCES "Dorm" (dormid), FOREIGN KEY(stuid) REFERENCES "Student" ("StuID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Dorm" ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) /* 2 rows from Dorm table: dormid dorm_name student_capacity gender 100 Smith Hall 85 X 110 Bud Jones Hall 116 M */ CREATE TABLE "Dorm_amenity" ( amenid INTEGER, amenity_name VARCHAR(25) ) /* 2 rows from Dorm_amenity table: amenid amenity_name 900 TV Lounge 901 Study Room */ CREATE TABLE "Has_amenity" ( dormid INTEGER, amenid INTEGER, FOREIGN KEY(amenid) REFERENCES "Dorm_amenity" (amenid), FOREIGN KEY(dormid) REFERENCES "Dorm" (dormid) ) /* 2 rows from Has_amenity table: dormid amenid 109 900 109 901 */ CREATE TABLE "Lives_in" ( stuid INTEGER, dormid INTEGER, room_number INTEGER, FOREIGN KEY(dormid) REFERENCES "Dorm" (dormid), FOREIGN KEY(stuid) REFERENCES "Student" ("StuID") ) /* 2 rows from Lives_in table: stuid dormid room_number 1001 109 105 1002 100 112 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
What is the average age for each dorm and what are the names of each dorm?
SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name
[{'avg(T1.age)': 19.666666666666668, 'dorm_name': 'Anonymous Donor Hall'}, {'avg(T1.age)': 20.0, 'dorm_name': 'Bud Jones Hall'}, {'avg(T1.age)': 19.6, 'dorm_name': 'Dorm-plex 2000'}, {'avg(T1.age)': 19.77777777777778, 'dorm_name': 'Fawlty Towers'}, {'avg(T1.age)': 18.0, 'dorm_name': 'Grad Student Asylum'}, {'avg(T1.age)': 20.166666666666668, 'dorm_name': 'Smith Hall'}, {'avg(T1.age)': 18.0, 'dorm_name': 'University Hovels'}]
Hard
false
false
false
false
false
true
false
false
true
false
false
false
false
[QUESTION]What are the names and grades for each high schooler?[/QUESTION] [SQL]SELECT name , grade FROM Highschooler[/SQL]
soccer_2
CREATE TABLE "College" ( "cName" VARCHAR(20) NOT NULL, state VARCHAR(2), enr NUMERIC(5, 0), PRIMARY KEY ("cName") ) CREATE TABLE "Player" ( "pID" NUMERIC(5, 0) NOT NULL, "pName" VARCHAR(20), "yCard" VARCHAR(3), "HS" NUMERIC(5, 0), PRIMARY KEY ("pID") ) CREATE TABLE "Tryout" ( "pID" NUMERIC(5, 0), "cName" VARCHAR(20), "pPos" VARCHAR(8), decision VARCHAR(3), PRIMARY KEY ("pID", "cName"), FOREIGN KEY("pID") REFERENCES "Player" ("pID"), FOREIGN KEY("cName") REFERENCES "College" ("cName") )
CREATE TABLE "College" ( "cName" VARCHAR(20) NOT NULL, state VARCHAR(2), enr NUMERIC(5, 0), PRIMARY KEY ("cName") ) /* 2 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 */ CREATE TABLE "Player" ( "pID" NUMERIC(5, 0) NOT NULL, "pName" VARCHAR(20), "yCard" VARCHAR(3), "HS" NUMERIC(5, 0), PRIMARY KEY ("pID") ) /* 2 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 */ CREATE TABLE "Tryout" ( "pID" NUMERIC(5, 0), "cName" VARCHAR(20), "pPos" VARCHAR(8), decision VARCHAR(3), PRIMARY KEY ("pID", "cName"), FOREIGN KEY("pID") REFERENCES "Player" ("pID"), FOREIGN KEY("cName") REFERENCES "College" ("cName") ) /* 2 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes */
Find the state of the college which player Charles is attending.
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles'
[{'state': 'OK'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
party_people
CREATE TABLE member ( "Member_ID" INTEGER, "Member_Name" TEXT, "Party_ID" TEXT, "In_office" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) CREATE TABLE party ( "Party_ID" INTEGER, "Minister" TEXT, "Took_office" TEXT, "Left_office" TEXT, "Region_ID" INTEGER, "Party_name" TEXT, PRIMARY KEY ("Party_ID"), FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID") ) CREATE TABLE party_events ( "Event_ID" INTEGER, "Event_Name" TEXT, "Party_ID" INTEGER, "Member_in_charge_ID" INTEGER, PRIMARY KEY ("Event_ID"), FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) CREATE TABLE region ( "Region_ID" INTEGER, "Region_name" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT, PRIMARY KEY ("Region_ID") )
CREATE TABLE member ( "Member_ID" INTEGER, "Member_Name" TEXT, "Party_ID" TEXT, "In_office" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) /* 2 rows from member table: Member_ID Member_Name Party_ID In_office 1 Hon Tony Abbott 3 1994–present 2 Hon Dick Adams 2 1993–2013 */ CREATE TABLE party ( "Party_ID" INTEGER, "Minister" TEXT, "Took_office" TEXT, "Left_office" TEXT, "Region_ID" INTEGER, "Party_name" TEXT, PRIMARY KEY ("Party_ID"), FOREIGN KEY("Region_ID") REFERENCES region ("Region_ID") ) /* 2 rows from party table: Party_ID Minister Took_office Left_office Region_ID Party_name 1 Dr. Kwame Nkrumah (MP) 1957 1958 1 Convention Peoples Party 2 Kojo Botsio (MP) 1958 1959 2 Progress Party */ CREATE TABLE party_events ( "Event_ID" INTEGER, "Event_Name" TEXT, "Party_ID" INTEGER, "Member_in_charge_ID" INTEGER, PRIMARY KEY ("Event_ID"), FOREIGN KEY("Member_in_charge_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID") ) /* 2 rows from party_events table: Event_ID Event_Name Party_ID Member_in_charge_ID 1 Annaual Meeting 1 4 2 Conference 1 12 */ CREATE TABLE region ( "Region_ID" INTEGER, "Region_name" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue" TEXT, PRIMARY KEY ("Region_ID") ) /* 2 rows from region table: Region_ID Region_name Date Label Format Catalogue 1 United Kingdom 1 July 2002 Parlophone CD 540 3622 2 United Kingdom 1 July 2002 Parlophone 2× LP 539 9821 */
Which ministers are not a part of the Progress Party?
SELECT minister FROM party WHERE party_name != 'Progress Party'
[{'Minister': 'Dr. Kwame Nkrumah (MP)'}, {'Minister': 'Ebenezer Ako-Adjei (MP)'}, {'Minister': 'Imoru Egala (MP)'}, {'Minister': 'Ebenezer Ako-Adjei (MP)'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
ship_mission
CREATE TABLE mission ( "Mission_ID" INTEGER, "Ship_ID" INTEGER, "Code" TEXT, "Launched_Year" INTEGER, "Location" TEXT, "Speed_knots" INTEGER, "Fate" TEXT, PRIMARY KEY ("Mission_ID"), FOREIGN KEY("Ship_ID") REFERENCES ship ("Ship_ID") ) CREATE TABLE ship ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Nationality" TEXT, "Tonnage" INTEGER, PRIMARY KEY ("Ship_ID") )
CREATE TABLE mission ( "Mission_ID" INTEGER, "Ship_ID" INTEGER, "Code" TEXT, "Launched_Year" INTEGER, "Location" TEXT, "Speed_knots" INTEGER, "Fate" TEXT, PRIMARY KEY ("Mission_ID"), FOREIGN KEY("Ship_ID") REFERENCES ship ("Ship_ID") ) /* 2 rows from mission table: Mission_ID Ship_ID Code Launched_Year Location Speed_knots Fate 1 1 VMV-1 1930 Germany 25 Decommissioned 1950 2 2 VMV-2 1930 Germany 25 Decommissioned 1950 */ CREATE TABLE ship ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Nationality" TEXT, "Tonnage" INTEGER, PRIMARY KEY ("Ship_ID") ) /* 2 rows from ship table: Ship_ID Name Type Nationality Tonnage 1 Corbridge Cargo ship United Kingdom 3687 2 Farringford Battle ship United States 3146 */
What are the mission codes, fates, and names of the ships involved?
SELECT T1.Code , T1.Fate , T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID
[{'Code': 'VMV-1', 'Fate': 'Decommissioned 1950', 'Name': 'Corbridge'}, {'Code': 'VMV-2', 'Fate': 'Decommissioned 1950', 'Name': 'Farringford'}, {'Code': 'VMV-3', 'Fate': 'Lost (burned) 1931', 'Name': 'Dromonby'}, {'Code': 'VMV-4 Former: Sterling', 'Fate': 'Retired 1939', 'Name': 'Trader'}, {'Code': 'VMV-5', 'Fate': 'Decommissioned 1959', 'Name': 'Ariadne'}, {'Code': 'VMV-6', 'Fate': 'Decommissioned 1960', 'Name': 'Appam'}, {'Code': 'VMV-7', 'Fate': 'Lost (burned and sunk) 1933', 'Name': 'Clan McTavish'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
news_report
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") )
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) /* 2 rows from event table: Event_ID Date Venue Name Event_Attendance 1 13 October 2008 Marathon Olympia Games Openning 6650 2 11 October 2007 Victoria Government Hearing 369 */ CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) /* 2 rows from journalist table: journalist_ID Name Nationality Age Years_working 1 Herbert Swindells England 37 10 2 Fred Keenor Wales 27 5 */ CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") ) /* 2 rows from news_report table: journalist_ID Event_ID Work_Type 1 3 Screening 11 5 Screening */
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3
[{'Nationality': 'England'}]
Hard
false
false
false
false
false
false
false
false
false
false
true
false
false
college_3
CREATE TABLE "Course" ( "CID" VARCHAR(7), "CName" VARCHAR(40), "Credits" INTEGER, "Instructor" INTEGER, "Days" VARCHAR(5), "Hours" VARCHAR(11), "DNO" INTEGER, PRIMARY KEY ("CID"), FOREIGN KEY("Instructor") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Department" ( "DNO" INTEGER, "Division" VARCHAR(2), "DName" VARCHAR(25), "Room" VARCHAR(5), "Building" VARCHAR(13), "DPhone" INTEGER, PRIMARY KEY ("DNO") ) CREATE TABLE "Enrolled_in" ( "StuID" INTEGER, "CID" VARCHAR(7), "Grade" VARCHAR(2), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("CID") REFERENCES "Course" ("CID"), FOREIGN KEY("Grade") REFERENCES "Gradeconversion" (lettergrade) ) CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) CREATE TABLE "Gradeconversion" ( lettergrade VARCHAR(2), gradepoint FLOAT, PRIMARY KEY (lettergrade) ) CREATE TABLE "Member_of" ( "FacID" INTEGER, "DNO" INTEGER, "Appt_Type" VARCHAR(15), FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Minor_in" ( "StuID" INTEGER, "DNO" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Course" ( "CID" VARCHAR(7), "CName" VARCHAR(40), "Credits" INTEGER, "Instructor" INTEGER, "Days" VARCHAR(5), "Hours" VARCHAR(11), "DNO" INTEGER, PRIMARY KEY ("CID"), FOREIGN KEY("Instructor") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Course table: CID CName Credits Instructor Days Hours DNO 600.101 COMPUTER LITERACY 3 6112 MTW 3 600 600.103 INTRODUCTION TO COMPUTER SCIENCE 1 4230 Th 4 600 */ CREATE TABLE "Department" ( "DNO" INTEGER, "Division" VARCHAR(2), "DName" VARCHAR(25), "Room" VARCHAR(5), "Building" VARCHAR(13), "DPhone" INTEGER, PRIMARY KEY ("DNO") ) /* 2 rows from Department table: DNO Division DName Room Building DPhone 10 AS History of Art 268 Mergenthaler 7117 20 AS Biology 144 Mudd 7330 */ CREATE TABLE "Enrolled_in" ( "StuID" INTEGER, "CID" VARCHAR(7), "Grade" VARCHAR(2), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("CID") REFERENCES "Course" ("CID"), FOREIGN KEY("Grade") REFERENCES "Gradeconversion" (lettergrade) ) /* 2 rows from Enrolled_in table: StuID CID Grade 1001 550.681 A- 1001 600.303 B */ CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) /* 2 rows from Faculty table: FacID Lname Fname Rank Sex Phone Room Building 1082 Giuliano Mark Instructor M 2424 224 NEB 1121 Goodrich Michael Professor M 3593 219 NEB */ CREATE TABLE "Gradeconversion" ( lettergrade VARCHAR(2), gradepoint FLOAT, PRIMARY KEY (lettergrade) ) /* 2 rows from Gradeconversion table: lettergrade gradepoint A+ 4.0 A 4.0 */ CREATE TABLE "Member_of" ( "FacID" INTEGER, "DNO" INTEGER, "Appt_Type" VARCHAR(15), FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Member_of table: FacID DNO Appt_Type 7792 600 Primary 9210 520 Primary */ CREATE TABLE "Minor_in" ( "StuID" INTEGER, "DNO" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("DNO") REFERENCES "Department" ("DNO") ) /* 2 rows from Minor_in table: StuID DNO 1004 520 1005 550 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
Give the phones for departments in room 268.
SELECT DPhone FROM DEPARTMENT WHERE Room = 268
[{'DPhone': 7117}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
products_for_hire
CREATE TABLE "Bookings" ( booking_id INTEGER, customer_id INTEGER NOT NULL, booking_status_code VARCHAR(10) NOT NULL, returned_damaged_yn VARCHAR(40), booking_start_date DATETIME, booking_end_date DATETIME, count_hired VARCHAR(40), amount_payable DECIMAL(19, 4), amount_of_discount DECIMAL(19, 4), amount_outstanding DECIMAL(19, 4), amount_of_refund DECIMAL(19, 4), PRIMARY KEY (booking_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, coupon_id INTEGER NOT NULL, good_or_bad_customer VARCHAR(4), first_name VARCHAR(80), last_name VARCHAR(80), gender_mf VARCHAR(1), date_became_customer DATETIME, date_last_hire DATETIME, PRIMARY KEY (customer_id), FOREIGN KEY(coupon_id) REFERENCES "Discount_Coupons" (coupon_id) ) CREATE TABLE "Discount_Coupons" ( coupon_id INTEGER, date_issued DATETIME, coupon_amount DECIMAL(19, 4), PRIMARY KEY (coupon_id) ) CREATE TABLE "Payments" ( payment_id INTEGER, booking_id INTEGER, customer_id INTEGER NOT NULL, payment_type_code VARCHAR(15) NOT NULL, amount_paid_in_full_yn VARCHAR(1), payment_date DATETIME, amount_due DECIMAL(19, 4), amount_paid DECIMAL(19, 4), PRIMARY KEY (payment_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) ) CREATE TABLE "Products_Booked" ( booking_id INTEGER NOT NULL, product_id INTEGER NOT NULL, returned_yn VARCHAR(1), returned_late_yn VARCHAR(1), booked_count INTEGER, booked_amount FLOAT, PRIMARY KEY (booking_id, product_id), FOREIGN KEY(product_id) REFERENCES "Products_for_Hire" (product_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) ) CREATE TABLE "Products_for_Hire" ( product_id INTEGER, product_type_code VARCHAR(15) NOT NULL, daily_hire_cost DECIMAL(19, 4), product_name VARCHAR(80), product_description VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "View_Product_Availability" ( product_id INTEGER NOT NULL, booking_id INTEGER NOT NULL, status_date DATETIME, available_yn VARCHAR(1), PRIMARY KEY (status_date), FOREIGN KEY(product_id) REFERENCES "Products_for_Hire" (product_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) )
CREATE TABLE "Bookings" ( booking_id INTEGER, customer_id INTEGER NOT NULL, booking_status_code VARCHAR(10) NOT NULL, returned_damaged_yn VARCHAR(40), booking_start_date DATETIME, booking_end_date DATETIME, count_hired VARCHAR(40), amount_payable DECIMAL(19, 4), amount_of_discount DECIMAL(19, 4), amount_outstanding DECIMAL(19, 4), amount_of_refund DECIMAL(19, 4), PRIMARY KEY (booking_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Bookings table: booking_id customer_id booking_status_code returned_damaged_yn booking_start_date booking_end_date count_hired amount_payable amount_of_discount amount_outstanding amount_of_refund 1 7 Provisional 1 2016-12-07 23:39:17 2018-02-01 16:39:13 298 214.3900 71.4500 28.2200 179.1400 2 15 Confirmed 1 2017-06-16 11:42:31 2018-02-19 21:53:31 331 386.9200 83.8200 57.6200 183.6800 */ CREATE TABLE "Customers" ( customer_id INTEGER, coupon_id INTEGER NOT NULL, good_or_bad_customer VARCHAR(4), first_name VARCHAR(80), last_name VARCHAR(80), gender_mf VARCHAR(1), date_became_customer DATETIME, date_last_hire DATETIME, PRIMARY KEY (customer_id), FOREIGN KEY(coupon_id) REFERENCES "Discount_Coupons" (coupon_id) ) /* 2 rows from Customers table: customer_id coupon_id good_or_bad_customer first_name last_name gender_mf date_became_customer date_last_hire 1 12 good Geovany Homenick 0 2017-10-20 12:13:17 2018-02-27 18:55:26 2 14 good Jailyn Gerlach 0 2015-04-06 21:18:37 2018-01-30 04:47:13 */ CREATE TABLE "Discount_Coupons" ( coupon_id INTEGER, date_issued DATETIME, coupon_amount DECIMAL(19, 4), PRIMARY KEY (coupon_id) ) /* 2 rows from Discount_Coupons table: coupon_id date_issued coupon_amount 1 2017-09-06 01:33:27 500.0000 2 2018-02-20 09:40:56 686.2500 */ CREATE TABLE "Payments" ( payment_id INTEGER, booking_id INTEGER, customer_id INTEGER NOT NULL, payment_type_code VARCHAR(15) NOT NULL, amount_paid_in_full_yn VARCHAR(1), payment_date DATETIME, amount_due DECIMAL(19, 4), amount_paid DECIMAL(19, 4), PRIMARY KEY (payment_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) ) /* 2 rows from Payments table: payment_id booking_id customer_id payment_type_code amount_paid_in_full_yn payment_date amount_due amount_paid 1 6 15 Check 1 2018-03-09 16:28:00 369.5200 206.2700 2 9 12 Cash 1 2018-03-03 13:39:44 278.6000 666.4500 */ CREATE TABLE "Products_Booked" ( booking_id INTEGER NOT NULL, product_id INTEGER NOT NULL, returned_yn VARCHAR(1), returned_late_yn VARCHAR(1), booked_count INTEGER, booked_amount FLOAT, PRIMARY KEY (booking_id, product_id), FOREIGN KEY(product_id) REFERENCES "Products_for_Hire" (product_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) ) /* 2 rows from Products_Booked table: booking_id product_id returned_yn returned_late_yn booked_count booked_amount 4 1 1 1 5 309.73 14 1 1 0 3 102.76 */ CREATE TABLE "Products_for_Hire" ( product_id INTEGER, product_type_code VARCHAR(15) NOT NULL, daily_hire_cost DECIMAL(19, 4), product_name VARCHAR(80), product_description VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products_for_Hire table: product_id product_type_code daily_hire_cost product_name product_description 1 Cutlery 26.1500 Book collection C Anna Karenina 2 Cutlery 15.6200 Book collection B War and Peace */ CREATE TABLE "View_Product_Availability" ( product_id INTEGER NOT NULL, booking_id INTEGER NOT NULL, status_date DATETIME, available_yn VARCHAR(1), PRIMARY KEY (status_date), FOREIGN KEY(product_id) REFERENCES "Products_for_Hire" (product_id), FOREIGN KEY(booking_id) REFERENCES "Bookings" (booking_id) ) /* 2 rows from View_Product_Availability table: product_id booking_id status_date available_yn 1 5 2018-03-18 05:25:55 1 2 5 2018-03-21 15:20:32 0 */
How many bookings did each customer make? List the customer id, first name, and the count.
SELECT T1.customer_id , T1.first_name , count(*) FROM Customers AS T1 JOIN bookings AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
[{'customer_id': 3, 'first_name': 'Rosalee', 'count(*)': 4}, {'customer_id': 7, 'first_name': 'Marilou', 'count(*)': 3}, {'customer_id': 8, 'first_name': 'Elinore', 'count(*)': 2}, {'customer_id': 9, 'first_name': 'German', 'count(*)': 2}, {'customer_id': 10, 'first_name': 'Layne', 'count(*)': 2}, {'customer_id': 11, 'first_name': 'Maximilian', 'count(*)': 1}, {'customer_id': 15, 'first_name': 'Jamir', 'count(*)': 1}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
[QUESTION]What is the total number of customers across banks?[/QUESTION] [SQL]SELECT sum(no_of_customers) FROM bank[/SQL]
[QUESTION]What is the total number of customers across banks?[/QUESTION] [SQL]SELECT sum(no_of_customers) FROM bank[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
who publishes papers about sensor fusion
SELECT DISTINCT t1.authorname FROM paperkeyphrase AS t2 JOIN keyphrase AS t4 ON t2.keyphraseid = t4.keyphraseid JOIN writes AS t3 ON t3.paperid = t2.paperid JOIN author AS t1 ON t3.authorid = t1.authorid WHERE t4.keyphrasename LIKE "sensor fusion";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
true
false
false
false
false
false
false
true
false
false
false
false
student_assessment
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) )
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1 line_2 city zip_postcode state_province_county country 5 0900 Roderick Oval New Albina, WA 19200-7914 Suite 096 Linnealand 862 Montana USA 9 966 Dach Ports Apt. 322 Lake Harmonyhaven, VA 65235 Apt. 163 South Minnie 716 Texas USA */ CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) /* 2 rows from Candidate_Assessments table: candidate_id qualification assessment_date asessment_outcome_code 111 A 2010-04-07 11:44:34 Pass 121 B 2010-04-17 11:44:34 Pass */ CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) /* 2 rows from Candidates table: candidate_id candidate_details 111 Jane 121 Robert */ CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) /* 2 rows from Courses table: course_id course_name course_description other_details 301 statistics statistics None 302 English English None */ CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) /* 2 rows from People table: person_id first_name middle_name last_name cell_mobile_number email_address login_name password 111 Shannon Elissa Senger 01955267735 [email protected] pgub 5e4ff49a61b3544da3ad7dc7e2cf28847564c64c 121 Virginie Jasmin Hartmann (508)319-2970x043 [email protected] bkkv b063331ea8116befaa7b84c59c6a22200f5f8caa */ CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from People_Addresses table: person_address_id person_id address_id date_from date_to 122 111 9 2012-09-26 13:21:00 2018-03-21 09:46:30 257 121 5 2008-07-31 02:17:25 2018-03-09 02:11:12 */ CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) /* 2 rows from Student_Course_Attendance table: student_id course_id date_of_attendance 111 301 2008-11-04 10:35:13 121 301 2012-04-09 11:44:34 */ CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Registrations table: student_id course_id registration_date 111 301 2008-11-04 10:35:13 121 301 2008-10-04 10:35:13 */ CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) ) /* 2 rows from Students table: student_id student_details 111 Marry 121 Martin */
How many courses do the student whose id is 171 attend?
SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
[{'count(*)': 1}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]How many students enrolled in class ACCT-211?[/QUESTION] [SQL]SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]How many students enrolled in class ACCT-211?[/QUESTION] [SQL]SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]How many students enrolled in class ACCT-211?[/QUESTION] [SQL]SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]How many students enrolled in class ACCT-211?[/QUESTION] [SQL]SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code WHERE T1.crs_code = 'ACCT-211'[/SQL]
store_1
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) )
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) /* 2 rows from albums table: id title artist_id 1 For Those About To Rock We Salute You 1 2 Balls to the Wall 2 */ CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from artists table: id name 1 AC/DC 2 Accept */ CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) /* 2 rows from customers table: id first_name last_name company address city state country postal_code phone fax email support_rep_id 1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 [email protected] 3 2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None [email protected] 5 */ CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) /* 2 rows from employees table: id last_name first_name title reports_to birth_date hire_date address city state country postal_code phone fax email 1 Adams Andrew General Manager None 1962-02-18 00:00:00 2002-08-14 00:00:00 11120 Jasper Ave NW Edmonton AB Canada T5K 2N1 +1 (780) 428-9482 +1 (780) 428-3457 [email protected] 2 Edwards Nancy Sales Manager 1 1958-12-08 00:00:00 2002-05-01 00:00:00 825 8 Ave SW Calgary AB Canada T2P 2T3 +1 (403) 262-3443 +1 (403) 262-3322 [email protected] */ CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from genres table: id name 1 Rock 2 Jazz */ CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from invoice_lines table: id invoice_id track_id unit_price quantity 1 1 2 0.99 1 2 1 4 0.99 1 */ CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) /* 2 rows from invoices table: id customer_id invoice_date billing_address billing_city billing_state billing_country billing_postal_code total 1 2 2007-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98 2 4 2007-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96 */ CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from media_types table: id name 1 MPEG audio file 2 Protected AAC audio file */ CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from playlist_tracks table: playlist_id track_id 1 3402 1 3389 */ CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from playlists table: id name 1 Music 2 Movies */ CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) ) /* 2 rows from tracks table: id name album_id media_type_id genre_id composer milliseconds bytes unit_price 1 For Those About To Rock (We Salute You) 1 1 1 Angus Young, Malcolm Young, Brian Johnson 343719 11170334 0.99 2 Balls to the Wall 2 2 1 None 342562 5510424 0.99 */
Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.
SELECT T2.first_name , T2.last_name , count(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY count(T1.reports_to) DESC LIMIT 1;
[{'first_name': 'Nancy', 'last_name': 'Edwards', 'count(T1.reports_to)': 3}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]Find the count and code of the job has most employees.[/QUESTION] [SQL]SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Find the count and code of the job has most employees.[/QUESTION] [SQL]SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Find the count and code of the job has most employees.[/QUESTION] [SQL]SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Find the count and code of the job has most employees.[/QUESTION] [SQL]SELECT emp_jobcode , count(*) FROM employee GROUP BY emp_jobcode ORDER BY count(*) DESC LIMIT 1[/SQL]
news_report
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") )
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) /* 2 rows from event table: Event_ID Date Venue Name Event_Attendance 1 13 October 2008 Marathon Olympia Games Openning 6650 2 11 October 2007 Victoria Government Hearing 369 */ CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) /* 2 rows from journalist table: journalist_ID Name Nationality Age Years_working 1 Herbert Swindells England 37 10 2 Fred Keenor Wales 27 5 */ CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") ) /* 2 rows from news_report table: journalist_ID Event_ID Work_Type 1 3 Screening 11 5 Screening */
what are the average and maximum attendances of all events?
SELECT avg(Event_Attendance) , max(Event_Attendance) FROM event
[{'avg(Event_Attendance)': 2255.0, 'max(Event_Attendance)': 6650}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the average attendance of shows?[/QUESTION] [SQL]SELECT avg(Attendance) FROM SHOW[/SQL]
[QUESTION]What is the average attendance of shows?[/QUESTION] [SQL]SELECT avg(Attendance) FROM SHOW[/SQL]
[QUESTION]What is the average attendance of shows?[/QUESTION] [SQL]SELECT avg(Attendance) FROM SHOW[/SQL]
[QUESTION]What is the average attendance of shows?[/QUESTION] [SQL]SELECT avg(Attendance) FROM SHOW[/SQL]
storm_record
CREATE TABLE affected_region ( "Region_id" INTEGER, "Storm_ID" INTEGER, "Number_city_affected" REAL, PRIMARY KEY ("Region_id", "Storm_ID"), FOREIGN KEY("Storm_ID") REFERENCES storm ("Storm_ID"), FOREIGN KEY("Region_id") REFERENCES region ("Region_id") ) CREATE TABLE region ( "Region_id" INTEGER, "Region_code" TEXT, "Region_name" TEXT, PRIMARY KEY ("Region_id") ) CREATE TABLE storm ( "Storm_ID" INTEGER, "Name" TEXT, "Dates_active" TEXT, "Max_speed" INTEGER, "Damage_millions_USD" REAL, "Number_Deaths" INTEGER, PRIMARY KEY ("Storm_ID") )
CREATE TABLE affected_region ( "Region_id" INTEGER, "Storm_ID" INTEGER, "Number_city_affected" REAL, PRIMARY KEY ("Region_id", "Storm_ID"), FOREIGN KEY("Storm_ID") REFERENCES storm ("Storm_ID"), FOREIGN KEY("Region_id") REFERENCES region ("Region_id") ) /* 2 rows from affected_region table: Region_id Storm_ID Number_city_affected 1 1 10.0 2 1 15.0 */ CREATE TABLE region ( "Region_id" INTEGER, "Region_code" TEXT, "Region_name" TEXT, PRIMARY KEY ("Region_id") ) /* 2 rows from region table: Region_id Region_code Region_name 1 AF Afghanistan 2 AL Albania */ CREATE TABLE storm ( "Storm_ID" INTEGER, "Name" TEXT, "Dates_active" TEXT, "Max_speed" INTEGER, "Damage_millions_USD" REAL, "Number_Deaths" INTEGER, PRIMARY KEY ("Storm_ID") ) /* 2 rows from storm table: Storm_ID Name Dates_active Max_speed Damage_millions_USD Number_Deaths 1 One May19–May25 995 13.0 0 2 Two August3–August10 972 10.75 7 */
What are the names and damage in millions for storms, ordered by their max speeds descending?
SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC
[{'Name': 'Nine', 'Damage_millions_USD': 13.0}, {'Name': 'Six', 'Damage_millions_USD': 0.039}, {'Name': 'One', 'Damage_millions_USD': 13.0}, {'Name': 'Five', 'Damage_millions_USD': 1.49}, {'Name': 'Eight', 'Damage_millions_USD': 13.0}, {'Name': 'Seven', 'Damage_millions_USD': 13.0}, {'Name': 'Two', 'Damage_millions_USD': 10.75}, {'Name': 'Three', 'Damage_millions_USD': 13.0}, {'Name': 'Four', 'Damage_millions_USD': 4.05}, {'Name': '9 cyclones', 'Damage_millions_USD': 29.3}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
film_rank
CREATE TABLE film ( "Film_ID" INTEGER, "Title" TEXT, "Studio" TEXT, "Director" TEXT, "Gross_in_dollar" INTEGER, PRIMARY KEY ("Film_ID") ) CREATE TABLE film_market_estimation ( "Estimation_ID" INTEGER, "Low_Estimate" REAL, "High_Estimate" REAL, "Film_ID" INTEGER, "Type" TEXT, "Market_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Estimation_ID"), FOREIGN KEY("Film_ID") REFERENCES film ("Film_ID"), FOREIGN KEY("Market_ID") REFERENCES market ("Market_ID") ) CREATE TABLE market ( "Market_ID" INTEGER, "Country" TEXT, "Number_cities" INTEGER, PRIMARY KEY ("Market_ID") )
CREATE TABLE film ( "Film_ID" INTEGER, "Title" TEXT, "Studio" TEXT, "Director" TEXT, "Gross_in_dollar" INTEGER, PRIMARY KEY ("Film_ID") ) /* 2 rows from film table: Film_ID Title Studio Director Gross_in_dollar 1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554 2 Tootsie Columbia Sydney Pollack 177200000 */ CREATE TABLE film_market_estimation ( "Estimation_ID" INTEGER, "Low_Estimate" REAL, "High_Estimate" REAL, "Film_ID" INTEGER, "Type" TEXT, "Market_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Estimation_ID"), FOREIGN KEY("Film_ID") REFERENCES film ("Film_ID"), FOREIGN KEY("Market_ID") REFERENCES market ("Market_ID") ) /* 2 rows from film_market_estimation table: Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year 1 80000.0 80400.0 1 Mass suicide murder 1 1945 2 8000.0 8000.0 2 Mass suicide 2 1944 */ CREATE TABLE market ( "Market_ID" INTEGER, "Country" TEXT, "Number_cities" INTEGER, PRIMARY KEY ("Market_ID") ) /* 2 rows from market table: Market_ID Country Number_cities 1 Japan 209 2 China 540 */
What are the names of studios that have produced films with both Nicholas Meyer and Walter Hill?
SELECT Studio FROM film WHERE Director = "Nicholas Meyer" INTERSECT SELECT Studio FROM film WHERE Director = "Walter Hill"
[{'Studio': 'Paramount'}]
Hard
false
false
false
false
false
false
false
false
false
false
true
false
false
cre_Docs_and_Epenses
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") )
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) /* 2 rows from Accounts table: Account_ID Statement_ID Account_Details 7 57 495.063 61 57 930.14 */ CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) /* 2 rows from Documents table: Document_ID Document_Type_Code Project_ID Document_Date Document_Name Document_Description Other_Details 29 CV 30 2004-08-28 06:59:19 Review on UK files None None 42 BK 105 2012-12-27 19:09:18 Review on Canadian files None None */ CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Documents_with_Expenses table: Document_ID Budget_Type_Code Document_Details 57 GV government 192 GV government */ CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) /* 2 rows from Projects table: Project_ID Project_Details 30 Society Research project 35 Internet of Things project */ CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) /* 2 rows from Ref_Budget_Codes table: Budget_Type_Code Budget_Type_Description GV Government ORG Organisation */ CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) /* 2 rows from Ref_Document_Types table: Document_Type_Code Document_Type_Name Document_Type_Description BK Book excellent CV CV excellent */ CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Statements table: Statement_ID Statement_Details 57 Open Project 192 Private Project */
Return the id of the project that has the fewest corresponding documents.
SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1
[{'Project_ID': 195}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]Return the id of the document with the fewest paragraphs.[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1[/SQL]
[QUESTION]Return the id of the document with the fewest paragraphs.[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1[/SQL]
[QUESTION]Return the id of the document with the fewest paragraphs.[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1[/SQL]
[QUESTION]Return the id of the document with the fewest paragraphs.[/QUESTION] [SQL]SELECT document_id FROM Paragraphs GROUP BY document_id ORDER BY count(*) ASC LIMIT 1[/SQL]
driving_school
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Payments" ( customer_id INTEGER NOT NULL, datetime_payment DATETIME NOT NULL, payment_method_code VARCHAR(10) NOT NULL, amount_payment DOUBLE, PRIMARY KEY (customer_id, datetime_payment), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_address_id INTEGER NOT NULL, customer_status_code VARCHAR(15) NOT NULL, date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80), amount_outstanding DOUBLE, email_address VARCHAR(250), phone_number VARCHAR(255), cell_mobile_phone_number VARCHAR(255), PRIMARY KEY (customer_id), FOREIGN KEY(customer_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Lessons" ( lesson_id INTEGER, customer_id INTEGER NOT NULL, lesson_status_code VARCHAR(15) NOT NULL, staff_id INTEGER, vehicle_id INTEGER NOT NULL, lesson_date DATETIME, lesson_time VARCHAR(10), price DOUBLE, PRIMARY KEY (lesson_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(vehicle_id) REFERENCES "Vehicles" (vehicle_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_address_id INTEGER NOT NULL, nickname VARCHAR(80), first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME, PRIMARY KEY (staff_id), FOREIGN KEY(staff_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Vehicles" ( vehicle_id INTEGER, vehicle_details VARCHAR(255), PRIMARY KEY (vehicle_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1_number_building city zip_postcode state_province_county country 1 3904 Stroman Passage Port Melyssa 14445 Georgia USA 2 053 Quigley Island Hagenesfurt 22194 Kentucky USA */ CREATE TABLE "Customer_Payments" ( customer_id INTEGER NOT NULL, datetime_payment DATETIME NOT NULL, payment_method_code VARCHAR(10) NOT NULL, amount_payment DOUBLE, PRIMARY KEY (customer_id, datetime_payment), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Payments table: customer_id datetime_payment payment_method_code amount_payment 11 2018-02-05 18:44:46 Direct Debit 9570.93 2 2018-02-24 10:07:05 Direct Debit 8180.26 */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_address_id INTEGER NOT NULL, customer_status_code VARCHAR(15) NOT NULL, date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80), amount_outstanding DOUBLE, email_address VARCHAR(250), phone_number VARCHAR(255), cell_mobile_phone_number VARCHAR(255), PRIMARY KEY (customer_id), FOREIGN KEY(customer_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customers table: customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number 1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 [email protected] 07278206718 861-638-9797 2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 [email protected] +14(5)2351480248 578-518-4785x612 */ CREATE TABLE "Lessons" ( lesson_id INTEGER, customer_id INTEGER NOT NULL, lesson_status_code VARCHAR(15) NOT NULL, staff_id INTEGER, vehicle_id INTEGER NOT NULL, lesson_date DATETIME, lesson_time VARCHAR(10), price DOUBLE, PRIMARY KEY (lesson_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(vehicle_id) REFERENCES "Vehicles" (vehicle_id) ) /* 2 rows from Lessons table: lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price 1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0 2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_address_id INTEGER NOT NULL, nickname VARCHAR(80), first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME, PRIMARY KEY (staff_id), FOREIGN KEY(staff_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Staff table: staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff 1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12 2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00 */ CREATE TABLE "Vehicles" ( vehicle_id INTEGER, vehicle_details VARCHAR(255), PRIMARY KEY (vehicle_id) ) /* 2 rows from Vehicles table: vehicle_id vehicle_details 1 Van 2 Truck */
List first name and last name of customers that have more than 2 payments.
SELECT T2.first_name , T2.last_name FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2;
[{'first_name': 'Estelle', 'last_name': 'Grant'}]
Medium
false
false
false
false
false
true
true
true
false
false
false
false
false
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
[QUESTION]Find the name of customers who have more than one loan.[/QUESTION] [SQL]SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id GROUP BY T1.cust_name HAVING count(*) > 1[/SQL]
news_report
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") )
CREATE TABLE event ( "Event_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, "Event_Attendance" INTEGER, PRIMARY KEY ("Event_ID") ) /* 2 rows from event table: Event_ID Date Venue Name Event_Attendance 1 13 October 2008 Marathon Olympia Games Openning 6650 2 11 October 2007 Victoria Government Hearing 369 */ CREATE TABLE journalist ( "journalist_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, "Years_working" INTEGER, PRIMARY KEY ("journalist_ID") ) /* 2 rows from journalist table: journalist_ID Name Nationality Age Years_working 1 Herbert Swindells England 37 10 2 Fred Keenor Wales 27 5 */ CREATE TABLE news_report ( "journalist_ID" INTEGER, "Event_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("journalist_ID", "Event_ID"), FOREIGN KEY("Event_ID") REFERENCES event ("Event_ID"), FOREIGN KEY("journalist_ID") REFERENCES journalist ("journalist_ID") ) /* 2 rows from news_report table: journalist_ID Event_ID Work_Type 1 3 Screening 11 5 Screening */
Show the names of journalists from "England" or "Wales".
SELECT Name FROM journalist WHERE Nationality = "England" OR Nationality = "Wales"
[{'Name': 'Herbert Swindells'}, {'Name': 'Fred Keenor'}, {'Name': 'George Gilchrist'}, {'Name': 'Jackie Waring'}, {'Name': 'Fred Chandler'}, {'Name': 'John Meaney'}, {'Name': 'Tony Waddington'}, {'Name': 'Jack Meaney'}, {'Name': 'Frank Mitcheson'}, {'Name': 'Tom Briggs'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what states border states that border colorado
SELECT border FROM border_info WHERE state_name IN ( SELECT border FROM border_info WHERE state_name = "colorado" );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
[QUESTION]how many states border the largest state[/QUESTION] [SQL]SELECT COUNT ( border ) FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );[/SQL]
department_store
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_details 1 28481 Crist Circle East Burdettestad, IA 21232 2 0292 Mitchel Pike Port Abefurt, IA 84402-4249 */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (customer_id, address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_from date_to 2 9 2017-12-11 05:00:22 2018-03-20 20:52:34 1 6 2017-10-07 23:00:26 2018-02-28 14:53:52 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(10) NOT NULL, order_date DATETIME NOT NULL, PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code order_date 1 12 Completed 2018-02-10 15:44:48 2 4 New 2018-01-31 17:49:18 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(10) NOT NULL, customer_code VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method_code customer_code customer_name customer_address customer_phone customer_email 1 Credit Card 401 Ahmed 75099 Tremblay Port Apt. 163 South Norrisland, SC 80546 254-072-4068x33935 [email protected] 2 Credit Card 665 Chauncey 8408 Lindsay Court East Dasiabury, IL 72656-3552 +41(8)1897032009 [email protected] */ CREATE TABLE "Department_Store_Chain" ( dept_store_chain_id INTEGER, dept_store_chain_name VARCHAR(80), PRIMARY KEY (dept_store_chain_id) ) /* 2 rows from Department_Store_Chain table: dept_store_chain_id dept_store_chain_name 1 South 2 West */ CREATE TABLE "Department_Stores" ( dept_store_id INTEGER, dept_store_chain_id INTEGER, store_name VARCHAR(80), store_address VARCHAR(255), store_phone VARCHAR(80), store_email VARCHAR(80), PRIMARY KEY (dept_store_id), FOREIGN KEY(dept_store_chain_id) REFERENCES "Department_Store_Chain" (dept_store_chain_id) ) /* 2 rows from Department_Stores table: dept_store_id dept_store_chain_id store_name store_address store_phone store_email 1 1 store_name 01290 Jeremie Parkway Suite 753 North Arielle, MS 51249 (948)944-5099x2027 [email protected] 2 3 store_name 082 Purdy Expressway O'Connellshire, IL 31732 877-917-5029 [email protected] */ CREATE TABLE "Departments" ( department_id INTEGER, dept_store_id INTEGER NOT NULL, department_name VARCHAR(80), PRIMARY KEY (department_id), FOREIGN KEY(dept_store_id) REFERENCES "Department_Stores" (dept_store_id) ) /* 2 rows from Departments table: department_id dept_store_id department_name 1 5 human resource 2 11 purchasing */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id 1 9 7 2 1 3 */ CREATE TABLE "Product_Suppliers" ( product_id INTEGER NOT NULL, supplier_id INTEGER NOT NULL, date_supplied_from DATETIME NOT NULL, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19, 4), PRIMARY KEY (product_id, supplier_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id) ) /* 2 rows from Product_Suppliers table: product_id supplier_id date_supplied_from date_supplied_to total_amount_purchased total_value_purchased 4 3 2017-06-19 00:49:05 2018-03-24 19:29:18 89366.05 36014.6000 8 4 2017-07-02 00:35:12 2018-03-25 07:30:49 25085.57 36274.5600 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(10) NOT NULL, product_name VARCHAR(80), product_price DECIMAL(19, 4), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Clothes red jeans 734.7300 2 Clothes yellow jeans 687.2300 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_gender VARCHAR(1), staff_name VARCHAR(80), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_gender staff_name 1 1 Tom 2 1 Malika */ CREATE TABLE "Staff_Department_Assignments" ( staff_id INTEGER NOT NULL, department_id INTEGER NOT NULL, date_assigned_from DATETIME NOT NULL, job_title_code VARCHAR(10) NOT NULL, date_assigned_to DATETIME, PRIMARY KEY (staff_id, department_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(department_id) REFERENCES "Departments" (department_id) ) /* 2 rows from Staff_Department_Assignments table: staff_id department_id date_assigned_from job_title_code date_assigned_to 5 4 2017-06-11 22:55:20 Department Manager 2018-03-23 21:59:11 10 5 2017-12-18 19:12:15 Sales Person 2018-03-23 20:25:24 */ CREATE TABLE "Supplier_Addresses" ( supplier_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, PRIMARY KEY (supplier_id, address_id), FOREIGN KEY(supplier_id) REFERENCES "Suppliers" (supplier_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Supplier_Addresses table: supplier_id address_id date_from date_to 4 5 2016-09-22 16:41:31 2018-03-14 20:06:37 3 9 2014-11-07 19:18:49 2018-03-16 16:39:58 */ CREATE TABLE "Suppliers" ( supplier_id INTEGER, supplier_name VARCHAR(80), supplier_phone VARCHAR(80), PRIMARY KEY (supplier_id) ) /* 2 rows from Suppliers table: supplier_id supplier_name supplier_phone 1 Lidl (692)009-5928 2 AB Store 1-483-283-4742 */
What is the average price of clothes?
SELECT avg(product_price) FROM products WHERE product_type_code = 'Clothes'
[{'avg(product_price)': 715.5366666666666}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
which states border the state with the smallest area
SELECT border FROM border_info WHERE state_name = ( SELECT state_name FROM state WHERE area = ( SELECT MIN ( area ) FROM state ) );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION] [SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL]
[QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION] [SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL]
[QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION] [SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL]
[QUESTION]what is the largest state that borders the state with the lowest point in the usa[/QUESTION] [SQL]SELECT t1.state_name FROM highlow AS t3 JOIN border_info AS t1 ON t3.state_name = t1.border JOIN state AS t2 ON t2.state_name = t1.border WHERE t3.lowest_elevation = ( SELECT MIN ( lowest_elevation ) FROM highlow ) ORDER BY t2.area DESC LIMIT 1;[/SQL]
academic
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) )
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) /* 2 rows from author table: aid homepage name oid */ CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) /* 2 rows from cite table: cited citing */ CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) /* 2 rows from conference table: cid homepage name */ CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) /* 2 rows from domain table: did name */ CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from domain_author table: aid did */ CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from domain_conference table: cid did */ CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_journal table: did jid */ CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_keyword table: did kid */ CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_publication table: did pid */ CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) /* 2 rows from journal table: homepage jid name */ CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) /* 2 rows from keyword table: keyword kid */ CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) /* 2 rows from organization table: continent homepage name oid */ CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from publication table: abstract cid citation_num jid pid reference_num title year */ CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) /* 2 rows from publication_keyword table: pid kid */ CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from writes table: aid pid */
return me the papers by " H. V. Jagadish " on PVLDB .
SELECT t4.title FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t1.name = "H. V. Jagadish" AND t2.name = "PVLDB";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]return me the papers written by " H. V. Jagadish " and " Yunyao Li " on PVLDB .[/QUESTION] [SQL]SELECT t6.title FROM publication AS t6 JOIN journal AS t4 ON t6.jid = t4.jid JOIN writes AS t3 ON t3.pid = t6.pid JOIN writes AS t5 ON t5.pid = t6.pid JOIN author AS t1 ON t5.aid = t1.aid JOIN author AS t2 ON t3.aid = t2.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Yunyao Li" AND t4.name = "PVLDB";[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Yunyao Li " on PVLDB .[/QUESTION] [SQL]SELECT t6.title FROM publication AS t6 JOIN journal AS t4 ON t6.jid = t4.jid JOIN writes AS t3 ON t3.pid = t6.pid JOIN writes AS t5 ON t5.pid = t6.pid JOIN author AS t1 ON t5.aid = t1.aid JOIN author AS t2 ON t3.aid = t2.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Yunyao Li" AND t4.name = "PVLDB";[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Yunyao Li " on PVLDB .[/QUESTION] [SQL]SELECT t6.title FROM publication AS t6 JOIN journal AS t4 ON t6.jid = t4.jid JOIN writes AS t3 ON t3.pid = t6.pid JOIN writes AS t5 ON t5.pid = t6.pid JOIN author AS t1 ON t5.aid = t1.aid JOIN author AS t2 ON t3.aid = t2.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Yunyao Li" AND t4.name = "PVLDB";[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Yunyao Li " on PVLDB .[/QUESTION] [SQL]SELECT t6.title FROM publication AS t6 JOIN journal AS t4 ON t6.jid = t4.jid JOIN writes AS t3 ON t3.pid = t6.pid JOIN writes AS t5 ON t5.pid = t6.pid JOIN author AS t1 ON t5.aid = t1.aid JOIN author AS t2 ON t3.aid = t2.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Yunyao Li" AND t4.name = "PVLDB";[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
which papers in acl 2012 had Parsing in them ?
SELECT DISTINCT t3.paperid FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN venue AS t4 ON t4.venueid = t3.venueid WHERE t1.keyphrasename = "Parsing" AND t3.year = 2012 AND t4.venuename = "acl";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
browser_web
CREATE TABLE "Web_client_accelerator" ( id INTEGER, name TEXT, "Operating_system" TEXT, "Client" TEXT, "Connection" TEXT, PRIMARY KEY (id) ) CREATE TABLE accelerator_compatible_browser ( accelerator_id INTEGER, browser_id INTEGER, compatible_since_year INTEGER, PRIMARY KEY (accelerator_id, browser_id), FOREIGN KEY(browser_id) REFERENCES browser (id), FOREIGN KEY(accelerator_id) REFERENCES "Web_client_accelerator" (id) ) CREATE TABLE browser ( id INTEGER, name TEXT, market_share REAL, PRIMARY KEY (id) )
CREATE TABLE "Web_client_accelerator" ( id INTEGER, name TEXT, "Operating_system" TEXT, "Client" TEXT, "Connection" TEXT, PRIMARY KEY (id) ) /* 2 rows from Web_client_accelerator table: id name Operating_system Client Connection 1 CACHEbox Appliance (Linux) End user, ISP Broadband, Satellite, Wireless, Fiber, DSL 2 CProxy Windows user up to 756kbit/s */ CREATE TABLE accelerator_compatible_browser ( accelerator_id INTEGER, browser_id INTEGER, compatible_since_year INTEGER, PRIMARY KEY (accelerator_id, browser_id), FOREIGN KEY(browser_id) REFERENCES browser (id), FOREIGN KEY(accelerator_id) REFERENCES "Web_client_accelerator" (id) ) /* 2 rows from accelerator_compatible_browser table: accelerator_id browser_id compatible_since_year 1 1 1995 1 2 1996 */ CREATE TABLE browser ( id INTEGER, name TEXT, market_share REAL, PRIMARY KEY (id) ) /* 2 rows from browser table: id name market_share 1 Internet Explorer 28.96 2 Firefox 18.11 */
What is the maximum, minimum and average market share of the listed browsers?
SELECT max(market_share) , min(market_share) , avg(market_share) FROM browser
[{'max(market_share)': 28.96, 'min(market_share)': 1.2, 'avg(market_share)': 14.2025}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
customers_and_addresses
CREATE TABLE "Addresses" ( address_id INTEGER, address_content VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Customer_Contact_Channels" ( customer_id INTEGER NOT NULL, channel_code VARCHAR(15) NOT NULL, active_from_date DATETIME NOT NULL, active_to_date DATETIME, contact_number VARCHAR(50) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(15) NOT NULL, order_date DATETIME, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(15), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_details VARCHAR(255), PRIMARY KEY (product_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, address_content VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id address_content city zip_postcode state_province_county country other_address_details 1 9443 Boyle Route Suite 857 Lucasville 416 Colorado USA None 2 1969 Jabari Port Suite 393 New Sabryna 721 SouthCarolina USA None */ CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customer_Addresses table: customer_id address_id date_address_from address_type date_address_to 2 11 1985-03-29 20:31:43 Billing 1993-02-17 17:55:18 13 11 2010-08-25 04:24:35 Billing 1972-02-17 22:23:38 */ CREATE TABLE "Customer_Contact_Channels" ( customer_id INTEGER NOT NULL, channel_code VARCHAR(15) NOT NULL, active_from_date DATETIME NOT NULL, active_to_date DATETIME, contact_number VARCHAR(50) NOT NULL, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Contact_Channels table: customer_id channel_code active_from_date active_to_date contact_number 9 Email 2017-12-07 18:18:15 2018-03-23 13:37:14 940.035.6435x0225 2 Email 2017-04-07 04:51:41 2018-03-23 01:30:52 189.449.8326x7607 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(15) NOT NULL, order_date DATETIME, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status order_date order_details 1 15 Cancelled 2018-03-21 11:20:46 None 2 3 Cancelled 2018-03-05 06:35:33 None */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method customer_name date_became_customer other_customer_details 1 Cash Dr. Julia Wuckert MD 2018-03-01 23:20:10 None 2 Cheque Tillman Ernser 2018-02-28 11:37:44 None */ CREATE TABLE "Order_Items" ( order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(15), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_id product_id order_quantity 14 2 5 5 2 9 */ CREATE TABLE "Products" ( product_id INTEGER, product_details VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_details 1 Americano 2 Dove Chocolate */
How many customers have at least one order with status "Cancelled"?
SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status = "Cancelled"
[{'count(DISTINCT customer_id)': 7}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many customers are there?[/QUESTION] [SQL]SELECT sum(no_of_customers) FROM bank[/SQL]
[QUESTION]How many customers are there?[/QUESTION] [SQL]SELECT sum(no_of_customers) FROM bank[/SQL]
[QUESTION]How many customers are there?[/QUESTION] [SQL]SELECT sum(no_of_customers) FROM bank[/SQL]
music_2
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") )
CREATE TABLE "Albums" ( "AId" INTEGER, "Title" TEXT, "Year" INTEGER, "Label" TEXT, "Type" TEXT, PRIMARY KEY ("AId") ) /* 2 rows from Albums table: AId Title Year Label Type */ CREATE TABLE "Band" ( "Id" INTEGER, "Firstname" TEXT, "Lastname" TEXT, PRIMARY KEY ("Id") ) /* 2 rows from Band table: Id Firstname Lastname */ CREATE TABLE "Instruments" ( "SongId" INTEGER, "BandmateId" INTEGER, "Instrument" TEXT, PRIMARY KEY ("SongId", "BandmateId", "Instrument"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("BandmateId") REFERENCES "Band" ("Id") ) /* 2 rows from Instruments table: SongId BandmateId Instrument */ CREATE TABLE "Performance" ( "SongId" INTEGER, "Bandmate" INTEGER, "StagePosition" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Performance table: SongId Bandmate StagePosition */ CREATE TABLE "Songs" ( "SongId" INTEGER, "Title" TEXT, PRIMARY KEY ("SongId") ) /* 2 rows from Songs table: SongId Title */ CREATE TABLE "Tracklists" ( "AlbumId" INTEGER, "Position" INTEGER, "SongId" INTEGER, PRIMARY KEY ("AlbumId", "Position"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("AlbumId") REFERENCES "Albums" ("AId") ) /* 2 rows from Tracklists table: AlbumId Position SongId */ CREATE TABLE "Vocals" ( "SongId" INTEGER, "Bandmate" INTEGER, "Type" TEXT, PRIMARY KEY ("SongId", "Bandmate"), FOREIGN KEY("SongId") REFERENCES "Songs" ("SongId"), FOREIGN KEY("Bandmate") REFERENCES "Band" ("Id") ) /* 2 rows from Vocals table: SongId Bandmate Type */
What are the first and last names of the performer who was in the back stage position for the song "Badlands"?
SELECT T2.firstname , T2.lastname FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id JOIN Songs AS T3 ON T3.SongId = T1.SongId WHERE T3.Title = "Badlands" AND T1.StagePosition = "back"
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
train_station
CREATE TABLE station ( "Station_ID" INTEGER, "Name" TEXT, "Annual_entry_exit" REAL, "Annual_interchanges" REAL, "Total_Passengers" REAL, "Location" TEXT, "Main_Services" TEXT, "Number_of_Platforms" INTEGER, PRIMARY KEY ("Station_ID") ) CREATE TABLE train ( "Train_ID" INTEGER, "Name" TEXT, "Time" TEXT, "Service" TEXT, PRIMARY KEY ("Train_ID") ) CREATE TABLE train_station ( "Train_ID" INTEGER, "Station_ID" INTEGER, PRIMARY KEY ("Train_ID", "Station_ID"), FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID") )
CREATE TABLE station ( "Station_ID" INTEGER, "Name" TEXT, "Annual_entry_exit" REAL, "Annual_interchanges" REAL, "Total_Passengers" REAL, "Location" TEXT, "Main_Services" TEXT, "Number_of_Platforms" INTEGER, PRIMARY KEY ("Station_ID") ) /* 2 rows from station table: Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms 1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19 2 London Victoria 76.231 9.157 85.38 London Brighton Main Line Chatham Main Line 19 */ CREATE TABLE train ( "Train_ID" INTEGER, "Name" TEXT, "Time" TEXT, "Service" TEXT, PRIMARY KEY ("Train_ID") ) /* 2 rows from train table: Train_ID Name Time Service 1 Ananthapuri Express 17:15 Daily 2 Guruvayur Express 22:10 Daily */ CREATE TABLE train_station ( "Train_ID" INTEGER, "Station_ID" INTEGER, PRIMARY KEY ("Train_ID", "Station_ID"), FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID") ) /* 2 rows from train_station table: Train_ID Station_ID 1 1 2 1 */
Show the station name and number of trains in each station.
SELECT T2.name , count(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id
[{'Name': 'London Waterloo', 'count(*)': 3}, {'Name': 'London Victoria', 'count(*)': 1}, {'Name': 'London Bridge', 'count(*)': 1}, {'Name': 'London Euston', 'count(*)': 1}, {'Name': "London King's Cross", 'count(*)': 1}, {'Name': 'Glasgow Central', 'count(*)': 2}, {'Name': 'East Croydon', 'count(*)': 2}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
formula_1
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") )
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorResults table: constructorResultsId raceId constructorId points status 1 18 1 14.0 NULL 2 18 2 8.0 NULL */ CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorStandings table: constructorStandingsId raceId constructorId points position positionText wins 1 18 1 14.0 1 1 1 2 18 2 8.0 3 3 0 */ CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from driverStandings table: driverStandingsId raceId driverId points position positionText wins 1 18 1 10.0 1 1 1 2 18 2 8.0 2 2 0 */ CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from lapTimes table: raceId driverId lap position time milliseconds */ CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from pitStops table: raceId driverId stop lap time duration milliseconds */ CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) /* 2 rows from circuits table: circuitId circuitRef name location country lat lng alt url 1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.8497 144.968 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit 2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.738 http://en.wikipedia.org/wiki/Sepang_International_Circuit */ CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) /* 2 rows from constructors table: constructorId constructorRef name nationality url 1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren 2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber */ CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) /* 2 rows from drivers table: driverId driverRef number code forename surname dob nationality url 1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton 2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld */ CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from qualifying table: qualifyId raceId driverId constructorId number position q1 q2 q3 1 18 1 1 22 1 1:26.572 1:25.187 1:26.714 2 18 9 2 4 2 1:26.103 1:25.315 1:26.869 */ CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) /* 2 rows from races table: raceId year round circuitId name date time url 1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix 2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix */ CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from results table: resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId 1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1 2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1 */ CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) /* 2 rows from seasons table: year url 1950 http://en.wikipedia.org/wiki/1950_Formula_One_season 1951 http://en.wikipedia.org/wiki/1951_Formula_One_season */ CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") ) /* 2 rows from status table: statusId status 1 Finished 2 Disqualified */
List the forename and surname of all distinct drivers who once had laptime less than 93000 milliseconds?
SELECT DISTINCT T1.forename , T1.surname FROM drivers AS T1 JOIN laptimes AS T2 ON T1.driverid = T2.driverid WHERE T2.milliseconds < 93000
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
true
false
false
false
false
false
false
true
false
false
false
false
false
store_1
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) )
CREATE TABLE albums ( id INTEGER, title VARCHAR(160) NOT NULL, artist_id INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(artist_id) REFERENCES artists (id) ) /* 2 rows from albums table: id title artist_id 1 For Those About To Rock We Salute You 1 2 Balls to the Wall 2 */ CREATE TABLE artists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from artists table: id name 1 AC/DC 2 Accept */ CREATE TABLE customers ( id INTEGER, first_name VARCHAR(40) NOT NULL, last_name VARCHAR(20) NOT NULL, company VARCHAR(80), address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60) NOT NULL, support_rep_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(support_rep_id) REFERENCES employees (id) ) /* 2 rows from customers table: id first_name last_name company address city state country postal_code phone fax email support_rep_id 1 Luís Gonçalves Embraer - Empresa Brasileira de Aeronáutica S.A. Av. Brigadeiro Faria Lima, 2170 São José dos Campos SP Brazil 12227-000 +55 (12) 3923-5555 +55 (12) 3923-5566 [email protected] 3 2 Leonie Köhler None Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 +49 0711 2842222 None [email protected] 5 */ CREATE TABLE employees ( id INTEGER, last_name VARCHAR(20) NOT NULL, first_name VARCHAR(20) NOT NULL, title VARCHAR(30), reports_to INTEGER, birth_date TIMESTAMP, hire_date TIMESTAMP, address VARCHAR(70), city VARCHAR(40), state VARCHAR(40), country VARCHAR(40), postal_code VARCHAR(10), phone VARCHAR(24), fax VARCHAR(24), email VARCHAR(60), PRIMARY KEY (id), FOREIGN KEY(reports_to) REFERENCES employees (id) ) /* 2 rows from employees table: id last_name first_name title reports_to birth_date hire_date address city state country postal_code phone fax email 1 Adams Andrew General Manager None 1962-02-18 00:00:00 2002-08-14 00:00:00 11120 Jasper Ave NW Edmonton AB Canada T5K 2N1 +1 (780) 428-9482 +1 (780) 428-3457 [email protected] 2 Edwards Nancy Sales Manager 1 1958-12-08 00:00:00 2002-05-01 00:00:00 825 8 Ave SW Calgary AB Canada T2P 2T3 +1 (403) 262-3443 +1 (403) 262-3322 [email protected] */ CREATE TABLE genres ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from genres table: id name 1 Rock 2 Jazz */ CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER NOT NULL, track_id INTEGER NOT NULL, unit_price NUMERIC(10, 2) NOT NULL, quantity INTEGER NOT NULL, PRIMARY KEY (id), FOREIGN KEY(invoice_id) REFERENCES invoices (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from invoice_lines table: id invoice_id track_id unit_price quantity 1 1 2 0.99 1 2 1 4 0.99 1 */ CREATE TABLE invoices ( id INTEGER, customer_id INTEGER NOT NULL, invoice_date TIMESTAMP NOT NULL, billing_address VARCHAR(70), billing_city VARCHAR(40), billing_state VARCHAR(40), billing_country VARCHAR(40), billing_postal_code VARCHAR(10), total NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(customer_id) REFERENCES customers (id) ) /* 2 rows from invoices table: id customer_id invoice_date billing_address billing_city billing_state billing_country billing_postal_code total 1 2 2007-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98 2 4 2007-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96 */ CREATE TABLE media_types ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from media_types table: id name 1 MPEG audio file 2 Protected AAC audio file */ CREATE TABLE playlist_tracks ( playlist_id INTEGER NOT NULL, track_id INTEGER NOT NULL, CONSTRAINT "PK_PlaylistTrack" PRIMARY KEY (playlist_id, track_id), FOREIGN KEY(playlist_id) REFERENCES playlists (id), FOREIGN KEY(track_id) REFERENCES tracks (id) ) /* 2 rows from playlist_tracks table: playlist_id track_id 1 3402 1 3389 */ CREATE TABLE playlists ( id INTEGER, name VARCHAR(120), PRIMARY KEY (id) ) /* 2 rows from playlists table: id name 1 Music 2 Movies */ CREATE TABLE tracks ( id INTEGER, name VARCHAR(200) NOT NULL, album_id INTEGER, media_type_id INTEGER NOT NULL, genre_id INTEGER, composer VARCHAR(220), milliseconds INTEGER NOT NULL, bytes INTEGER, unit_price NUMERIC(10, 2) NOT NULL, PRIMARY KEY (id), FOREIGN KEY(album_id) REFERENCES albums (id), FOREIGN KEY(genre_id) REFERENCES genres (id), FOREIGN KEY(media_type_id) REFERENCES media_types (id) ) /* 2 rows from tracks table: id name album_id media_type_id genre_id composer milliseconds bytes unit_price 1 For Those About To Rock (We Salute You) 1 1 1 Angus Young, Malcolm Young, Brian Johnson 343719 11170334 0.99 2 Balls to the Wall 2 2 1 None 342562 5510424 0.99 */
What is Astrid Gruber's email and phone number?
SELECT email , phone FROM customers WHERE first_name = "Astrid" AND last_name = "Gruber";
[{'email': '[email protected]', 'phone': '+43 01 5134505'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
bike_1
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER )
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) /* 2 rows from station table: id name lat long dock_count city installation_date 2 San Jose Diridon Caltrain Station 37.3297320000 -121.9017820000 27 San Jose 8/6/2013 3 San Jose Civic Center 37.3306980000 -121.8889790000 15 San Jose 8/5/2013 */ CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) /* 2 rows from status table: station_id bikes_available docks_available time 3 12 3 2015-06-02 12:46:02 3 12 3 2015-06-02 12:47:02 */ CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) /* 2 rows from trip table: id duration start_date start_station_name start_station_id end_date end_station_name end_station_id bike_id subscription_type zip_code 900504 384 8/21/2015 17:03 Howard at 2nd 63 8/21/2015 17:10 San Francisco Caltrain 2 (330 Townsend) 69 454 Subscriber 94041 900505 588 8/21/2015 17:03 South Van Ness at Market 66 8/21/2015 17:13 San Francisco Caltrain 2 (330 Townsend) 69 574 Subscriber 95119 */ CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) /* 2 rows from weather table: date max_temperature_f mean_temperature_f min_temperature_f max_dew_point_f mean_dew_point_f min_dew_point_f max_humidity mean_humidity min_humidity max_sea_level_pressure_inches mean_sea_level_pressure_inches min_sea_level_pressure_inches max_visibility_miles mean_visibility_miles min_visibility_miles max_wind_Speed_mph mean_wind_speed_mph max_gust_speed_mph precipitation_inches cloud_cover events wind_dir_degrees zip_code 8/29/2013 74 68 61 61 58 56 93 75 57 30.0700000000 30.0200000000 29.9700000000 10 10 10 23 11 28 0 4 286 94107 8/30/2013 78 69 60 61 58 56 90 70 50 30.0500000000 30.0000000000 29.9300000000 10 10 7 29 13 35 0 2 291 94107 */
What is the average bike availability in stations that are not located in Palo Alto?
SELECT avg(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = "Palo Alto")
[{'avg(bikes_available)': 7.657901422764228}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]how many places for french are there in palo alto ?[/QUESTION] [SQL]SELECT COUNT ( * ) FROM restaurant AS t1 JOIN LOCATION AS t2 ON t1.id = t2.restaurant_id WHERE t2.city_name = "palo alto" AND t1.food_type = "french";[/SQL]
[QUESTION]how many places for french are there in palo alto ?[/QUESTION] [SQL]SELECT COUNT ( * ) FROM restaurant AS t1 JOIN LOCATION AS t2 ON t1.id = t2.restaurant_id WHERE t2.city_name = "palo alto" AND t1.food_type = "french";[/SQL]
[QUESTION]how many places for french are there in palo alto ?[/QUESTION] [SQL]SELECT COUNT ( * ) FROM restaurant AS t1 JOIN LOCATION AS t2 ON t1.id = t2.restaurant_id WHERE t2.city_name = "palo alto" AND t1.food_type = "french";[/SQL]
[QUESTION]how many places for french are there in palo alto ?[/QUESTION] [SQL]SELECT COUNT ( * ) FROM restaurant AS t1 JOIN LOCATION AS t2 ON t1.id = t2.restaurant_id WHERE t2.city_name = "palo alto" AND t1.food_type = "french";[/SQL]
hospital_1
CREATE TABLE "Affiliated_With" ( "Physician" INTEGER NOT NULL, "Department" INTEGER NOT NULL, "PrimaryAffiliation" BOOLEAN NOT NULL, PRIMARY KEY ("Physician", "Department"), CONSTRAINT "fk_Affiliated_With_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Affiliated_With_Department_DepartmentID" FOREIGN KEY("Department") REFERENCES "Department" ("DepartmentID") ) CREATE TABLE "Appointment" ( "AppointmentID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "PrepNurse" INTEGER, "Physician" INTEGER NOT NULL, "Start" DATETIME NOT NULL, "End" DATETIME NOT NULL, "ExaminationRoom" TEXT NOT NULL, PRIMARY KEY ("AppointmentID"), CONSTRAINT "fk_Appointment_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Appointment_Nurse_EmployeeID" FOREIGN KEY("PrepNurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_Appointment_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Block" ( "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, PRIMARY KEY ("BlockFloor", "BlockCode") ) CREATE TABLE "Department" ( "DepartmentID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Head" INTEGER NOT NULL, CONSTRAINT "pk_Department" PRIMARY KEY ("DepartmentID"), CONSTRAINT "fk_Department_Physician_EmployeeID" FOREIGN KEY("Head") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Medication" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Brand" VARCHAR(30) NOT NULL, "Description" VARCHAR(30) NOT NULL, PRIMARY KEY ("Code") ) CREATE TABLE "Nurse" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "Registered" BOOLEAN NOT NULL, "SSN" INTEGER NOT NULL, PRIMARY KEY ("EmployeeID") ) CREATE TABLE "On_Call" ( "Nurse" INTEGER NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "OnCallStart" DATETIME NOT NULL, "OnCallEnd" DATETIME NOT NULL, PRIMARY KEY ("Nurse", "BlockFloor", "BlockCode", "OnCallStart", "OnCallEnd"), CONSTRAINT "fk_OnCall_Nurse_EmployeeID" FOREIGN KEY("Nurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_OnCall_Block_Floor" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) CREATE TABLE "Patient" ( "SSN" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Address" VARCHAR(30) NOT NULL, "Phone" VARCHAR(30) NOT NULL, "InsuranceID" INTEGER NOT NULL, "PCP" INTEGER NOT NULL, PRIMARY KEY ("SSN"), CONSTRAINT "fk_Patient_Physician_EmployeeID" FOREIGN KEY("PCP") REFERENCES "Physician" ("EmployeeID") ) CREATE TABLE "Physician" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "SSN" INTEGER NOT NULL, CONSTRAINT pk_physician PRIMARY KEY ("EmployeeID") ) CREATE TABLE "Prescribes" ( "Physician" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Medication" INTEGER NOT NULL, "Date" DATETIME NOT NULL, "Appointment" INTEGER, "Dose" VARCHAR(30) NOT NULL, PRIMARY KEY ("Physician", "Patient", "Medication", "Date"), CONSTRAINT "fk_Prescribes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Prescribes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Prescribes_Medication_Code" FOREIGN KEY("Medication") REFERENCES "Medication" ("Code"), CONSTRAINT "fk_Prescribes_Appointment_AppointmentID" FOREIGN KEY("Appointment") REFERENCES "Appointment" ("AppointmentID") ) CREATE TABLE "Procedures" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Cost" REAL NOT NULL, PRIMARY KEY ("Code") ) CREATE TABLE "Room" ( "RoomNumber" INTEGER NOT NULL, "RoomType" VARCHAR(30) NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "Unavailable" BOOLEAN NOT NULL, PRIMARY KEY ("RoomNumber"), CONSTRAINT "fk_Room_Block_PK" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) CREATE TABLE "Stay" ( "StayID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Room" INTEGER NOT NULL, "StayStart" DATETIME NOT NULL, "StayEnd" DATETIME NOT NULL, PRIMARY KEY ("StayID"), CONSTRAINT "fk_Stay_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Stay_Room_Number" FOREIGN KEY("Room") REFERENCES "Room" ("RoomNumber") ) CREATE TABLE "Trained_In" ( "Physician" INTEGER NOT NULL, "Treatment" INTEGER NOT NULL, "CertificationDate" DATETIME NOT NULL, "CertificationExpires" DATETIME NOT NULL, PRIMARY KEY ("Physician", "Treatment"), CONSTRAINT "fk_Trained_In_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Trained_In_Procedures_Code" FOREIGN KEY("Treatment") REFERENCES "Procedures" ("Code") ) CREATE TABLE "Undergoes" ( "Patient" INTEGER NOT NULL, "Procedures" INTEGER NOT NULL, "Stay" INTEGER NOT NULL, "DateUndergoes" DATETIME NOT NULL, "Physician" INTEGER NOT NULL, "AssistingNurse" INTEGER, PRIMARY KEY ("Patient", "Procedures", "Stay", "DateUndergoes"), CONSTRAINT "fk_Undergoes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Undergoes_Procedures_Code" FOREIGN KEY("Procedures") REFERENCES "Procedures" ("Code"), CONSTRAINT "fk_Undergoes_Stay_StayID" FOREIGN KEY("Stay") REFERENCES "Stay" ("StayID"), CONSTRAINT "fk_Undergoes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Undergoes_Nurse_EmployeeID" FOREIGN KEY("AssistingNurse") REFERENCES "Nurse" ("EmployeeID") )
CREATE TABLE "Affiliated_With" ( "Physician" INTEGER NOT NULL, "Department" INTEGER NOT NULL, "PrimaryAffiliation" BOOLEAN NOT NULL, PRIMARY KEY ("Physician", "Department"), CONSTRAINT "fk_Affiliated_With_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Affiliated_With_Department_DepartmentID" FOREIGN KEY("Department") REFERENCES "Department" ("DepartmentID") ) /* 2 rows from Affiliated_With table: Physician Department PrimaryAffiliation 1 1 True 2 1 True */ CREATE TABLE "Appointment" ( "AppointmentID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "PrepNurse" INTEGER, "Physician" INTEGER NOT NULL, "Start" DATETIME NOT NULL, "End" DATETIME NOT NULL, "ExaminationRoom" TEXT NOT NULL, PRIMARY KEY ("AppointmentID"), CONSTRAINT "fk_Appointment_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Appointment_Nurse_EmployeeID" FOREIGN KEY("PrepNurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_Appointment_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Appointment table: AppointmentID Patient PrepNurse Physician Start End ExaminationRoom 13216584 100000001 101 1 2008-04-24 10:00:00 2008-04-24 11:00:00 A 26548913 100000002 101 2 2008-04-24 10:00:00 2008-04-24 11:00:00 B */ CREATE TABLE "Block" ( "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, PRIMARY KEY ("BlockFloor", "BlockCode") ) /* 2 rows from Block table: BlockFloor BlockCode 1 1 1 2 */ CREATE TABLE "Department" ( "DepartmentID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Head" INTEGER NOT NULL, CONSTRAINT "pk_Department" PRIMARY KEY ("DepartmentID"), CONSTRAINT "fk_Department_Physician_EmployeeID" FOREIGN KEY("Head") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Department table: DepartmentID Name Head 1 General Medicine 4 2 Surgery 7 */ CREATE TABLE "Medication" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Brand" VARCHAR(30) NOT NULL, "Description" VARCHAR(30) NOT NULL, PRIMARY KEY ("Code") ) /* 2 rows from Medication table: Code Name Brand Description 1 Procrastin-X X N/A 2 Thesisin Foo Labs N/A */ CREATE TABLE "Nurse" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "Registered" BOOLEAN NOT NULL, "SSN" INTEGER NOT NULL, PRIMARY KEY ("EmployeeID") ) /* 2 rows from Nurse table: EmployeeID Name Position Registered SSN 101 Carla Espinosa Head Nurse True 111111110 102 Laverne Roberts Nurse True 222222220 */ CREATE TABLE "On_Call" ( "Nurse" INTEGER NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "OnCallStart" DATETIME NOT NULL, "OnCallEnd" DATETIME NOT NULL, PRIMARY KEY ("Nurse", "BlockFloor", "BlockCode", "OnCallStart", "OnCallEnd"), CONSTRAINT "fk_OnCall_Nurse_EmployeeID" FOREIGN KEY("Nurse") REFERENCES "Nurse" ("EmployeeID"), CONSTRAINT "fk_OnCall_Block_Floor" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) /* 2 rows from On_Call table: Nurse BlockFloor BlockCode OnCallStart OnCallEnd 101 1 1 2008-11-04 11:00:00 2008-11-04 19:00:00 101 1 2 2008-11-04 11:00:00 2008-11-04 19:00:00 */ CREATE TABLE "Patient" ( "SSN" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Address" VARCHAR(30) NOT NULL, "Phone" VARCHAR(30) NOT NULL, "InsuranceID" INTEGER NOT NULL, "PCP" INTEGER NOT NULL, PRIMARY KEY ("SSN"), CONSTRAINT "fk_Patient_Physician_EmployeeID" FOREIGN KEY("PCP") REFERENCES "Physician" ("EmployeeID") ) /* 2 rows from Patient table: SSN Name Address Phone InsuranceID PCP 100000001 John Smith 42 Foobar Lane 555-0256 68476213 1 100000002 Grace Ritchie 37 Snafu Drive 555-0512 36546321 2 */ CREATE TABLE "Physician" ( "EmployeeID" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Position" VARCHAR(30) NOT NULL, "SSN" INTEGER NOT NULL, CONSTRAINT pk_physician PRIMARY KEY ("EmployeeID") ) /* 2 rows from Physician table: EmployeeID Name Position SSN 1 John Dorian Staff Internist 111111111 2 Elliot Reid Attending Physician 222222222 */ CREATE TABLE "Prescribes" ( "Physician" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Medication" INTEGER NOT NULL, "Date" DATETIME NOT NULL, "Appointment" INTEGER, "Dose" VARCHAR(30) NOT NULL, PRIMARY KEY ("Physician", "Patient", "Medication", "Date"), CONSTRAINT "fk_Prescribes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Prescribes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Prescribes_Medication_Code" FOREIGN KEY("Medication") REFERENCES "Medication" ("Code"), CONSTRAINT "fk_Prescribes_Appointment_AppointmentID" FOREIGN KEY("Appointment") REFERENCES "Appointment" ("AppointmentID") ) /* 2 rows from Prescribes table: Physician Patient Medication Date Appointment Dose 1 100000001 1 2008-04-24 10:47:00 13216584 5 9 100000004 2 2008-04-27 10:53:00 86213939 10 */ CREATE TABLE "Procedures" ( "Code" INTEGER NOT NULL, "Name" VARCHAR(30) NOT NULL, "Cost" REAL NOT NULL, PRIMARY KEY ("Code") ) /* 2 rows from Procedures table: Code Name Cost 1 Reverse Rhinopodoplasty 1500.0 2 Obtuse Pyloric Recombobulation 3750.0 */ CREATE TABLE "Room" ( "RoomNumber" INTEGER NOT NULL, "RoomType" VARCHAR(30) NOT NULL, "BlockFloor" INTEGER NOT NULL, "BlockCode" INTEGER NOT NULL, "Unavailable" BOOLEAN NOT NULL, PRIMARY KEY ("RoomNumber"), CONSTRAINT "fk_Room_Block_PK" FOREIGN KEY("BlockFloor", "BlockCode") REFERENCES "Block" ("BlockFloor", "BlockCode") ) /* 2 rows from Room table: RoomNumber RoomType BlockFloor BlockCode Unavailable 101 Single 1 1 False 102 Single 1 1 False */ CREATE TABLE "Stay" ( "StayID" INTEGER NOT NULL, "Patient" INTEGER NOT NULL, "Room" INTEGER NOT NULL, "StayStart" DATETIME NOT NULL, "StayEnd" DATETIME NOT NULL, PRIMARY KEY ("StayID"), CONSTRAINT "fk_Stay_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Stay_Room_Number" FOREIGN KEY("Room") REFERENCES "Room" ("RoomNumber") ) /* 2 rows from Stay table: StayID Patient Room StayStart StayEnd 3215 100000001 111 2008-05-01 00:00:00 2008-05-04 00:00:00 3216 100000003 123 2008-05-03 00:00:00 2008-05-14 00:00:00 */ CREATE TABLE "Trained_In" ( "Physician" INTEGER NOT NULL, "Treatment" INTEGER NOT NULL, "CertificationDate" DATETIME NOT NULL, "CertificationExpires" DATETIME NOT NULL, PRIMARY KEY ("Physician", "Treatment"), CONSTRAINT "fk_Trained_In_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Trained_In_Procedures_Code" FOREIGN KEY("Treatment") REFERENCES "Procedures" ("Code") ) /* 2 rows from Trained_In table: Physician Treatment CertificationDate CertificationExpires 3 1 2008-01-01 00:00:00 2008-12-31 00:00:00 3 2 2008-01-01 00:00:00 2008-12-31 00:00:00 */ CREATE TABLE "Undergoes" ( "Patient" INTEGER NOT NULL, "Procedures" INTEGER NOT NULL, "Stay" INTEGER NOT NULL, "DateUndergoes" DATETIME NOT NULL, "Physician" INTEGER NOT NULL, "AssistingNurse" INTEGER, PRIMARY KEY ("Patient", "Procedures", "Stay", "DateUndergoes"), CONSTRAINT "fk_Undergoes_Patient_SSN" FOREIGN KEY("Patient") REFERENCES "Patient" ("SSN"), CONSTRAINT "fk_Undergoes_Procedures_Code" FOREIGN KEY("Procedures") REFERENCES "Procedures" ("Code"), CONSTRAINT "fk_Undergoes_Stay_StayID" FOREIGN KEY("Stay") REFERENCES "Stay" ("StayID"), CONSTRAINT "fk_Undergoes_Physician_EmployeeID" FOREIGN KEY("Physician") REFERENCES "Physician" ("EmployeeID"), CONSTRAINT "fk_Undergoes_Nurse_EmployeeID" FOREIGN KEY("AssistingNurse") REFERENCES "Nurse" ("EmployeeID") ) /* 2 rows from Undergoes table: Patient Procedures Stay DateUndergoes Physician AssistingNurse 100000001 6 3215 2008-05-02 00:00:00 3 101 100000001 2 3215 2008-05-03 00:00:00 7 101 */
what is the name and position of the head whose department has least number of employees?
SELECT T2.name , T2.position FROM department AS T1 JOIN physician AS T2 ON T1.head = T2.EmployeeID GROUP BY departmentID ORDER BY count(departmentID) LIMIT 1;
[{'Name': 'Percival Cox', 'Position': 'Senior Attending Physician'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What is the number of employees?[/QUESTION] [SQL]SELECT count(*) FROM Employee[/SQL]
[QUESTION]What is the number of employees?[/QUESTION] [SQL]SELECT count(*) FROM Employee[/SQL]
[QUESTION]What is the number of employees?[/QUESTION] [SQL]SELECT count(*) FROM Employee[/SQL]
[QUESTION]What is the number of employees?[/QUESTION] [SQL]SELECT count(*) FROM Employee[/SQL]
movie_1
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") )
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) /* 2 rows from Movie table: mID title year director 101 Gone with the Wind 1939 Victor Fleming 102 Star Wars 1977 George Lucas */ CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) /* 2 rows from Rating table: rID mID stars ratingDate 201 101 2 2011-01-22 201 101 4 2011-01-27 */ CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") ) /* 2 rows from Reviewer table: rID name 201 Sarah Martinez 202 Daniel Lewis */
What are the names of all directors who have made one movie except for the director named NULL?
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1
[{'director': 'George Lucas'}, {'director': 'Robert Wise'}, {'director': 'Victor Fleming'}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
[QUESTION]Which producer has worked with the most number of directors ?[/QUESTION] [SQL]SELECT t1.name FROM director AS t3 JOIN directed_by AS t2 ON t3.did = t2.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN made_by AS t5 ON t4.mid = t5.msid JOIN producer AS t1 ON t1.pid = t5.pid GROUP BY t1.name ORDER BY COUNT ( DISTINCT t3.name ) DESC LIMIT 1;[/SQL]
[QUESTION]Which producer has worked with the most number of directors ?[/QUESTION] [SQL]SELECT t1.name FROM director AS t3 JOIN directed_by AS t2 ON t3.did = t2.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN made_by AS t5 ON t4.mid = t5.msid JOIN producer AS t1 ON t1.pid = t5.pid GROUP BY t1.name ORDER BY COUNT ( DISTINCT t3.name ) DESC LIMIT 1;[/SQL]
[QUESTION]Which producer has worked with the most number of directors ?[/QUESTION] [SQL]SELECT t1.name FROM director AS t3 JOIN directed_by AS t2 ON t3.did = t2.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN made_by AS t5 ON t4.mid = t5.msid JOIN producer AS t1 ON t1.pid = t5.pid GROUP BY t1.name ORDER BY COUNT ( DISTINCT t3.name ) DESC LIMIT 1;[/SQL]
[QUESTION]Which producer has worked with the most number of directors ?[/QUESTION] [SQL]SELECT t1.name FROM director AS t3 JOIN directed_by AS t2 ON t3.did = t2.did JOIN movie AS t4 ON t4.mid = t2.msid JOIN made_by AS t5 ON t4.mid = t5.msid JOIN producer AS t1 ON t1.pid = t5.pid GROUP BY t1.name ORDER BY COUNT ( DISTINCT t3.name ) DESC LIMIT 1;[/SQL]
customers_campaigns_ecommerce
CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, premise_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type_code VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(premise_id) REFERENCES "Premises" (premise_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(15) NOT NULL, shipping_method_code VARCHAR(15) NOT NULL, order_placed_datetime DATETIME NOT NULL, order_delivered_datetime DATETIME, order_shipping_charges VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), customer_address VARCHAR(255), customer_login VARCHAR(80), customer_password VARCHAR(10), PRIMARY KEY (customer_id) ) CREATE TABLE "Mailshot_Campaigns" ( mailshot_id INTEGER, product_category VARCHAR(15), mailshot_name VARCHAR(80), mailshot_start_date DATETIME, mailshot_end_date DATETIME, PRIMARY KEY (mailshot_id) ) CREATE TABLE "Mailshot_Customers" ( mailshot_id INTEGER NOT NULL, customer_id INTEGER NOT NULL, outcome_code VARCHAR(15) NOT NULL, mailshot_customer_date DATETIME, FOREIGN KEY(mailshot_id) REFERENCES "Mailshot_Campaigns" (mailshot_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Order_Items" ( item_id INTEGER NOT NULL, order_item_status_code VARCHAR(15) NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, item_status_code VARCHAR(15), item_delivered_datetime DATETIME, item_order_quantity VARCHAR(80), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Premises" ( premise_id INTEGER, premises_type VARCHAR(15) NOT NULL, premise_details VARCHAR(255), PRIMARY KEY (premise_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_category VARCHAR(15) NOT NULL, product_name VARCHAR(80), PRIMARY KEY (product_id) )
CREATE TABLE "Customer_Addresses" ( customer_id INTEGER NOT NULL, premise_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type_code VARCHAR(15) NOT NULL, date_address_to DATETIME, FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(premise_id) REFERENCES "Premises" (premise_id) ) /* 2 rows from Customer_Addresses table: customer_id premise_id date_address_from address_type_code date_address_to 15 1 1992-08-23 21:17:38 Billing 2018-02-28 20:54:58 2 2 2010-02-23 02:49:50 Billing 2018-03-15 18:34:41 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status_code VARCHAR(15) NOT NULL, shipping_method_code VARCHAR(15) NOT NULL, order_placed_datetime DATETIME NOT NULL, order_delivered_datetime DATETIME, order_shipping_charges VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_status_code shipping_method_code order_placed_datetime order_delivered_datetime order_shipping_charges 1 2 Cancelled Unspecified 2015-06-15 18:19:26 2018-03-20 12:00:00 85.79 2 8 Cancelled Unspecified 2009-07-05 20:02:55 2018-03-20 12:00:00 98.4 */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method VARCHAR(15) NOT NULL, customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), customer_address VARCHAR(255), customer_login VARCHAR(80), customer_password VARCHAR(10), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id payment_method customer_name customer_phone customer_email customer_address customer_login customer_password 1 Credit Card Wendell (773)971-9411x759 [email protected] 618 Webster Stream Apt. 161 None b4459ad261 2 Direct Debit Gage (402)890-2603x6005 [email protected] 0260 Walker Trace None 7905d7f1b1 */ CREATE TABLE "Mailshot_Campaigns" ( mailshot_id INTEGER, product_category VARCHAR(15), mailshot_name VARCHAR(80), mailshot_start_date DATETIME, mailshot_end_date DATETIME, PRIMARY KEY (mailshot_id) ) /* 2 rows from Mailshot_Campaigns table: mailshot_id product_category mailshot_name mailshot_start_date mailshot_end_date 1 food US 2018-02-15 09:52:17 2018-03-08 14:40:20 2 clothes US 2017-09-14 12:05:30 2018-03-15 01:06:16 */ CREATE TABLE "Mailshot_Customers" ( mailshot_id INTEGER NOT NULL, customer_id INTEGER NOT NULL, outcome_code VARCHAR(15) NOT NULL, mailshot_customer_date DATETIME, FOREIGN KEY(mailshot_id) REFERENCES "Mailshot_Campaigns" (mailshot_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Mailshot_Customers table: mailshot_id customer_id outcome_code mailshot_customer_date 4 3 Order 2018-03-15 15:43:14 10 1 No Response 2018-03-04 13:06:55 */ CREATE TABLE "Order_Items" ( item_id INTEGER NOT NULL, order_item_status_code VARCHAR(15) NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, item_status_code VARCHAR(15), item_delivered_datetime DATETIME, item_order_quantity VARCHAR(80), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: item_id order_item_status_code order_id product_id item_status_code item_delivered_datetime item_order_quantity 1 Delivered 10 13 good 2018-02-25 18:22:10 6 2 Paid 6 7 good 2018-02-27 18:04:55 7 */ CREATE TABLE "Premises" ( premise_id INTEGER, premises_type VARCHAR(15) NOT NULL, premise_details VARCHAR(255), PRIMARY KEY (premise_id) ) /* 2 rows from Premises table: premise_id premises_type premise_details 1 Warehouse 036 Lueilwitz Harbor 2 Warehouse 676 Kelly Spur */ CREATE TABLE "Products" ( product_id INTEGER, product_category VARCHAR(15) NOT NULL, product_name VARCHAR(80), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_category product_name 1 Food Coffee Bean 2 Electronics Keyboard */
Show the names of customers having an order with shipping method FedEx and order status Paid.
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE shipping_method_code = 'FedEx' AND order_status_code = 'Paid'
[{'customer_name': 'Leanna'}, {'customer_name': 'Kyle'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
game_1
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") )
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from Plays_Games table: StuID GameID Hours_Played 1001 1 35 1001 2 15 */ CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from SportsInfo table: StuID SportName HoursPerWeek GamesPlayed OnScholarship 1001 Athletics 2 5 N 1002 Football 7 20 Y */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */ CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") ) /* 2 rows from Video_Games table: GameID GName GType 1 RNG Stone Collectible card game 2 The Vanishing of Eric Calder Walking Simulator */
What are the last names for all scholarship students?
SELECT T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.onscholarship = 'Y'
[{'LName': 'Kim'}, {'LName': 'Jones'}, {'LName': 'Lee'}, {'LName': 'Pang'}, {'LName': 'Shieber'}, {'LName': 'Shieber'}, {'LName': 'Pang'}, {'LName': 'Simms'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the first names of all students in course ACCT-211?[/QUESTION] [SQL]SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]What are the first names of all students in course ACCT-211?[/QUESTION] [SQL]SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]What are the first names of all students in course ACCT-211?[/QUESTION] [SQL]SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'[/SQL]
[QUESTION]What are the first names of all students in course ACCT-211?[/QUESTION] [SQL]SELECT T3.stu_fname FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN student AS T3 ON T2.stu_num = T3.stu_num WHERE T1.crs_code = 'ACCT-211'[/SQL]
college_2
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) )
CREATE TABLE advisor ( "s_ID" VARCHAR(5), "i_ID" VARCHAR(5), PRIMARY KEY ("s_ID"), FOREIGN KEY("i_ID") REFERENCES instructor ("ID"), FOREIGN KEY("s_ID") REFERENCES student ("ID") ) /* 2 rows from advisor table: s_ID i_ID 24746 19368 79352 95030 */ CREATE TABLE classroom ( building VARCHAR(15), room_number VARCHAR(7), capacity NUMERIC(4, 0), PRIMARY KEY (building, room_number) ) /* 2 rows from classroom table: building room_number capacity Lamberton 134 10 Chandler 375 10 */ CREATE TABLE course ( course_id VARCHAR(8), title VARCHAR(50), dept_name VARCHAR(20), credits NUMERIC(2, 0), PRIMARY KEY (course_id), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (credits > 0) ) /* 2 rows from course table: course_id title dept_name credits 787 C Programming Mech. Eng. 4 238 The Music of Donovan Mech. Eng. 3 */ CREATE TABLE department ( dept_name VARCHAR(20), building VARCHAR(15), budget NUMERIC(12, 2), PRIMARY KEY (dept_name), CHECK (budget > 0) ) /* 2 rows from department table: dept_name building budget Civil Eng. Chandler 255041.46 Biology Candlestick 647610.55 */ CREATE TABLE instructor ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), salary NUMERIC(8, 2), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (salary > 29000) ) /* 2 rows from instructor table: ID name dept_name salary 63395 McKinnon Cybernetics 94333.99 78699 Pingr Statistics 59303.62 */ CREATE TABLE prereq ( course_id VARCHAR(8), prereq_id VARCHAR(8), PRIMARY KEY (course_id, prereq_id), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(prereq_id) REFERENCES course (course_id) ) /* 2 rows from prereq table: course_id prereq_id 376 130 760 169 */ CREATE TABLE section ( course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), building VARCHAR(15), room_number VARCHAR(7), time_slot_id VARCHAR(4), PRIMARY KEY (course_id, sec_id, semester, year), FOREIGN KEY(course_id) REFERENCES course (course_id), FOREIGN KEY(building, room_number) REFERENCES classroom (building, room_number), CHECK (semester in ('Fall', 'Winter', 'Spring', 'Summer')), CHECK (year > 1701 and year < 2100) ) /* 2 rows from section table: course_id sec_id semester year building room_number time_slot_id 313 1 Fall 2010 Chandler 804 N 747 1 Spring 2004 Gates 314 K */ CREATE TABLE student ( "ID" VARCHAR(5), name VARCHAR(20) NOT NULL, dept_name VARCHAR(20), tot_cred NUMERIC(3, 0), PRIMARY KEY ("ID"), FOREIGN KEY(dept_name) REFERENCES department (dept_name), CHECK (tot_cred >= 0) ) /* 2 rows from student table: ID name dept_name tot_cred 24746 Schrefl History 4 79352 Rumat Finance 100 */ CREATE TABLE takes ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), grade VARCHAR(2), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES student ("ID") ) /* 2 rows from takes table: ID course_id sec_id semester year grade 65901 401 1 Fall 2003 C- 24932 802 1 Spring 2003 B- */ CREATE TABLE teaches ( "ID" VARCHAR(5), course_id VARCHAR(8), sec_id VARCHAR(8), semester VARCHAR(6), year NUMERIC(4, 0), PRIMARY KEY ("ID", course_id, sec_id, semester, year), FOREIGN KEY(course_id, sec_id, semester, year) REFERENCES section (course_id, sec_id, semester, year), FOREIGN KEY("ID") REFERENCES instructor ("ID") ) /* 2 rows from teaches table: ID course_id sec_id semester year 34175 747 1 Spring 2004 3199 169 1 Spring 2007 */ CREATE TABLE time_slot ( time_slot_id VARCHAR(4), day VARCHAR(1), start_hr NUMERIC(2), start_min NUMERIC(2), end_hr NUMERIC(2), end_min NUMERIC(2), PRIMARY KEY (time_slot_id, day, start_hr, start_min), CHECK (start_hr >= 0 and start_hr < 24), CHECK (start_min >= 0 and start_min < 60), CHECK (end_hr >= 0 and end_hr < 24), CHECK (end_min >= 0 and end_min < 60) ) /* 2 rows from time_slot table: time_slot_id day start_hr start_min end_hr end_min A M 8.0000000000 0E-10 8.0000000000 50.0000000000 A W 8.0000000000 0E-10 8.0000000000 50.0000000000 */
Find the names of instructors who didn't each any courses in any Spring semester.
SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches WHERE semester = 'Spring')
[{'name': 'McKinnon'}, {'name': 'Pingr'}, {'name': 'Mird'}, {'name': 'Murata'}, {'name': 'Konstantinides'}, {'name': 'Levine'}, {'name': 'Shuming'}, {'name': 'Queiroz'}, {'name': 'Sullivan'}, {'name': 'Bertolino'}, {'name': 'Hau'}, {'name': 'Soisalon-Soininen'}, {'name': 'Moreira'}, {'name': 'Arias'}, {'name': 'Yazdi'}, {'name': 'Choll'}, {'name': 'Arinb'}, {'name': 'Kenje'}, {'name': 'Dusserre'}, {'name': 'Desyl'}, {'name': 'Sarkar'}, {'name': 'Bancilhon'}, {'name': 'Liley'}, {'name': 'Yin'}, {'name': 'Lent'}, {'name': 'Bourrier'}, {'name': 'Gutierrez'}, {'name': 'Romero'}, {'name': 'Kean'}, {'name': 'Bietzk'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the first names of all instructors who have taught some course and the course description.[/QUESTION] [SQL]SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code[/SQL]
[QUESTION]Find the first names of all instructors who have taught some course and the course description.[/QUESTION] [SQL]SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code[/SQL]
[QUESTION]Find the first names of all instructors who have taught some course and the course description.[/QUESTION] [SQL]SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code[/SQL]
[QUESTION]Find the first names of all instructors who have taught some course and the course description.[/QUESTION] [SQL]SELECT T2.emp_fname , T3.crs_description FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num JOIN course AS T3 ON T1.crs_code = T3.crs_code[/SQL]
ship_1
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") )
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) /* 2 rows from Ship table: Ship_ID Name Type Built_Year Class Flag 1 HMS Manxman Panamax 1997.0 KR Panama 2 HMS Gorgon Panamax 1998.0 KR Panama */ CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") ) /* 2 rows from captain table: Captain_ID Name Ship_ID age Class Rank 1 Captain Sir Henry Langford 1 40 Third-rate ship of the line Midshipman 2 Captain Beves Conway 2 54 Third-rate ship of the line Midshipman */
Find the ship type that are used by both ships with Panama and Malta flags.
SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'
[{'Type': 'Panamax'}]
Hard
false
false
false
false
false
false
false
false
false
false
true
false
false
ship_1
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") )
CREATE TABLE "Ship" ( "Ship_ID" INTEGER, "Name" TEXT, "Type" TEXT, "Built_Year" REAL, "Class" TEXT, "Flag" TEXT, PRIMARY KEY ("Ship_ID") ) /* 2 rows from Ship table: Ship_ID Name Type Built_Year Class Flag 1 HMS Manxman Panamax 1997.0 KR Panama 2 HMS Gorgon Panamax 1998.0 KR Panama */ CREATE TABLE captain ( "Captain_ID" INTEGER, "Name" TEXT, "Ship_ID" INTEGER, age TEXT, "Class" TEXT, "Rank" TEXT, PRIMARY KEY ("Captain_ID"), FOREIGN KEY("Ship_ID") REFERENCES "Ship" ("Ship_ID") ) /* 2 rows from captain table: Captain_ID Name Ship_ID age Class Rank 1 Captain Sir Henry Langford 1 40 Third-rate ship of the line Midshipman 2 Captain Beves Conway 2 54 Third-rate ship of the line Midshipman */
What are the names of ships that have more than one captain?
SELECT t1.name FROM ship AS t1 JOIN captain AS t2 ON t1.ship_id = t2.ship_id GROUP BY t2.ship_id HAVING count(*) > 1
[{'Name': 'HMS Gorgon'}, {'Name': 'HM Cutter Avenger'}]
Medium
false
false
false
false
false
true
true
true
false
false
false
false
false
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
[QUESTION]What are the different ids and names of the battles that lost any 'Brig' type shipes?[/QUESTION] [SQL]SELECT DISTINCT T1.id , T1.name FROM battle AS T1 JOIN ship AS T2 ON T1.id = T2.lost_in_battle WHERE T2.ship_type = 'Brig'[/SQL]
academic
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) )
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) /* 2 rows from author table: aid homepage name oid */ CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) /* 2 rows from cite table: cited citing */ CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) /* 2 rows from conference table: cid homepage name */ CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) /* 2 rows from domain table: did name */ CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from domain_author table: aid did */ CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from domain_conference table: cid did */ CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_journal table: did jid */ CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_keyword table: did kid */ CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_publication table: did pid */ CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) /* 2 rows from journal table: homepage jid name */ CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) /* 2 rows from keyword table: keyword kid */ CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) /* 2 rows from organization table: continent homepage name oid */ CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from publication table: abstract cid citation_num jid pid reference_num title year */ CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) /* 2 rows from publication_keyword table: pid kid */ CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from writes table: aid pid */
return me the papers by " H. V. Jagadish " on PVLDB with more than 200 citations .
SELECT t4.title FROM publication AS t4 JOIN journal AS t2 ON t4.jid = t2.jid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t1.name = "H. V. Jagadish" AND t2.name = "PVLDB" AND t4.citation_num > 200;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]return me the papers written by " H. V. Jagadish " and " Divesh Srivastava " with more than 200 citations .[/QUESTION] [SQL]SELECT t5.title FROM writes AS t3 JOIN author AS t2 ON t3.aid = t2.aid JOIN publication AS t5 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t5.pid JOIN author AS t1 ON t4.aid = t1.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Divesh Srivastava" AND t5.citation_num > 200;[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Divesh Srivastava " with more than 200 citations .[/QUESTION] [SQL]SELECT t5.title FROM writes AS t3 JOIN author AS t2 ON t3.aid = t2.aid JOIN publication AS t5 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t5.pid JOIN author AS t1 ON t4.aid = t1.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Divesh Srivastava" AND t5.citation_num > 200;[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Divesh Srivastava " with more than 200 citations .[/QUESTION] [SQL]SELECT t5.title FROM writes AS t3 JOIN author AS t2 ON t3.aid = t2.aid JOIN publication AS t5 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t5.pid JOIN author AS t1 ON t4.aid = t1.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Divesh Srivastava" AND t5.citation_num > 200;[/SQL]
[QUESTION]return me the papers written by " H. V. Jagadish " and " Divesh Srivastava " with more than 200 citations .[/QUESTION] [SQL]SELECT t5.title FROM writes AS t3 JOIN author AS t2 ON t3.aid = t2.aid JOIN publication AS t5 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t5.pid JOIN author AS t1 ON t4.aid = t1.aid WHERE t2.name = "H. V. Jagadish" AND t1.name = "Divesh Srivastava" AND t5.citation_num > 200;[/SQL]
csu_1
CREATE TABLE "Campuses" ( "Id" INTEGER, "Campus" TEXT, "Location" TEXT, "County" TEXT, "Year" INTEGER, PRIMARY KEY ("Id") ) CREATE TABLE csu_fees ( "Campus" INTEGER, "Year" INTEGER, "CampusFee" INTEGER, PRIMARY KEY ("Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE degrees ( "Year" INTEGER, "Campus" INTEGER, "Degrees" INTEGER, PRIMARY KEY ("Year", "Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE discipline_enrollments ( "Campus" INTEGER, "Discipline" INTEGER, "Year" INTEGER, "Undergraduate" INTEGER, "Graduate" INTEGER, PRIMARY KEY ("Campus", "Discipline"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE enrollments ( "Campus" INTEGER, "Year" INTEGER, "TotalEnrollment_AY" INTEGER, "FTE_AY" INTEGER, PRIMARY KEY ("Campus", "Year"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) CREATE TABLE faculty ( "Campus" INTEGER, "Year" INTEGER, "Faculty" REAL, FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") )
CREATE TABLE "Campuses" ( "Id" INTEGER, "Campus" TEXT, "Location" TEXT, "County" TEXT, "Year" INTEGER, PRIMARY KEY ("Id") ) /* 2 rows from Campuses table: Id Campus Location County Year 1 California State University-Bakersfield Bakersfield Kern 1965 2 California State University-Channel Islands Camarillo Ventura 2002 */ CREATE TABLE csu_fees ( "Campus" INTEGER, "Year" INTEGER, "CampusFee" INTEGER, PRIMARY KEY ("Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from csu_fees table: Campus Year CampusFee 1 1996 1951 2 2003 1868 */ CREATE TABLE degrees ( "Year" INTEGER, "Campus" INTEGER, "Degrees" INTEGER, PRIMARY KEY ("Year", "Campus"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from degrees table: Year Campus Degrees 1990 1 701 1991 1 681 */ CREATE TABLE discipline_enrollments ( "Campus" INTEGER, "Discipline" INTEGER, "Year" INTEGER, "Undergraduate" INTEGER, "Graduate" INTEGER, PRIMARY KEY ("Campus", "Discipline"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from discipline_enrollments table: Campus Discipline Year Undergraduate Graduate 1 4 2004 248 0 1 5 2004 811 73 */ CREATE TABLE enrollments ( "Campus" INTEGER, "Year" INTEGER, "TotalEnrollment_AY" INTEGER, "FTE_AY" INTEGER, PRIMARY KEY ("Campus", "Year"), FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from enrollments table: Campus Year TotalEnrollment_AY FTE_AY 1 1956 384 123 1 1957 432 151 */ CREATE TABLE faculty ( "Campus" INTEGER, "Year" INTEGER, "Faculty" REAL, FOREIGN KEY("Campus") REFERENCES "Campuses" ("Id") ) /* 2 rows from faculty table: Campus Year Faculty 1 2002 357.1 2 2002 48.4 */
What is the total number of degrees granted after 2000 for each Orange county campus?
SELECT T1.campus , sum(T2.degrees) FROM campuses AS T1 JOIN degrees AS T2 ON T1.id = T2.campus WHERE T1.county = "Orange" AND T2.year >= 2000 GROUP BY T1.campus
[{'Campus': 'California State University-Fullerton', 'sum(T2.degrees)': 26211}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
[QUESTION]How many different departments offer degrees?[/QUESTION] [SQL]SELECT count(DISTINCT department_id) FROM Degree_Programs[/SQL]
[QUESTION]How many different departments offer degrees?[/QUESTION] [SQL]SELECT count(DISTINCT department_id) FROM Degree_Programs[/SQL]
[QUESTION]How many different departments offer degrees?[/QUESTION] [SQL]SELECT count(DISTINCT department_id) FROM Degree_Programs[/SQL]
[QUESTION]How many different departments offer degrees?[/QUESTION] [SQL]SELECT count(DISTINCT department_id) FROM Degree_Programs[/SQL]
epinions_1
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) )
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) /* 2 rows from item table: i_id title 0 pear 1 orange */ CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) /* 2 rows from review table: a_id u_id i_id rating rank 1 1 1 10 1 2 2 1 5 2 */ CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) /* 2 rows from trust table: source_u_id target_u_id trust 1 2 10 1 3 6 */ CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) ) /* 2 rows from useracct table: u_id name 1 Helen 2 Mark */
Find the names of items whose rank is higher than 3 and whose average rating is above 5.
SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id WHERE T2.rank > 3 INTERSECT SELECT T1.title FROM item AS T1 JOIN review AS T2 ON T1.i_id = T2.i_id GROUP BY T2.i_id HAVING avg(T2.rating) > 5
[{'title': 'comb'}, {'title': 'cup'}]
Hard
false
false
false
false
false
true
true
false
true
false
true
false
false
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
[QUESTION]Find the average ranking for each player and their first name.[/QUESTION] [SQL]SELECT avg(ranking) , T1.first_name FROM players AS T1 JOIN rankings AS T2 ON T1.player_id = T2.player_id GROUP BY T1.first_name[/SQL]
academic
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) )
CREATE TABLE author ( aid INTEGER, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (aid) ) /* 2 rows from author table: aid homepage name oid */ CREATE TABLE cite ( cited INTEGER, citing INTEGER, FOREIGN KEY(cited) REFERENCES publication (pid), FOREIGN KEY(citing) REFERENCES publication (pid) ) /* 2 rows from cite table: cited citing */ CREATE TABLE conference ( cid INTEGER, homepage TEXT, name TEXT, PRIMARY KEY (cid) ) /* 2 rows from conference table: cid homepage name */ CREATE TABLE domain ( did INTEGER, name TEXT, PRIMARY KEY (did) ) /* 2 rows from domain table: did name */ CREATE TABLE domain_author ( aid INTEGER, did INTEGER, PRIMARY KEY (did, aid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from domain_author table: aid did */ CREATE TABLE domain_conference ( cid INTEGER, did INTEGER, PRIMARY KEY (did, cid), FOREIGN KEY(did) REFERENCES domain (did), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from domain_conference table: cid did */ CREATE TABLE domain_journal ( did INTEGER, jid INTEGER, PRIMARY KEY (did, jid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_journal table: did jid */ CREATE TABLE domain_keyword ( did INTEGER, kid INTEGER, PRIMARY KEY (did, kid), FOREIGN KEY(kid) REFERENCES keyword (kid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_keyword table: did kid */ CREATE TABLE domain_publication ( did INTEGER, pid INTEGER, PRIMARY KEY (did, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(did) REFERENCES domain (did) ) /* 2 rows from domain_publication table: did pid */ CREATE TABLE journal ( homepage TEXT, jid INTEGER, name TEXT, PRIMARY KEY (jid) ) /* 2 rows from journal table: homepage jid name */ CREATE TABLE keyword ( keyword TEXT, kid INTEGER, PRIMARY KEY (kid) ) /* 2 rows from keyword table: keyword kid */ CREATE TABLE organization ( continent TEXT, homepage TEXT, name TEXT, oid INTEGER, PRIMARY KEY (oid) ) /* 2 rows from organization table: continent homepage name oid */ CREATE TABLE publication ( abstract TEXT, cid TEXT, citation_num INTEGER, jid INTEGER, pid INTEGER, reference_num INTEGER, title TEXT, year INTEGER, PRIMARY KEY (pid), FOREIGN KEY(jid) REFERENCES journal (jid), FOREIGN KEY(cid) REFERENCES conference (cid) ) /* 2 rows from publication table: abstract cid citation_num jid pid reference_num title year */ CREATE TABLE publication_keyword ( pid INTEGER, kid INTEGER, PRIMARY KEY (kid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(kid) REFERENCES keyword (kid) ) /* 2 rows from publication_keyword table: pid kid */ CREATE TABLE writes ( aid INTEGER, pid INTEGER, PRIMARY KEY (aid, pid), FOREIGN KEY(pid) REFERENCES publication (pid), FOREIGN KEY(aid) REFERENCES author (aid) ) /* 2 rows from writes table: aid pid */
return me the authors who have papers containing keyword " Relational Database " .
SELECT t2.name FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t1.keyword = "Relational Database";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]return me the authors who have more than 10 papers containing keyword " Relational Database " .[/QUESTION] [SQL]SELECT t2.name FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t1.keyword = "Relational Database" GROUP BY t2.name HAVING COUNT ( DISTINCT t3.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers containing keyword " Relational Database " .[/QUESTION] [SQL]SELECT t2.name FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t1.keyword = "Relational Database" GROUP BY t2.name HAVING COUNT ( DISTINCT t3.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers containing keyword " Relational Database " .[/QUESTION] [SQL]SELECT t2.name FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t1.keyword = "Relational Database" GROUP BY t2.name HAVING COUNT ( DISTINCT t3.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers containing keyword " Relational Database " .[/QUESTION] [SQL]SELECT t2.name FROM publication_keyword AS t5 JOIN keyword AS t1 ON t5.kid = t1.kid JOIN publication AS t3 ON t3.pid = t5.pid JOIN writes AS t4 ON t4.pid = t3.pid JOIN author AS t2 ON t4.aid = t2.aid WHERE t1.keyword = "Relational Database" GROUP BY t2.name HAVING COUNT ( DISTINCT t3.title ) > 10;[/SQL]
customers_and_invoices
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Accounts table: account_id customer_id date_account_opened account_name other_account_details 1 8 2016-07-30 22:22:24 900 Regular 2 3 2017-05-29 16:45:17 520 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_middle_initial customer_last_name gender email_address login_name login_password phone_number town_city state_county_province country 1 Dee A Larkin 1 [email protected] xhartmann 77789d292604ea04406f 241.796.1219x37862 North Nellie WestVirginia USA 2 Brennon H Weimann 0 [email protected] shayne.lesch ce97a3e4539347daab96 (943)219-4234x415 South Isabell Oklahoma USA */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) /* 2 rows from Financial_Transactions table: transaction_id account_id invoice_number transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 13 12 Payment 2018-03-15 21:13:57 613.9600 None None 2 9 1 Payment 2018-03-13 13:27:46 368.4600 None None */ CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Invoice_Line_Items table: order_item_id invoice_number product_id product_title product_quantity product_price derived_product_cost derived_vat_payable derived_total_cost 14 9 5 prod_name 4 742.3700 191.1100 None 69.8200 3 9 15 prod_name 1 814.8700 176.2900 None 59.5600 */ CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Invoices table: invoice_number order_id invoice_date 1 9 2018-03-01 16:40:48 2 9 2018-03-20 00:21:41 */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id product_quantity other_order_item_details 1 4 4 6 None 2 4 10 7 None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id date_order_placed order_details 1 12 2012-06-27 20:49:56 None 2 12 2012-08-25 07:51:54 None */ CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) /* 2 rows from Product_Categories table: production_type_code product_type_description vat_rating Food Food 15.8400 DVDs Dvd products 11.4000 */ CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) ) /* 2 rows from Products table: product_id parent_product_id production_type_code unit_price product_name product_color product_size 1 4 Food 617.9500 Coffee Bean Red Medium 2 4 Books 558.4900 Learning French Yellow Medium */
Return the order ids and details for orderes with two or more invoices.
SELECT T2.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING count(*) > 2
[{'order_id': 3, 'order_details': None}, {'order_id': 9, 'order_details': None}]
Medium
false
false
false
false
false
true
true
true
false
false
false
false
false
manufactory_1
CREATE TABLE "Manufacturers" ( "Code" INTEGER, "Name" VARCHAR(255) NOT NULL, "Headquarter" VARCHAR(255) NOT NULL, "Founder" VARCHAR(255) NOT NULL, "Revenue" REAL, PRIMARY KEY ("Code") ) CREATE TABLE "Products" ( "Code" INTEGER, "Name" VARCHAR(255) NOT NULL, "Price" DECIMAL NOT NULL, "Manufacturer" INTEGER NOT NULL, PRIMARY KEY ("Code"), FOREIGN KEY("Manufacturer") REFERENCES "Manufacturers" ("Code") )
CREATE TABLE "Manufacturers" ( "Code" INTEGER, "Name" VARCHAR(255) NOT NULL, "Headquarter" VARCHAR(255) NOT NULL, "Founder" VARCHAR(255) NOT NULL, "Revenue" REAL, PRIMARY KEY ("Code") ) /* 2 rows from Manufacturers table: Code Name Headquarter Founder Revenue 1 Sony Tokyo Andy 120.0 2 Creative Labs Austin Owen 100.0 */ CREATE TABLE "Products" ( "Code" INTEGER, "Name" VARCHAR(255) NOT NULL, "Price" DECIMAL NOT NULL, "Manufacturer" INTEGER NOT NULL, PRIMARY KEY ("Code"), FOREIGN KEY("Manufacturer") REFERENCES "Manufacturers" ("Code") ) /* 2 rows from Products table: Code Name Price Manufacturer 1 Hard drive 240.0000000000 5 2 Memory 120.0000000000 6 */
Find the total revenue for each manufacturer.
SELECT sum(revenue) , name FROM manufacturers GROUP BY name
[{'sum(revenue)': 100.0, 'Name': 'Creative Labs'}, {'sum(revenue)': 130.0, 'Name': 'Fujitsu'}, {'sum(revenue)': 50.0, 'Name': 'Hewlett-Packard'}, {'sum(revenue)': 200.0, 'Name': 'Iomega'}, {'sum(revenue)': 120.0, 'Name': 'Sony'}, {'sum(revenue)': 30.0, 'Name': 'Winchester'}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]Find the total number of employees.[/QUESTION] [SQL]SELECT count(*) FROM employee[/SQL]
activity_1
CREATE TABLE "Activity" ( actid INTEGER, activity_name VARCHAR(25), PRIMARY KEY (actid) ) CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) CREATE TABLE "Faculty_Participates_in" ( "FacID" INTEGER, actid INTEGER, FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) CREATE TABLE "Participates_in" ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Activity" ( actid INTEGER, activity_name VARCHAR(25), PRIMARY KEY (actid) ) /* 2 rows from Activity table: actid activity_name 770 Mountain Climbing 771 Canoeing */ CREATE TABLE "Faculty" ( "FacID" INTEGER, "Lname" VARCHAR(15), "Fname" VARCHAR(15), "Rank" VARCHAR(15), "Sex" VARCHAR(1), "Phone" INTEGER, "Room" VARCHAR(5), "Building" VARCHAR(13), PRIMARY KEY ("FacID") ) /* 2 rows from Faculty table: FacID Lname Fname Rank Sex Phone Room Building 1082 Giuliano Mark Instructor M 2424 224 NEB 1121 Goodrich Michael Professor M 3593 219 NEB */ CREATE TABLE "Faculty_Participates_in" ( "FacID" INTEGER, actid INTEGER, FOREIGN KEY("FacID") REFERENCES "Faculty" ("FacID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) /* 2 rows from Faculty_Participates_in table: FacID actid 1082 784 1082 785 */ CREATE TABLE "Participates_in" ( stuid INTEGER, actid INTEGER, FOREIGN KEY(stuid) REFERENCES "Student" ("StuID"), FOREIGN KEY(actid) REFERENCES "Activity" (actid) ) /* 2 rows from Participates_in table: stuid actid 1001 770 1001 771 */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
Show the rank, first name, and last name for all the faculty.
SELECT rank , Fname , Lname FROM Faculty
[{'Rank': 'Instructor', 'Fname': 'Mark', 'Lname': 'Giuliano'}, {'Rank': 'Professor', 'Fname': 'Michael', 'Lname': 'Goodrich'}, {'Rank': 'Professor', 'Fname': 'Gerald', 'Lname': 'Masson'}, {'Rank': 'AssocProf', 'Fname': 'Thordur', 'Lname': 'Runolfsson'}, {'Rank': 'Professor', 'Fname': 'Daniel', 'Lname': 'Naiman'}, {'Rank': 'Instructor', 'Fname': 'Stacey', 'Lname': 'Jones'}, {'Rank': 'Professor', 'Fname': 'Frederic', 'Lname': 'Davidson'}, {'Rank': 'Professor', 'Fname': 'William', 'Lname': 'Brody'}, {'Rank': 'Professor', 'Fname': 'Gerard', 'Lname': 'Meyer'}, {'Rank': 'AsstProf', 'Fname': 'David', 'Lname': 'Yarowsky'}, {'Rank': 'Professor', 'Fname': 'Edward', 'Lname': 'Scheinerman'}, {'Rank': 'AsstProf', 'Fname': 'Carey', 'Lname': 'Priebe'}, {'Rank': 'Professor', 'Fname': 'James', 'Lname': 'Fill'}, {'Rank': 'Professor', 'Fname': 'Alan', 'Lname': 'Goldman'}, {'Rank': 'AssocProf', 'Fname': 'Scott', 'Lname': 'Smith'}, {'Rank': 'Instructor', 'Fname': 'Joanne', 'Lname': 'Houlahan'}, {'Rank': 'Professor', 'Fname': 'Luigi', 'Lname': 'Burzio'}, {'Rank': 'AsstProf', 'Fname': 'Robert', 'Lname': 'Frank'}, {'Rank': 'Instructor', 'Fname': 'Louis', 'Lname': 'Beach'}, {'Rank': 'AsstProf', 'Fname': 'Cheng', 'Lname': 'Cheng'}, {'Rank': 'Professor', 'Fname': 'Alexander', 'Lname': 'Kaplan'}, {'Rank': 'Instructor', 'Fname': 'William', 'Lname': 'Byrne'}, {'Rank': 'Professor', 'Fname': 'Shih-Ping', 'Lname': 'Han'}, {'Rank': 'Professor', 'Fname': 'Paul', 'Lname': 'Smolensky'}, {'Rank': 'AsstProf', 'Fname': 'Pablo', 'Lname': 'Iglesias'}, {'Rank': 'Professor', 'Fname': 'John', 'Lname': 'Goutsias'}, {'Rank': 'Professor', 'Fname': 'Wilson', 'Lname': 'Rugh'}, {'Rank': 'Professor', 'Fname': 'Frederick', 'Lname': 'Jelinek'}, {'Rank': 'Professor', 'Fname': 'Charles', 'Lname': 'Westgate'}, {'Rank': 'Professor', 'Fname': 'Baruch', 'Lname': 'Awerbuch'}, {'Rank': 'Professor', 'Fname': 'Russell', 'Lname': 'Taylor'}, {'Rank': 'AsstProf', 'Fname': 'Eric', 'Lname': 'Brill'}, {'Rank': 'AsstProf', 'Fname': 'Lancelot', 'Lname': 'James'}, {'Rank': 'Instructor', 'Fname': 'Ellie', 'Lname': 'Angelopoulou'}, {'Rank': 'Professor', 'Fname': 'Howard', 'Lname': 'Weinert'}, {'Rank': 'Professor', 'Fname': 'John', 'Lname': 'Wierman'}, {'Rank': 'AsstProf', 'Fname': 'Subodh', 'Lname': 'Kumar'}, {'Rank': 'AssocProf', 'Fname': 'Lawrence', 'Lname': 'Wolff'}, {'Rank': 'AsstProf', 'Fname': 'Gert', 'Lname': 'Cauwenberghs'}, {'Rank': 'Professor', 'Fname': 'Andreas', 'Lname': 'Andreou'}, {'Rank': 'AssocProf', 'Fname': 'Steven', 'Lname': 'Salzberg'}, {'Rank': 'AsstProf', 'Fname': 'Lenore', 'Lname': 'Cowen'}, {'Rank': 'Professor', 'Fname': 'Michael', 'Lname': 'McCloskey'}, {'Rank': 'AsstProf', 'Fname': 'Yair', 'Lname': 'Amir'}, {'Rank': 'AsstProf', 'Fname': 'Michael', 'Lname': 'Brent'}, {'Rank': 'AsstProf', 'Fname': 'Brenda', 'Lname': 'Rapp'}, {'Rank': 'Professor', 'Fname': 'Rao', 'Lname': 'Kosaraju'}, {'Rank': 'AssocProf', 'Fname': 'Oliver', 'Lname': 'Collins'}, {'Rank': 'AssocProf', 'Fname': 'Brian', 'Lname': 'Hughes'}, {'Rank': 'Professor', 'Fname': 'Richard', 'Lname': 'Joseph'}, {'Rank': 'Professor', 'Fname': 'Jacob', 'Lname': 'Khurgin'}, {'Rank': 'AssocProf', 'Fname': 'Jerry', 'Lname': 'Prince'}, {'Rank': 'AssocProf', 'Fname': 'Geraldine', 'Lname': 'Legendre'}, {'Rank': 'AsstProf', 'Fname': 'Colin', 'Lname': 'Wu'}, {'Rank': 'Professor', 'Fname': 'Jong-Shi', 'Lname': 'Pang'}, {'Rank': 'Instructor', 'Fname': 'Robert', 'Lname': 'Glaser'}, {'Rank': 'Instructor', 'Fname': 'Arthur', 'Lname': 'Delcher'}, {'Rank': 'AsstProf', 'Fname': 'Leslie', 'Lname': 'Hall'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the first names and offices of all professors sorted by alphabetical order of their first name.[/QUESTION] [SQL]SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname[/SQL]
[QUESTION]Find the first names and offices of all professors sorted by alphabetical order of their first name.[/QUESTION] [SQL]SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname[/SQL]
[QUESTION]Find the first names and offices of all professors sorted by alphabetical order of their first name.[/QUESTION] [SQL]SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname[/SQL]
[QUESTION]Find the first names and offices of all professors sorted by alphabetical order of their first name.[/QUESTION] [SQL]SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num ORDER BY T2.emp_fname[/SQL]
student_assessment
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) )
CREATE TABLE "Addresses" ( address_id INTEGER NOT NULL, line_1 VARCHAR(80), line_2 VARCHAR(80), city VARCHAR(50), zip_postcode CHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1 line_2 city zip_postcode state_province_county country 5 0900 Roderick Oval New Albina, WA 19200-7914 Suite 096 Linnealand 862 Montana USA 9 966 Dach Ports Apt. 322 Lake Harmonyhaven, VA 65235 Apt. 163 South Minnie 716 Texas USA */ CREATE TABLE "Candidate_Assessments" ( candidate_id INTEGER NOT NULL, qualification CHAR(15) NOT NULL, assessment_date DATETIME NOT NULL, asessment_outcome_code CHAR(15) NOT NULL, PRIMARY KEY (candidate_id, qualification), FOREIGN KEY(candidate_id) REFERENCES "Candidates" (candidate_id) ) /* 2 rows from Candidate_Assessments table: candidate_id qualification assessment_date asessment_outcome_code 111 A 2010-04-07 11:44:34 Pass 121 B 2010-04-17 11:44:34 Pass */ CREATE TABLE "Candidates" ( candidate_id INTEGER NOT NULL, candidate_details VARCHAR(255), PRIMARY KEY (candidate_id), FOREIGN KEY(candidate_id) REFERENCES "People" (person_id) ) /* 2 rows from Candidates table: candidate_id candidate_details 111 Jane 121 Robert */ CREATE TABLE "Courses" ( course_id VARCHAR(100) NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), other_details VARCHAR(255), PRIMARY KEY (course_id) ) /* 2 rows from Courses table: course_id course_name course_description other_details 301 statistics statistics None 302 English English None */ CREATE TABLE "People" ( person_id INTEGER NOT NULL, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40), PRIMARY KEY (person_id) ) /* 2 rows from People table: person_id first_name middle_name last_name cell_mobile_number email_address login_name password 111 Shannon Elissa Senger 01955267735 [email protected] pgub 5e4ff49a61b3544da3ad7dc7e2cf28847564c64c 121 Virginie Jasmin Hartmann (508)319-2970x043 [email protected] bkkv b063331ea8116befaa7b84c59c6a22200f5f8caa */ CREATE TABLE "People_Addresses" ( person_address_id INTEGER NOT NULL, person_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME, date_to DATETIME, PRIMARY KEY (person_address_id), FOREIGN KEY(person_id) REFERENCES "People" (person_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from People_Addresses table: person_address_id person_id address_id date_from date_to 122 111 9 2012-09-26 13:21:00 2018-03-21 09:46:30 257 121 5 2008-07-31 02:17:25 2018-03-09 02:11:12 */ CREATE TABLE "Student_Course_Attendance" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_attendance DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id, course_id) REFERENCES "Student_Course_Registrations" (student_id, course_id) ) /* 2 rows from Student_Course_Attendance table: student_id course_id date_of_attendance 111 301 2008-11-04 10:35:13 121 301 2012-04-09 11:44:34 */ CREATE TABLE "Student_Course_Registrations" ( student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, registration_date DATETIME NOT NULL, PRIMARY KEY (student_id, course_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Registrations table: student_id course_id registration_date 111 301 2008-11-04 10:35:13 121 301 2008-10-04 10:35:13 */ CREATE TABLE "Students" ( student_id INTEGER NOT NULL, student_details VARCHAR(255), PRIMARY KEY (student_id), FOREIGN KEY(student_id) REFERENCES "People" (person_id) ) /* 2 rows from Students table: student_id student_details 111 Marry 121 Martin */
What are the ids of the students who attended courses in the statistics department in order of attendance date.
SELECT T2.student_id FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = "statistics" ORDER BY T2.date_of_attendance
[{'student_id': 111}, {'student_id': 121}, {'student_id': 141}, {'student_id': 171}]
Medium
false
false
false
true
false
false
false
true
false
false
false
false
false
[QUESTION]What is the semester which most student registered in? Show both the name and the id.[/QUESTION] [SQL]SELECT T1.semester_name , T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the semester which most student registered in? Show both the name and the id.[/QUESTION] [SQL]SELECT T1.semester_name , T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the semester which most student registered in? Show both the name and the id.[/QUESTION] [SQL]SELECT T1.semester_name , T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the semester which most student registered in? Show both the name and the id.[/QUESTION] [SQL]SELECT T1.semester_name , T1.semester_id FROM Semesters AS T1 JOIN Student_Enrolment AS T2 ON T1.semester_id = T2.semester_id GROUP BY T1.semester_id ORDER BY count(*) DESC LIMIT 1[/SQL]
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
Return the different classes of races.
SELECT DISTINCT CLASS FROM race
[{'Class': 'DP/GT'}, {'Class': 'GT'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Return the nationalities for which there are two or more people.[/QUESTION] [SQL]SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2[/SQL]
[QUESTION]Return the nationalities for which there are two or more people.[/QUESTION] [SQL]SELECT Nationality FROM people GROUP BY Nationality HAVING COUNT(*) >= 2[/SQL]
movie_1
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") )
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) /* 2 rows from Movie table: mID title year director 101 Gone with the Wind 1939 Victor Fleming 102 Star Wars 1977 George Lucas */ CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) /* 2 rows from Rating table: rID mID stars ratingDate 201 101 2 2011-01-22 201 101 4 2011-01-27 */ CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") ) /* 2 rows from Reviewer table: rID name 201 Sarah Martinez 202 Daniel Lewis */
Find the average rating star for each movie that are not reviewed by Brittany Harris.
SELECT mID , avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
[{'mID': 101, 'avg(stars)': 3.0}, {'mID': 104, 'avg(stars)': 2.5}, {'mID': 106, 'avg(stars)': 4.5}, {'mID': 107, 'avg(stars)': 4.0}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
e_government
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), town_city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Forms" ( form_id INTEGER, form_type_code VARCHAR(15) NOT NULL, service_id INTEGER, form_number VARCHAR(50), form_name VARCHAR(80), form_description VARCHAR(255), PRIMARY KEY (form_id), FOREIGN KEY(service_id) REFERENCES "Services" (service_id) ) CREATE TABLE "Individuals" ( individual_id INTEGER, individual_first_name VARCHAR(80), individual_middle_name VARCHAR(80), inidividual_phone VARCHAR(80), individual_email VARCHAR(80), individual_address VARCHAR(255), individual_last_name VARCHAR(80), PRIMARY KEY (individual_id) ) CREATE TABLE "Organization_Contact_Individuals" ( individual_id INTEGER NOT NULL, organization_id INTEGER NOT NULL, date_contact_from DATETIME NOT NULL, date_contact_to DATETIME, PRIMARY KEY (individual_id, organization_id), FOREIGN KEY(individual_id) REFERENCES "Individuals" (individual_id), FOREIGN KEY(organization_id) REFERENCES "Organizations" (organization_id) ) CREATE TABLE "Organizations" ( organization_id INTEGER, date_formed DATETIME, organization_name VARCHAR(255), uk_vat_number VARCHAR(20), PRIMARY KEY (organization_id) ) CREATE TABLE "Parties" ( party_id INTEGER, payment_method_code VARCHAR(15) NOT NULL, party_phone VARCHAR(80), party_email VARCHAR(80), PRIMARY KEY (party_id) ) CREATE TABLE "Party_Addresses" ( party_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type_code VARCHAR(15) NOT NULL, date_address_to DATETIME, PRIMARY KEY (party_id, address_id), FOREIGN KEY(party_id) REFERENCES "Parties" (party_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Party_Forms" ( party_id INTEGER NOT NULL, form_id INTEGER NOT NULL, date_completion_started DATETIME NOT NULL, form_status_code VARCHAR(15) NOT NULL, date_fully_completed DATETIME, PRIMARY KEY (party_id, form_id), FOREIGN KEY(form_id) REFERENCES "Forms" (form_id), FOREIGN KEY(party_id) REFERENCES "Parties" (party_id) ) CREATE TABLE "Party_Services" ( booking_id INTEGER NOT NULL, customer_id INTEGER NOT NULL, service_id INTEGER NOT NULL, service_datetime DATETIME NOT NULL, booking_made_date DATETIME, FOREIGN KEY(customer_id) REFERENCES "Parties" (party_id), FOREIGN KEY(service_id) REFERENCES "Services" (service_id) ) CREATE TABLE "Services" ( service_id INTEGER, service_type_code VARCHAR(15) NOT NULL, service_name VARCHAR(80), service_descriptio VARCHAR(255), PRIMARY KEY (service_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), town_city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1_number_building town_city zip_postcode state_province_county country 1 25518 Ortiz Centers West Stacy 193 NorthCarolina USA 2 033 Stracke Parkways Lake Meaghan 227 Colorado USA */ CREATE TABLE "Forms" ( form_id INTEGER, form_type_code VARCHAR(15) NOT NULL, service_id INTEGER, form_number VARCHAR(50), form_name VARCHAR(80), form_description VARCHAR(255), PRIMARY KEY (form_id), FOREIGN KEY(service_id) REFERENCES "Services" (service_id) ) /* 2 rows from Forms table: form_id form_type_code service_id form_number form_name form_description 1 Basic 13 8069 SSN Application Form for SSN Application 2 Complex 9 2675 Marriage Certificate Marriage Certificate */ CREATE TABLE "Individuals" ( individual_id INTEGER, individual_first_name VARCHAR(80), individual_middle_name VARCHAR(80), inidividual_phone VARCHAR(80), individual_email VARCHAR(80), individual_address VARCHAR(255), individual_last_name VARCHAR(80), PRIMARY KEY (individual_id) ) /* 2 rows from Individuals table: individual_id individual_first_name individual_middle_name inidividual_phone individual_email individual_address individual_last_name 1 Oscar Hosea 1-925-696-5232 [email protected] 6956 Lia Plaza Maggio 2 Geovanny Antonia 075.012.6775x409 [email protected] 69578 Baylee Prairie Kerluke */ CREATE TABLE "Organization_Contact_Individuals" ( individual_id INTEGER NOT NULL, organization_id INTEGER NOT NULL, date_contact_from DATETIME NOT NULL, date_contact_to DATETIME, PRIMARY KEY (individual_id, organization_id), FOREIGN KEY(individual_id) REFERENCES "Individuals" (individual_id), FOREIGN KEY(organization_id) REFERENCES "Organizations" (organization_id) ) /* 2 rows from Organization_Contact_Individuals table: individual_id organization_id date_contact_from date_contact_to 13 1 2016-08-16 22:09:11 2018-03-25 10:27:18 11 1 2017-03-02 00:00:16 2018-03-06 05:39:43 */ CREATE TABLE "Organizations" ( organization_id INTEGER, date_formed DATETIME, organization_name VARCHAR(255), uk_vat_number VARCHAR(20), PRIMARY KEY (organization_id) ) /* 2 rows from Organizations table: organization_id date_formed organization_name uk_vat_number 1 2016-08-24 23:52:48 Labour Party 2157 2 2016-10-01 12:42:01 Plaid Cymru 7459 */ CREATE TABLE "Parties" ( party_id INTEGER, payment_method_code VARCHAR(15) NOT NULL, party_phone VARCHAR(80), party_email VARCHAR(80), PRIMARY KEY (party_id) ) /* 2 rows from Parties table: party_id payment_method_code party_phone party_email 1 Cheque 05374656172 [email protected] 2 Credit Card 1-525-947-7867x51521 [email protected] */ CREATE TABLE "Party_Addresses" ( party_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_address_from DATETIME NOT NULL, address_type_code VARCHAR(15) NOT NULL, date_address_to DATETIME, PRIMARY KEY (party_id, address_id), FOREIGN KEY(party_id) REFERENCES "Parties" (party_id), FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Party_Addresses table: party_id address_id date_address_from address_type_code date_address_to 10 8 2016-04-08 22:40:02 Residence 2018-02-28 23:14:41 15 5 2016-05-20 23:22:06 Billing 2018-01-29 16:48:01 */ CREATE TABLE "Party_Forms" ( party_id INTEGER NOT NULL, form_id INTEGER NOT NULL, date_completion_started DATETIME NOT NULL, form_status_code VARCHAR(15) NOT NULL, date_fully_completed DATETIME, PRIMARY KEY (party_id, form_id), FOREIGN KEY(form_id) REFERENCES "Forms" (form_id), FOREIGN KEY(party_id) REFERENCES "Parties" (party_id) ) /* 2 rows from Party_Forms table: party_id form_id date_completion_started form_status_code date_fully_completed 2 4 2017-12-17 11:29:47 Completed 2018-02-11 16:46:10 15 4 2017-12-16 15:25:48 Partially Completed 2018-02-18 16:09:04 */ CREATE TABLE "Party_Services" ( booking_id INTEGER NOT NULL, customer_id INTEGER NOT NULL, service_id INTEGER NOT NULL, service_datetime DATETIME NOT NULL, booking_made_date DATETIME, FOREIGN KEY(customer_id) REFERENCES "Parties" (party_id), FOREIGN KEY(service_id) REFERENCES "Services" (service_id) ) /* 2 rows from Party_Services table: booking_id customer_id service_id service_datetime booking_made_date 1 10 12 2018-03-10 22:43:12 2018-03-23 23:56:51 2 14 11 2018-03-05 15:06:23 2018-03-25 11:08:29 */ CREATE TABLE "Services" ( service_id INTEGER, service_type_code VARCHAR(15) NOT NULL, service_name VARCHAR(80), service_descriptio VARCHAR(255), PRIMARY KEY (service_id) ) /* 2 rows from Services table: service_id service_type_code service_name service_descriptio 1 Education Education Education 2 Welfare Health Welfare */
Which state can address "6862 Kaitlyn Knolls" possibly be in?
SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE "%6862 Kaitlyn Knolls%"
[{'state_province_county': 'Pennsylvania'}]
Easy
false
true
false
false
false
false
false
false
false
false
false
false
false
movie_1
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") )
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) /* 2 rows from Movie table: mID title year director 101 Gone with the Wind 1939 Victor Fleming 102 Star Wars 1977 George Lucas */ CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) /* 2 rows from Rating table: rID mID stars ratingDate 201 101 2 2011-01-22 201 101 4 2011-01-27 */ CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") ) /* 2 rows from Reviewer table: rID name 201 Sarah Martinez 202 Daniel Lewis */
What is the reviewer id of Daniel Lewis?
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis"
[{'rID': 202}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
climbing
CREATE TABLE climber ( "Climber_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Time" TEXT, "Points" REAL, "Mountain_ID" INTEGER, PRIMARY KEY ("Climber_ID"), FOREIGN KEY("Mountain_ID") REFERENCES mountain ("Mountain_ID") ) CREATE TABLE mountain ( "Mountain_ID" INTEGER, "Name" TEXT, "Height" REAL, "Prominence" REAL, "Range" TEXT, "Country" TEXT, PRIMARY KEY ("Mountain_ID") )
CREATE TABLE climber ( "Climber_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Time" TEXT, "Points" REAL, "Mountain_ID" INTEGER, PRIMARY KEY ("Climber_ID"), FOREIGN KEY("Mountain_ID") REFERENCES mountain ("Mountain_ID") ) /* 2 rows from climber table: Climber_ID Name Country Time Points Mountain_ID 1 Klaus Enders West Germany 1:13.05.6 15.0 1 2 Siegfried Schauzu West Germany 1:14.56.4 12.0 1 */ CREATE TABLE mountain ( "Mountain_ID" INTEGER, "Name" TEXT, "Height" REAL, "Prominence" REAL, "Range" TEXT, "Country" TEXT, PRIMARY KEY ("Mountain_ID") ) /* 2 rows from mountain table: Mountain_ID Name Height Prominence Range Country 1 Kibo (Uhuru Pk) 5895.0 5885.0 Kilimanjaro Tanzania 2 Mount Kenya (Batian) 5199.0 3825.0 Mount Kenya Kenya */
Return the maximum number of points for climbers from the United Kingdom.
SELECT max(Points) FROM climber WHERE Country = "United Kingdom"
[{'max(Points)': 3.0}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
e_learning
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) )
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) /* 2 rows from Course_Authors_and_Tutors table: author_id author_tutor_ATB login_name password personal_name middle_name family_name gender_mf address_line_1 1 331 jmckenzie c40fa148bdd0d2d45cd6e9ec1e685750fe07f81b Cathrine Ruthie Grant 0 756 Monahan Mews Spinkashire, NJ 64230-5098 2 975 heidenreich.ara 24b0ee84063c3b017ab1839e01b7280f47f7c7c2 Retha Corene Armstrong 0 98623 Huels Manor Jasttown, DE 31611 */ CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) /* 2 rows from Courses table: course_id author_id subject_id course_name course_description 1 8 1 database database 2 6 1 advanced database advanced database */ CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Enrolment table: registration_id student_id course_id date_of_enrolment date_of_completion 1 11 2 2017-10-09 07:09:02 2018-02-26 07:48:52 2 15 4 2017-11-13 12:49:33 2018-03-04 01:24:56 */ CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) /* 2 rows from Student_Tests_Taken table: registration_id date_test_taken test_result 12 2018-03-25 03:27:16 Fail 10 2018-03-25 21:50:22 Pass */ CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) /* 2 rows from Students table: student_id date_of_registration date_of_latest_logon login_name password personal_name middle_name family_name 1 2015-07-22 13:32:35 2017-10-17 22:52:26 annamae.hoppe db8765bb6f Wilson Aubrey Ward 2 2015-07-02 00:21:42 2017-06-24 22:16:27 wmiller 35faf8182a Karson Luella Jaskolski */ CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) ) /* 2 rows from Subjects table: subject_id subject_name 1 Computer Science 2 Arts */
How many courses are there in total?
SELECT count(*) FROM COURSES
[{'count(*)': 15}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many courses are there?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses are there?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses are there?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses are there?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
club_1
CREATE TABLE "Club" ( "ClubID" INTEGER, "ClubName" VARCHAR(40), "ClubDesc" VARCHAR(1024), "ClubLocation" VARCHAR(40), PRIMARY KEY ("ClubID") ) CREATE TABLE "Member_of_club" ( "StuID" INTEGER, "ClubID" INTEGER, "Position" VARCHAR(40), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("ClubID") REFERENCES "Club" ("ClubID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") )
CREATE TABLE "Club" ( "ClubID" INTEGER, "ClubName" VARCHAR(40), "ClubDesc" VARCHAR(1024), "ClubLocation" VARCHAR(40), PRIMARY KEY ("ClubID") ) /* 2 rows from Club table: ClubID ClubName ClubDesc ClubLocation 1 Bootup Baltimore Refurbish computers; teach kids and adults about computer basics. AKW 2 Hopkins Student Enterprises Venture capital fund for student business. AKW */ CREATE TABLE "Member_of_club" ( "StuID" INTEGER, "ClubID" INTEGER, "Position" VARCHAR(40), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("ClubID") REFERENCES "Club" ("ClubID") ) /* 2 rows from Member_of_club table: StuID ClubID Position 1001 1 President 1007 4 Vice-President */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */
Find the average age of the members in the club "Bootup Baltimore".
SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = "Bootup Baltimore"
[{'avg(t3.age)': 17.5}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]What is the average age of the visitors whose membership level is not higher than 4?[/QUESTION] [SQL]SELECT avg(age) FROM visitor WHERE Level_of_membership <= 4[/SQL]
school_player
CREATE TABLE player ( "Player_ID" INTEGER, "Player" TEXT, "Team" TEXT, "Age" INTEGER, "Position" TEXT, "School_ID" INTEGER, PRIMARY KEY ("Player_ID"), FOREIGN KEY("School_ID") REFERENCES school ("School_ID") ) CREATE TABLE school ( "School_ID" INTEGER, "School" TEXT, "Location" TEXT, "Enrollment" REAL, "Founded" REAL, "Denomination" TEXT, "Boys_or_Girls" TEXT, "Day_or_Boarding" TEXT, "Year_Entered_Competition" REAL, "School_Colors" TEXT, PRIMARY KEY ("School_ID") ) CREATE TABLE school_details ( "School_ID" INTEGER, "Nickname" TEXT, "Colors" TEXT, "League" TEXT, "Class" TEXT, "Division" TEXT, PRIMARY KEY ("School_ID"), FOREIGN KEY("School_ID") REFERENCES school ("School_ID") ) CREATE TABLE school_performance ( "School_Id" INTEGER, "School_Year" TEXT, "Class_A" TEXT, "Class_AA" TEXT, PRIMARY KEY ("School_Id", "School_Year"), FOREIGN KEY("School_Id") REFERENCES school ("School_ID") )
CREATE TABLE player ( "Player_ID" INTEGER, "Player" TEXT, "Team" TEXT, "Age" INTEGER, "Position" TEXT, "School_ID" INTEGER, PRIMARY KEY ("Player_ID"), FOREIGN KEY("School_ID") REFERENCES school ("School_ID") ) /* 2 rows from player table: Player_ID Player Team Age Position School_ID 1 Timothy Beckham Tampa Bay Devil Rays 15 Shortstop 1 2 Pedro Álvarez Pittsburgh Pirates 14 Third baseman 2 */ CREATE TABLE school ( "School_ID" INTEGER, "School" TEXT, "Location" TEXT, "Enrollment" REAL, "Founded" REAL, "Denomination" TEXT, "Boys_or_Girls" TEXT, "Day_or_Boarding" TEXT, "Year_Entered_Competition" REAL, "School_Colors" TEXT, PRIMARY KEY ("School_ID") ) /* 2 rows from school table: School_ID School Location Enrollment Founded Denomination Boys_or_Girls Day_or_Boarding Year_Entered_Competition School_Colors 1 St Aloysius' College Milsons Point 1200.0 1879.0 Catholic Boys Day 1929.0 Royal Blue and Gold 2 Barker College Hornsby 2300.0 1890.0 Anglican Boys only to Yr 9 Co-ed Year 10 to 12 Day & Boarding 1929.0 Red & Blue */ CREATE TABLE school_details ( "School_ID" INTEGER, "Nickname" TEXT, "Colors" TEXT, "League" TEXT, "Class" TEXT, "Division" TEXT, PRIMARY KEY ("School_ID"), FOREIGN KEY("School_ID") REFERENCES school ("School_ID") ) /* 2 rows from school_details table: School_ID Nickname Colors League Class Division 1 Tigers Blue and Yellow DSHA Flight A Division 1 2 Auks Dark Green and White DSHA Flight B Division 3 */ CREATE TABLE school_performance ( "School_Id" INTEGER, "School_Year" TEXT, "Class_A" TEXT, "Class_AA" TEXT, PRIMARY KEY ("School_Id", "School_Year"), FOREIGN KEY("School_Id") REFERENCES school ("School_ID") ) /* 2 rows from school_performance table: School_Id School_Year Class_A Class_AA 1 1987-88 Yantis Blanco 1 1988-89 Happy Blanco */
Find the team of each player and sort them in ascending alphabetical order.
SELECT Team FROM player ORDER BY Team ASC
[{'Team': 'Baltimore Orioles'}, {'Team': 'Chicago Cubs'}, {'Team': 'Chicago White Sox'}, {'Team': 'Cincinnati Reds'}, {'Team': 'Detroit Tigers'}, {'Team': 'Florida Marlins'}, {'Team': 'Houston Astros'}, {'Team': 'Kansas City Royals'}, {'Team': 'Los Angeles Dodgers'}, {'Team': 'Milwaukee Brewers'}, {'Team': 'Minnesota Twins'}, {'Team': 'New York Mets'}, {'Team': 'New York Mets'}, {'Team': 'Oakland Athletics'}, {'Team': 'Pittsburgh Pirates'}, {'Team': 'San Diego Padres'}, {'Team': 'San Francisco Giants'}, {'Team': 'Seattle Mariners'}, {'Team': 'St. Louis Cardinals'}, {'Team': 'Tampa Bay Devil Rays'}, {'Team': 'Texas Rangers'}, {'Team': 'Toronto Blue Jays'}, {'Team': 'Washington Nationals'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]Find the total number of players.[/QUESTION] [SQL]SELECT count(*) FROM players[/SQL]
[QUESTION]Find the total number of players.[/QUESTION] [SQL]SELECT count(*) FROM players[/SQL]
[QUESTION]Find the total number of players.[/QUESTION] [SQL]SELECT count(*) FROM players[/SQL]
[QUESTION]Find the total number of players.[/QUESTION] [SQL]SELECT count(*) FROM players[/SQL]
bike_1
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER )
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) /* 2 rows from station table: id name lat long dock_count city installation_date 2 San Jose Diridon Caltrain Station 37.3297320000 -121.9017820000 27 San Jose 8/6/2013 3 San Jose Civic Center 37.3306980000 -121.8889790000 15 San Jose 8/5/2013 */ CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) /* 2 rows from status table: station_id bikes_available docks_available time 3 12 3 2015-06-02 12:46:02 3 12 3 2015-06-02 12:47:02 */ CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) /* 2 rows from trip table: id duration start_date start_station_name start_station_id end_date end_station_name end_station_id bike_id subscription_type zip_code 900504 384 8/21/2015 17:03 Howard at 2nd 63 8/21/2015 17:10 San Francisco Caltrain 2 (330 Townsend) 69 454 Subscriber 94041 900505 588 8/21/2015 17:03 South Van Ness at Market 66 8/21/2015 17:13 San Francisco Caltrain 2 (330 Townsend) 69 574 Subscriber 95119 */ CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) /* 2 rows from weather table: date max_temperature_f mean_temperature_f min_temperature_f max_dew_point_f mean_dew_point_f min_dew_point_f max_humidity mean_humidity min_humidity max_sea_level_pressure_inches mean_sea_level_pressure_inches min_sea_level_pressure_inches max_visibility_miles mean_visibility_miles min_visibility_miles max_wind_Speed_mph mean_wind_speed_mph max_gust_speed_mph precipitation_inches cloud_cover events wind_dir_degrees zip_code 8/29/2013 74 68 61 61 58 56 93 75 57 30.0700000000 30.0200000000 29.9700000000 10 10 10 23 11 28 0 4 286 94107 8/30/2013 78 69 60 61 58 56 90 70 50 30.0500000000 30.0000000000 29.9300000000 10 10 7 29 13 35 0 2 291 94107 */
How many stations does Mountain View city has?
SELECT COUNT(*) FROM station WHERE city = "Mountain View"
[{'COUNT(*)': 7}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many parks does Atlanta city have?[/QUESTION] [SQL]SELECT count(*) FROM park WHERE city = 'Atlanta';[/SQL]
[QUESTION]How many parks does Atlanta city have?[/QUESTION] [SQL]SELECT count(*) FROM park WHERE city = 'Atlanta';[/SQL]
[QUESTION]How many parks does Atlanta city have?[/QUESTION] [SQL]SELECT count(*) FROM park WHERE city = 'Atlanta';[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what is the population of the capital of the largest state through which the mississippi runs
SELECT population FROM city WHERE city_name = ( SELECT capital FROM state WHERE area = ( SELECT MAX ( t1.area ) FROM state AS t1 JOIN river AS t2 ON t1.state_name = t2.traverse WHERE t2.river_name = "mississippi" ) );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
true
false
true
false
false
false
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
e_learning
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) )
CREATE TABLE "Course_Authors_and_Tutors" ( author_id INTEGER, "author_tutor_ATB" VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80), PRIMARY KEY (author_id) ) /* 2 rows from Course_Authors_and_Tutors table: author_id author_tutor_ATB login_name password personal_name middle_name family_name gender_mf address_line_1 1 331 jmckenzie c40fa148bdd0d2d45cd6e9ec1e685750fe07f81b Cathrine Ruthie Grant 0 756 Monahan Mews Spinkashire, NJ 64230-5098 2 975 heidenreich.ara 24b0ee84063c3b017ab1839e01b7280f47f7c7c2 Retha Corene Armstrong 0 98623 Huels Manor Jasttown, DE 31611 */ CREATE TABLE "Courses" ( course_id INTEGER, author_id INTEGER NOT NULL, subject_id INTEGER NOT NULL, course_name VARCHAR(120), course_description VARCHAR(255), PRIMARY KEY (course_id), FOREIGN KEY(subject_id) REFERENCES "Subjects" (subject_id), FOREIGN KEY(author_id) REFERENCES "Course_Authors_and_Tutors" (author_id) ) /* 2 rows from Courses table: course_id author_id subject_id course_name course_description 1 8 1 database database 2 6 1 advanced database advanced database */ CREATE TABLE "Student_Course_Enrolment" ( registration_id INTEGER, student_id INTEGER NOT NULL, course_id INTEGER NOT NULL, date_of_enrolment DATETIME NOT NULL, date_of_completion DATETIME NOT NULL, PRIMARY KEY (registration_id), FOREIGN KEY(student_id) REFERENCES "Students" (student_id), FOREIGN KEY(course_id) REFERENCES "Courses" (course_id) ) /* 2 rows from Student_Course_Enrolment table: registration_id student_id course_id date_of_enrolment date_of_completion 1 11 2 2017-10-09 07:09:02 2018-02-26 07:48:52 2 15 4 2017-11-13 12:49:33 2018-03-04 01:24:56 */ CREATE TABLE "Student_Tests_Taken" ( registration_id INTEGER NOT NULL, date_test_taken DATETIME NOT NULL, test_result VARCHAR(255), FOREIGN KEY(registration_id) REFERENCES "Student_Course_Enrolment" (registration_id) ) /* 2 rows from Student_Tests_Taken table: registration_id date_test_taken test_result 12 2018-03-25 03:27:16 Fail 10 2018-03-25 21:50:22 Pass */ CREATE TABLE "Students" ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40), PRIMARY KEY (student_id) ) /* 2 rows from Students table: student_id date_of_registration date_of_latest_logon login_name password personal_name middle_name family_name 1 2015-07-22 13:32:35 2017-10-17 22:52:26 annamae.hoppe db8765bb6f Wilson Aubrey Ward 2 2015-07-02 00:21:42 2017-06-24 22:16:27 wmiller 35faf8182a Karson Luella Jaskolski */ CREATE TABLE "Subjects" ( subject_id INTEGER, subject_name VARCHAR(120), PRIMARY KEY (subject_id) ) /* 2 rows from Subjects table: subject_id subject_name 1 Computer Science 2 Arts */
Find the names of courses taught by the tutor who has personal name "Julio".
SELECT T2.course_name FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id WHERE T1.personal_name = "Julio"
[{'course_name': 'Japanese'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]Find names of all students who took some course and the course description.[/QUESTION] [SQL]SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code[/SQL]
[QUESTION]Find names of all students who took some course and the course description.[/QUESTION] [SQL]SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code[/SQL]
[QUESTION]Find names of all students who took some course and the course description.[/QUESTION] [SQL]SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code[/SQL]
[QUESTION]Find names of all students who took some course and the course description.[/QUESTION] [SQL]SELECT T1.stu_fname , T1.stu_lname , T4.crs_description FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num JOIN CLASS AS T3 ON T2.class_code = T3.class_code JOIN course AS T4 ON T3.crs_code = T4.crs_code[/SQL]
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
Return the minimum, maximum, and average seating across all tracks.
SELECT min(seating) , max(seating) , avg(seating) FROM track
[{'min(seating)': 63000.0, 'max(seating)': 168000.0, 'avg(seating)': 91526.88888888889}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Return the minimum, average and maximum distances traveled across all aircrafts.[/QUESTION] [SQL]SELECT min(distance) , avg(distance) , max(distance) FROM Aircraft[/SQL]
[QUESTION]Return the minimum, average and maximum distances traveled across all aircrafts.[/QUESTION] [SQL]SELECT min(distance) , avg(distance) , max(distance) FROM Aircraft[/SQL]
movie_1
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") )
CREATE TABLE "Movie" ( "mID" INTEGER, title TEXT, year INTEGER, director TEXT, PRIMARY KEY ("mID") ) /* 2 rows from Movie table: mID title year director 101 Gone with the Wind 1939 Victor Fleming 102 Star Wars 1977 George Lucas */ CREATE TABLE "Rating" ( "rID" INTEGER, "mID" INTEGER, stars INTEGER, "ratingDate" DATE, FOREIGN KEY("mID") REFERENCES "Movie" ("mID"), FOREIGN KEY("rID") REFERENCES "Reviewer" ("rID") ) /* 2 rows from Rating table: rID mID stars ratingDate 201 101 2 2011-01-22 201 101 4 2011-01-27 */ CREATE TABLE "Reviewer" ( "rID" INTEGER, name TEXT, PRIMARY KEY ("rID") ) /* 2 rows from Reviewer table: rID name 201 Sarah Martinez 202 Daniel Lewis */
What is the id of the reviewer named Daniel Lewis?
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis"
[{'rID': 202}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
entertainment_awards
CREATE TABLE artwork ( "Artwork_ID" INTEGER, "Type" TEXT, "Name" TEXT, PRIMARY KEY ("Artwork_ID") ) CREATE TABLE festival_detail ( "Festival_ID" INTEGER, "Festival_Name" TEXT, "Chair_Name" TEXT, "Location" TEXT, "Year" INTEGER, "Num_of_Audience" INTEGER, PRIMARY KEY ("Festival_ID") ) CREATE TABLE nomination ( "Artwork_ID" INTEGER, "Festival_ID" INTEGER, "Result" TEXT, PRIMARY KEY ("Artwork_ID", "Festival_ID"), FOREIGN KEY("Festival_ID") REFERENCES festival_detail ("Festival_ID"), FOREIGN KEY("Artwork_ID") REFERENCES artwork ("Artwork_ID") )
CREATE TABLE artwork ( "Artwork_ID" INTEGER, "Type" TEXT, "Name" TEXT, PRIMARY KEY ("Artwork_ID") ) /* 2 rows from artwork table: Artwork_ID Type Name 1 Program Music/Variety Show Indonesian Idol 2 Program Music/Variety Show I Know */ CREATE TABLE festival_detail ( "Festival_ID" INTEGER, "Festival_Name" TEXT, "Chair_Name" TEXT, "Location" TEXT, "Year" INTEGER, "Num_of_Audience" INTEGER, PRIMARY KEY ("Festival_ID") ) /* 2 rows from festival_detail table: Festival_ID Festival_Name Chair_Name Location Year Num_of_Audience 1 Panasonic Awards Raymond Floyd United States 2006 152 2 Flower Awards Charles Coody United States 2007 155 */ CREATE TABLE nomination ( "Artwork_ID" INTEGER, "Festival_ID" INTEGER, "Result" TEXT, PRIMARY KEY ("Artwork_ID", "Festival_ID"), FOREIGN KEY("Festival_ID") REFERENCES festival_detail ("Festival_ID"), FOREIGN KEY("Artwork_ID") REFERENCES artwork ("Artwork_ID") ) /* 2 rows from nomination table: Artwork_ID Festival_ID Result 1 2 Nominated 2 2 Won */
List the year in which there are more than one festivals.
SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*) > 1
[{'Year': 2007}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
Papers by Peter Mertens and Dina Barbian
SELECT DISTINCT t3.paperid FROM writes AS t3 JOIN author AS t2 ON t3.authorid = t2.authorid JOIN writes AS t4 ON t4.paperid = t3.paperid JOIN author AS t1 ON t4.authorid = t1.authorid WHERE t2.authorname = "Peter Mertens" AND t1.authorname = "Dina Barbian";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
race_track
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") )
CREATE TABLE race ( "Race_ID" INTEGER, "Name" TEXT, "Class" TEXT, "Date" TEXT, "Track_ID" TEXT, PRIMARY KEY ("Race_ID"), FOREIGN KEY("Track_ID") REFERENCES track ("Track_ID") ) /* 2 rows from race table: Race_ID Name Class Date Track_ID 1 Rolex 24 At Daytona DP/GT January 26 January 27 1 2 Gainsco Grand Prix of Miami DP/GT March 29 2 */ CREATE TABLE track ( "Track_ID" INTEGER, "Name" TEXT, "Location" TEXT, "Seating" REAL, "Year_Opened" REAL, PRIMARY KEY ("Track_ID") ) /* 2 rows from track table: Track_ID Name Location Seating Year_Opened 1 Auto Club Speedway Fontana, CA 92000.0 1997.0 2 Chicagoland Speedway Joliet, IL 75000.0 2001.0 */
Return the names of tracks that have no had any races.
SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)
[{'Name': 'Darlington Raceway'}, {'Name': 'Michigan International Speedway'}, {'Name': 'Phoenix International Raceway'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
game_1
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") )
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from Plays_Games table: StuID GameID Hours_Played 1001 1 35 1001 2 15 */ CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from SportsInfo table: StuID SportName HoursPerWeek GamesPlayed OnScholarship 1001 Athletics 2 5 N 1002 Football 7 20 Y */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */ CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") ) /* 2 rows from Video_Games table: GameID GName GType 1 RNG Stone Collectible card game 2 The Vanishing of Eric Calder Walking Simulator */
How many students play video games?
SELECT count(DISTINCT StuID) FROM Plays_games
[{'count(DISTINCT StuID)': 5}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many friends does each student have?[/QUESTION] [SQL]SELECT student_id , count(*) FROM Friend GROUP BY student_id[/SQL]
[QUESTION]How many friends does each student have?[/QUESTION] [SQL]SELECT student_id , count(*) FROM Friend GROUP BY student_id[/SQL]
tracking_orders
CREATE TABLE "Customers" ( customer_id INTEGER, customer_name VARCHAR(80), customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255), PRIMARY KEY (invoice_number) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status VARCHAR(10) NOT NULL, order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255), PRIMARY KEY (shipment_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) )
CREATE TABLE "Customers" ( customer_id INTEGER, customer_name VARCHAR(80), customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_name customer_details 1 Savannah rerum 2 George est */ CREATE TABLE "Invoices" ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(255), PRIMARY KEY (invoice_number) ) /* 2 rows from Invoices table: invoice_number invoice_date invoice_details 1 1989-09-03 16:03:05 vitae 2 1989-12-11 16:40:57 magnam */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, product_id INTEGER NOT NULL, order_id INTEGER NOT NULL, order_item_status VARCHAR(10) NOT NULL, order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Order_Items table: order_item_id product_id order_id order_item_status order_item_details 1 4 6 Finish None 2 15 6 Finish None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_status VARCHAR(10) NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id order_status date_order_placed order_details 1 2 Shipped 2009-02-21 15:26:19 None 2 11 Shipped 1974-06-24 22:10:26 None */ CREATE TABLE "Products" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_name product_details 1 food None 2 book None */ CREATE TABLE "Shipment_Items" ( shipment_id INTEGER NOT NULL, order_item_id INTEGER NOT NULL, FOREIGN KEY(shipment_id) REFERENCES "Shipments" (shipment_id), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Shipment_Items table: shipment_id order_item_id 11 12 10 15 */ CREATE TABLE "Shipments" ( shipment_id INTEGER, order_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255), PRIMARY KEY (shipment_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Shipments table: shipment_id order_id invoice_number shipment_tracking_number shipment_date other_shipment_details 1 5 13 3452 1983-08-13 22:34:11 None 2 7 2 0114 1977-11-10 12:11:25 None */
Find the id of the customer who made the most orders.
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
[{'customer_id': 15}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
[QUESTION]List the name of all customers sorted by their account balance in ascending order.[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
wine_1
CREATE TABLE appellations ( "No" INTEGER, "Appelation" TEXT, "County" TEXT, "State" TEXT, "Area" TEXT, "isAVA" TEXT, PRIMARY KEY ("No"), UNIQUE ("Appelation") ) CREATE TABLE grapes ( "ID" INTEGER, "Grape" TEXT, "Color" TEXT, PRIMARY KEY ("ID"), UNIQUE ("Grape") ) CREATE TABLE wine ( "No" INTEGER, "Grape" TEXT, "Winery" TEXT, "Appelation" TEXT, "State" TEXT, "Name" TEXT, "Year" INTEGER, "Price" INTEGER, "Score" INTEGER, "Cases" INTEGER, "Drink" TEXT, FOREIGN KEY("Grape") REFERENCES grapes ("Grape"), FOREIGN KEY("Appelation") REFERENCES appellations ("Appelation") )
CREATE TABLE appellations ( "No" INTEGER, "Appelation" TEXT, "County" TEXT, "State" TEXT, "Area" TEXT, "isAVA" TEXT, PRIMARY KEY ("No"), UNIQUE ("Appelation") ) /* 2 rows from appellations table: No Appelation County State Area isAVA 1 Alexander Valley Sonoma California North Coast Yes 2 Amador County Amador California Sierra Foothills No */ CREATE TABLE grapes ( "ID" INTEGER, "Grape" TEXT, "Color" TEXT, PRIMARY KEY ("ID"), UNIQUE ("Grape") ) /* 2 rows from grapes table: ID Grape Color 1 Barbera Red 2 Cabernet Franc Red */ CREATE TABLE wine ( "No" INTEGER, "Grape" TEXT, "Winery" TEXT, "Appelation" TEXT, "State" TEXT, "Name" TEXT, "Year" INTEGER, "Price" INTEGER, "Score" INTEGER, "Cases" INTEGER, "Drink" TEXT, FOREIGN KEY("Grape") REFERENCES grapes ("Grape"), FOREIGN KEY("Appelation") REFERENCES appellations ("Appelation") ) /* 2 rows from wine table: No Grape Winery Appelation State Name Year Price Score Cases Drink 1 Zinfandel Robert Biale St. Helena California Old Kraft Vineyard 2008 44 93 275 now 2 Zinfandel Chiarello Family Napa Valley California Giana 2008 35 93 480 now */
List the area and county of all appelations.
SELECT Area , County FROM APPELLATIONS
[{'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'Sierra Foothills', 'County': 'Amador'}, {'Area': 'N/A', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Mendocino'}, {'Area': 'Central Coast', 'County': 'San Luis Obispo'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'Sierra Foothills', 'County': 'Calaveras'}, {'Area': 'California', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'Central Coast', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'Central Coast', 'County': 'Monterey'}, {'Area': 'Santa Cruz Mountains', 'County': 'Contra Costa'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'Central Coast', 'County': 'San Luis Obispo'}, {'Area': 'Sierra Foothills', 'County': 'Amador'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Lake'}, {'Area': 'Central Coast', 'County': 'Santa Barbara'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Lake'}, {'Area': 'Santa Cruz Mountains', 'County': 'Alameda'}, {'Area': 'Central Valley', 'County': 'San Joaquin'}, {'Area': 'North Coast', 'County': 'Mendocino'}, {'Area': 'Central Coast', 'County': 'Monterey'}, {'Area': 'Central Coast', 'County': 'San Benito'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'North Coast', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'Central Coast', 'County': 'San Luis Obispo'}, {'Area': 'North Coast', 'County': 'Lake'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'Central Coast', 'County': 'San Luis Obispo'}, {'Area': 'Central Coast', 'County': 'Santa Barbara'}, {'Area': 'Santa Cruz Mountains', 'County': 'N/A'}, {'Area': 'Central Coast', 'County': 'Monterey'}, {'Area': 'Central Coast', 'County': 'Santa Barbara'}, {'Area': 'Central Coast', 'County': 'Santa Barbara'}, {'Area': 'Sierra Foothills', 'County': 'Amador'}, {'Area': 'Sierra Foothills', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Solano'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'Sonoma'}, {'Area': 'North Coast', 'County': 'N/A'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'Central Coast', 'County': 'Santa Barbara'}, {'Area': 'North Coast', 'County': 'Napa'}, {'Area': 'Central Valley', 'County': 'Yolo'}, {'Area': 'North Coast', 'County': 'Napa'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]List the names of states that have more than 2 parks.[/QUESTION] [SQL]SELECT state FROM park GROUP BY state HAVING count(*) > 2;[/SQL]
election
CREATE TABLE county ( "County_Id" INTEGER, "County_name" TEXT, "Population" REAL, "Zip_code" TEXT, PRIMARY KEY ("County_Id") ) CREATE TABLE election ( "Election_ID" INTEGER, "Counties_Represented" TEXT, "District" INTEGER, "Delegate" TEXT, "Party" INTEGER, "First_Elected" REAL, "Committee" TEXT, PRIMARY KEY ("Election_ID"), FOREIGN KEY("District") REFERENCES county ("County_Id"), FOREIGN KEY("Party") REFERENCES party ("Party_ID") ) CREATE TABLE party ( "Party_ID" INTEGER, "Year" REAL, "Party" TEXT, "Governor" TEXT, "Lieutenant_Governor" TEXT, "Comptroller" TEXT, "Attorney_General" TEXT, "US_Senate" TEXT, PRIMARY KEY ("Party_ID") )
CREATE TABLE county ( "County_Id" INTEGER, "County_name" TEXT, "Population" REAL, "Zip_code" TEXT, PRIMARY KEY ("County_Id") ) /* 2 rows from county table: County_Id County_name Population Zip_code 1 Howard 21000.0 D21 2 Baltimore County 90000.0 D08 */ CREATE TABLE election ( "Election_ID" INTEGER, "Counties_Represented" TEXT, "District" INTEGER, "Delegate" TEXT, "Party" INTEGER, "First_Elected" REAL, "Committee" TEXT, PRIMARY KEY ("Election_ID"), FOREIGN KEY("District") REFERENCES county ("County_Id"), FOREIGN KEY("Party") REFERENCES party ("Party_ID") ) /* 2 rows from election table: Election_ID Counties_Represented District Delegate Party First_Elected Committee 1 09.1 9A 1 Bates, Gail H. Gail H. Bates 1 2002.0 Appropriations 2 09.1 9A 1 Miller, Warren E. Warren E. Miller 1 2003.0 Economic Matters */ CREATE TABLE party ( "Party_ID" INTEGER, "Year" REAL, "Party" TEXT, "Governor" TEXT, "Lieutenant_Governor" TEXT, "Comptroller" TEXT, "Attorney_General" TEXT, "US_Senate" TEXT, PRIMARY KEY ("Party_ID") ) /* 2 rows from party table: Party_ID Year Party Governor Lieutenant_Governor Comptroller Attorney_General US_Senate 1 1998.0 Democratic Peter Vallone Sandra Frankel Carl McCall Eliot Spitzer Charles Schumer 2 1998.0 Liberal Betsy McCaughey Ross Jonathan Reiter Carl McCall Eliot Spitzer Charles Schumer */
Show the delegate from district 1 in election.
SELECT Delegate FROM election WHERE District = 1
[{'Delegate': 'Bates, Gail H. Gail H. Bates'}, {'Delegate': 'Miller, Warren E. Warren E. Miller'}, {'Delegate': 'Pendergrass, Shane E. Shane Pendergrass'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
cre_Docs_and_Epenses
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") )
CREATE TABLE "Accounts" ( "Account_ID" INTEGER NOT NULL, "Statement_ID" INTEGER NOT NULL, "Account_Details" VARCHAR(255), PRIMARY KEY ("Account_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Statements" ("Statement_ID") ) /* 2 rows from Accounts table: Account_ID Statement_ID Account_Details 7 57 495.063 61 57 930.14 */ CREATE TABLE "Documents" ( "Document_ID" INTEGER NOT NULL, "Document_Type_Code" CHAR(15) NOT NULL, "Project_ID" INTEGER NOT NULL, "Document_Date" DATETIME, "Document_Name" VARCHAR(255), "Document_Description" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Project_ID") REFERENCES "Projects" ("Project_ID") ) /* 2 rows from Documents table: Document_ID Document_Type_Code Project_ID Document_Date Document_Name Document_Description Other_Details 29 CV 30 2004-08-28 06:59:19 Review on UK files None None 42 BK 105 2012-12-27 19:09:18 Review on Canadian files None None */ CREATE TABLE "Documents_with_Expenses" ( "Document_ID" INTEGER NOT NULL, "Budget_Type_Code" CHAR(15) NOT NULL, "Document_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Budget_Type_Code") REFERENCES "Ref_Budget_Codes" ("Budget_Type_Code"), FOREIGN KEY("Document_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Documents_with_Expenses table: Document_ID Budget_Type_Code Document_Details 57 GV government 192 GV government */ CREATE TABLE "Projects" ( "Project_ID" INTEGER NOT NULL, "Project_Details" VARCHAR(255), PRIMARY KEY ("Project_ID") ) /* 2 rows from Projects table: Project_ID Project_Details 30 Society Research project 35 Internet of Things project */ CREATE TABLE "Ref_Budget_Codes" ( "Budget_Type_Code" CHAR(15) NOT NULL, "Budget_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Budget_Type_Code") ) /* 2 rows from Ref_Budget_Codes table: Budget_Type_Code Budget_Type_Description GV Government ORG Organisation */ CREATE TABLE "Ref_Document_Types" ( "Document_Type_Code" CHAR(15) NOT NULL, "Document_Type_Name" VARCHAR(255) NOT NULL, "Document_Type_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Document_Type_Code") ) /* 2 rows from Ref_Document_Types table: Document_Type_Code Document_Type_Name Document_Type_Description BK Book excellent CV CV excellent */ CREATE TABLE "Statements" ( "Statement_ID" INTEGER NOT NULL, "Statement_Details" VARCHAR(255), PRIMARY KEY ("Statement_ID"), FOREIGN KEY("Statement_ID") REFERENCES "Documents" ("Document_ID") ) /* 2 rows from Statements table: Statement_ID Statement_Details 57 Open Project 192 Private Project */
What are the type come, name, and description of the document that has either the name 'Noel CV' or 'King Book'?
SELECT document_type_code , document_name , document_description FROM Documents WHERE document_name = 'Noel CV' OR document_name = 'King Book'
[{'Document_Type_Code': 'BK', 'Document_Name': 'Noel CV', 'Document_Description': None}, {'Document_Type_Code': 'PP', 'Document_Name': 'King Book', 'Document_Description': None}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the document id, template id and description for document named "Robbin CV"?[/QUESTION] [SQL]SELECT document_id , template_id , Document_Description FROM Documents WHERE document_name = "Robbin CV"[/SQL]
[QUESTION]What is the document id, template id and description for document named "Robbin CV"?[/QUESTION] [SQL]SELECT document_id , template_id , Document_Description FROM Documents WHERE document_name = "Robbin CV"[/SQL]
[QUESTION]What is the document id, template id and description for document named "Robbin CV"?[/QUESTION] [SQL]SELECT document_id , template_id , Document_Description FROM Documents WHERE document_name = "Robbin CV"[/SQL]
[QUESTION]What is the document id, template id and description for document named "Robbin CV"?[/QUESTION] [SQL]SELECT document_id , template_id , Document_Description FROM Documents WHERE document_name = "Robbin CV"[/SQL]
apartment_rentals
CREATE TABLE "Apartment_Bookings" ( apt_booking_id INTEGER NOT NULL, apt_id INTEGER, guest_id INTEGER NOT NULL, booking_status_code CHAR(15) NOT NULL, booking_start_date DATETIME, booking_end_date DATETIME, PRIMARY KEY (apt_booking_id), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id), UNIQUE (apt_booking_id) ) CREATE TABLE "Apartment_Buildings" ( building_id INTEGER NOT NULL, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80), PRIMARY KEY (building_id), UNIQUE (building_id) ) CREATE TABLE "Apartment_Facilities" ( apt_id INTEGER NOT NULL, facility_code CHAR(15) NOT NULL, PRIMARY KEY (apt_id, facility_code), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id) ) CREATE TABLE "Apartments" ( apt_id INTEGER NOT NULL, building_id INTEGER NOT NULL, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5), PRIMARY KEY (apt_id), FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id), UNIQUE (apt_id) ) CREATE TABLE "Guests" ( guest_id INTEGER NOT NULL, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME, PRIMARY KEY (guest_id), UNIQUE (guest_id) ) CREATE TABLE "View_Unit_Status" ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME NOT NULL, available_yn NUMERIC, PRIMARY KEY (status_date), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id) )
CREATE TABLE "Apartment_Bookings" ( apt_booking_id INTEGER NOT NULL, apt_id INTEGER, guest_id INTEGER NOT NULL, booking_status_code CHAR(15) NOT NULL, booking_start_date DATETIME, booking_end_date DATETIME, PRIMARY KEY (apt_booking_id), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id), UNIQUE (apt_booking_id) ) /* 2 rows from Apartment_Bookings table: apt_booking_id apt_id guest_id booking_status_code booking_start_date booking_end_date 258 10 2 Provisional 2016-09-26 17:13:49 2017-10-07 11:38:48 279 15 15 Provisional 2016-04-01 06:28:08 2017-10-25 11:08:42 */ CREATE TABLE "Apartment_Buildings" ( building_id INTEGER NOT NULL, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80), PRIMARY KEY (building_id), UNIQUE (building_id) ) /* 2 rows from Apartment_Buildings table: building_id building_short_name building_full_name building_description building_address building_manager building_phone 133 Normandie Court Normandie Court Studio 7950 Casper Vista Apt. 176 Marquiseberg, CA 70496 Emma (948)040-1064x387 153 Mercedes House Mercedes House Studio 354 Otto Villages Charliefort, VT 71664 Brenden 915-617-2408x832 */ CREATE TABLE "Apartment_Facilities" ( apt_id INTEGER NOT NULL, facility_code CHAR(15) NOT NULL, PRIMARY KEY (apt_id, facility_code), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id) ) /* 2 rows from Apartment_Facilities table: apt_id facility_code 1 Boardband 2 Boardband */ CREATE TABLE "Apartments" ( apt_id INTEGER NOT NULL, building_id INTEGER NOT NULL, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5), PRIMARY KEY (apt_id), FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id), UNIQUE (apt_id) ) /* 2 rows from Apartments table: apt_id building_id apt_type_code apt_number bathroom_count bedroom_count room_count 1 808 Flat Suite 645 1 3 7 2 624 Flat Apt. 585 2 4 5 */ CREATE TABLE "Guests" ( guest_id INTEGER NOT NULL, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME, PRIMARY KEY (guest_id), UNIQUE (guest_id) ) /* 2 rows from Guests table: guest_id gender_code guest_first_name guest_last_name date_of_birth 1 Male Kip DuBuque 1995-11-04 07:09:57 2 Unknown Rebeca Runolfsdottir 1974-05-12 21:53:58 */ CREATE TABLE "View_Unit_Status" ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME NOT NULL, available_yn NUMERIC, PRIMARY KEY (status_date), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id) ) /* 2 rows from View_Unit_Status table: apt_id apt_booking_id status_date available_yn 11 920 1970-09-28 10:24:29 1.0000000000 15 575 1972-03-23 22:55:53 1.0000000000 */
What is the apartment number of the apartment with the most beds?
SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1
[{'apt_number': 'Apt. 908'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
pilot_record
CREATE TABLE aircraft ( "Aircraft_ID" INTEGER, "Order_Year" INTEGER, "Manufacturer" TEXT, "Model" TEXT, "Fleet_Series" TEXT, "Powertrain" TEXT, "Fuel_Propulsion" TEXT, PRIMARY KEY ("Aircraft_ID") ) CREATE TABLE pilot ( "Pilot_ID" INTEGER, "Pilot_name" TEXT, "Rank" INTEGER, "Age" INTEGER, "Nationality" TEXT, "Position" TEXT, "Join_Year" INTEGER, "Team" TEXT, PRIMARY KEY ("Pilot_ID") ) CREATE TABLE pilot_record ( "Record_ID" INTEGER, "Pilot_ID" INTEGER, "Aircraft_ID" INTEGER, "Date" TEXT, PRIMARY KEY ("Pilot_ID", "Aircraft_ID", "Date"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Pilot_ID") REFERENCES pilot ("Pilot_ID") )
CREATE TABLE aircraft ( "Aircraft_ID" INTEGER, "Order_Year" INTEGER, "Manufacturer" TEXT, "Model" TEXT, "Fleet_Series" TEXT, "Powertrain" TEXT, "Fuel_Propulsion" TEXT, PRIMARY KEY ("Aircraft_ID") ) /* 2 rows from aircraft table: Aircraft_ID Order_Year Manufacturer Model Fleet_Series Powertrain Fuel_Propulsion 1 1992 Gillig Phantom (High Floor) 444-464 (21) DD S50EGR Allison WB-400R Diesel 2 1996 Gillig Phantom (High Floor) 465-467 (3) DD S50 Allison WB-400R Diesel */ CREATE TABLE pilot ( "Pilot_ID" INTEGER, "Pilot_name" TEXT, "Rank" INTEGER, "Age" INTEGER, "Nationality" TEXT, "Position" TEXT, "Join_Year" INTEGER, "Team" TEXT, PRIMARY KEY ("Pilot_ID") ) /* 2 rows from pilot table: Pilot_ID Pilot_name Rank Age Nationality Position Join_Year Team 1 Patrick O'Bryant 13 33 United States Center Team 2009 Bradley 2 Jermaine O'Neal 6 40 United States Forward-Center Team 2008 Eau Claire High School */ CREATE TABLE pilot_record ( "Record_ID" INTEGER, "Pilot_ID" INTEGER, "Aircraft_ID" INTEGER, "Date" TEXT, PRIMARY KEY ("Pilot_ID", "Aircraft_ID", "Date"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Pilot_ID") REFERENCES pilot ("Pilot_ID") ) /* 2 rows from pilot_record table: Record_ID Pilot_ID Aircraft_ID Date 1 1 1 2003/01/04 2 2 1 2004/01/04 */
Show the names of pilots and fleet series of the aircrafts they have flied with in ascending order of the rank of the pilot.
SELECT T3.Pilot_name , T2.Fleet_Series FROM pilot_record AS T1 JOIN aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN pilot AS T3 ON T1.Pilot_ID = T3.Pilot_ID ORDER BY T3.Rank
[{'Pilot_name': "Jermaine O'Neal", 'Fleet_Series': '444-464 (21)'}, {'Pilot_name': "Patrick O'Bryant", 'Fleet_Series': '444-464 (21)'}, {'Pilot_name': "Patrick O'Bryant", 'Fleet_Series': '474-481 (8)'}, {'Pilot_name': "Patrick O'Bryant", 'Fleet_Series': '482-492 (11)'}, {'Pilot_name': 'Charles Oakley', 'Fleet_Series': '465-467 (3)'}, {'Pilot_name': "Dan O'Sullivan", 'Fleet_Series': '300-309 (10)'}]
Hard
false
false
false
true
false
false
false
false
true
false
false
false
false
[QUESTION]Show aircraft names and number of flights for each aircraft.[/QUESTION] [SQL]SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid[/SQL]
[QUESTION]Show aircraft names and number of flights for each aircraft.[/QUESTION] [SQL]SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid[/SQL]
[QUESTION]Show aircraft names and number of flights for each aircraft.[/QUESTION] [SQL]SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid[/SQL]
[QUESTION]Show aircraft names and number of flights for each aircraft.[/QUESTION] [SQL]SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid[/SQL]
gas_company
CREATE TABLE company ( "Company_ID" INTEGER, "Rank" INTEGER, "Company" TEXT, "Headquarters" TEXT, "Main_Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value" REAL, PRIMARY KEY ("Company_ID") ) CREATE TABLE gas_station ( "Station_ID" INTEGER, "Open_Year" INTEGER, "Location" TEXT, "Manager_Name" TEXT, "Vice_Manager_Name" TEXT, "Representative_Name" TEXT, PRIMARY KEY ("Station_ID") ) CREATE TABLE station_company ( "Station_ID" INTEGER, "Company_ID" INTEGER, "Rank_of_the_Year" INTEGER, PRIMARY KEY ("Station_ID", "Company_ID"), FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID"), FOREIGN KEY("Station_ID") REFERENCES gas_station ("Station_ID") )
CREATE TABLE company ( "Company_ID" INTEGER, "Rank" INTEGER, "Company" TEXT, "Headquarters" TEXT, "Main_Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value" REAL, PRIMARY KEY ("Company_ID") ) /* 2 rows from company table: Company_ID Rank Company Headquarters Main_Industry Sales_billion Profits_billion Assets_billion Market_Value 1 1 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4 2 3 General Electric USA Conglomerate 147.3 14.2 717.2 213.7 */ CREATE TABLE gas_station ( "Station_ID" INTEGER, "Open_Year" INTEGER, "Location" TEXT, "Manager_Name" TEXT, "Vice_Manager_Name" TEXT, "Representative_Name" TEXT, PRIMARY KEY ("Station_ID") ) /* 2 rows from gas_station table: Station_ID Open_Year Location Manager_Name Vice_Manager_Name Representative_Name 1 1998 Herne Hill BrianWingrave Russell Denman Clive Burr 2 1999 Channel Hill SimonMarloe Russell Brown Rob Jefferies */ CREATE TABLE station_company ( "Station_ID" INTEGER, "Company_ID" INTEGER, "Rank_of_the_Year" INTEGER, PRIMARY KEY ("Station_ID", "Company_ID"), FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID"), FOREIGN KEY("Station_ID") REFERENCES gas_station ("Station_ID") ) /* 2 rows from station_company table: Station_ID Company_ID Rank_of_the_Year 11 1 1 1 3 2 */
Show all main industry for all companies.
SELECT DISTINCT main_industry FROM company
[{'Main_Industry': 'Oil and gas'}, {'Main_Industry': 'Conglomerate'}, {'Main_Industry': 'Banking'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
who has written the most syntactic parsing papers ?
SELECT DISTINCT COUNT ( t4.paperid ) , t3.authorid FROM paperkeyphrase AS t1 JOIN keyphrase AS t2 ON t1.keyphraseid = t2.keyphraseid JOIN paper AS t4 ON t4.paperid = t1.paperid JOIN writes AS t3 ON t3.paperid = t4.paperid WHERE t2.keyphrasename = "syntactic parsing" GROUP BY t3.authorid ORDER BY COUNT ( t4.paperid ) DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
county_public_safety
CREATE TABLE city ( "City_ID" INTEGER, "County_ID" INTEGER, "Name" TEXT, "White" REAL, "Black" REAL, "Amerindian" REAL, "Asian" REAL, "Multiracial" REAL, "Hispanic" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("County_ID") REFERENCES county_public_safety ("County_ID") ) CREATE TABLE county_public_safety ( "County_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Police_officers" INTEGER, "Residents_per_officer" INTEGER, "Case_burden" INTEGER, "Crime_rate" REAL, "Police_force" TEXT, "Location" TEXT, PRIMARY KEY ("County_ID") )
CREATE TABLE city ( "City_ID" INTEGER, "County_ID" INTEGER, "Name" TEXT, "White" REAL, "Black" REAL, "Amerindian" REAL, "Asian" REAL, "Multiracial" REAL, "Hispanic" REAL, PRIMARY KEY ("City_ID"), FOREIGN KEY("County_ID") REFERENCES county_public_safety ("County_ID") ) /* 2 rows from city table: City_ID County_ID Name White Black Amerindian Asian Multiracial Hispanic 1 1 Adjuntas 93.1 3.1 0.3 0.0 3.4 99.6 2 1 Aguada 86.6 5.3 0.3 0.1 7.7 99.4 */ CREATE TABLE county_public_safety ( "County_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Police_officers" INTEGER, "Residents_per_officer" INTEGER, "Case_burden" INTEGER, "Crime_rate" REAL, "Police_force" TEXT, "Location" TEXT, PRIMARY KEY ("County_ID") ) /* 2 rows from county_public_safety table: County_ID Name Population Police_officers Residents_per_officer Case_burden Crime_rate Police_force Location 1 Abbotsford 128165 187 685 81 118.0 Abbotsford Police Department East 2 Burnaby 204320 253 808 100 123.0 RCMP East */
What are the different police forces of counties that are not located in the East?
SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION != "East"
[{'Police_force': 'RCMP'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what is the highest point of the state with the largest area
SELECT t2.highest_point FROM state AS t1 JOIN highlow AS t2 ON t1.state_name = t2.state_name WHERE t1.state_name IN ( SELECT state_name FROM state WHERE area = ( SELECT MAX ( area ) FROM state ) );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
true
false
true
false
false
false
[QUESTION]how high is the highest point in the largest state[/QUESTION] [SQL]SELECT t2.highest_elevation FROM highlow AS t2 JOIN state AS t1 ON t1.state_name = t2.state_name WHERE t1.area = ( SELECT MAX ( area ) FROM state );[/SQL]
[QUESTION]how high is the highest point in the largest state[/QUESTION] [SQL]SELECT t2.highest_elevation FROM highlow AS t2 JOIN state AS t1 ON t1.state_name = t2.state_name WHERE t1.area = ( SELECT MAX ( area ) FROM state );[/SQL]
[QUESTION]how high is the highest point in the largest state[/QUESTION] [SQL]SELECT t2.highest_elevation FROM highlow AS t2 JOIN state AS t1 ON t1.state_name = t2.state_name WHERE t1.area = ( SELECT MAX ( area ) FROM state );[/SQL]
[QUESTION]how high is the highest point in the largest state[/QUESTION] [SQL]SELECT t2.highest_elevation FROM highlow AS t2 JOIN state AS t1 ON t1.state_name = t2.state_name WHERE t1.area = ( SELECT MAX ( area ) FROM state );[/SQL]
entrepreneur
CREATE TABLE entrepreneur ( "Entrepreneur_ID" INTEGER, "People_ID" INTEGER, "Company" TEXT, "Money_Requested" REAL, "Investor" TEXT, PRIMARY KEY ("Entrepreneur_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Height" REAL, "Weight" REAL, "Date_of_Birth" TEXT, PRIMARY KEY ("People_ID") )
CREATE TABLE entrepreneur ( "Entrepreneur_ID" INTEGER, "People_ID" INTEGER, "Company" TEXT, "Money_Requested" REAL, "Investor" TEXT, PRIMARY KEY ("Entrepreneur_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") ) /* 2 rows from entrepreneur table: Entrepreneur_ID People_ID Company Money_Requested Investor 1 1 Umbrolly 150000.0 Duncan Bannatyne 2 2 Grails Ltd 120000.0 Doug Richard */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Height" REAL, "Weight" REAL, "Date_of_Birth" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Height Weight Date_of_Birth 1 Francesco Postiglione 1.9 80.0 1972-04-29 2 Leonardo Binchi 1.86 57.0 1975-08-27 */
What are the names of entrepreneurs whose investor is not "Rachel Elnaugh"?
SELECT T2.Name FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor != "Rachel Elnaugh"
[{'Name': 'Francesco Postiglione'}, {'Name': 'Leonardo Binchi'}, {'Name': 'Roberto Calcaterra'}, {'Name': 'Goran Fiorentini'}, {'Name': 'Maurizio Felugo'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
shop_membership
CREATE TABLE branch ( "Branch_ID" INTEGER, "Name" TEXT, "Open_year" TEXT, "Address_road" TEXT, "City" TEXT, membership_amount TEXT, PRIMARY KEY ("Branch_ID") ) CREATE TABLE member ( "Member_ID" INTEGER, "Card_Number" TEXT, "Name" TEXT, "Hometown" TEXT, "Level" INTEGER, PRIMARY KEY ("Member_ID") ) CREATE TABLE membership_register_branch ( "Member_ID" INTEGER, "Branch_ID" TEXT, "Register_Year" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Branch_ID") REFERENCES branch ("Branch_ID") ) CREATE TABLE purchase ( "Member_ID" INTEGER, "Branch_ID" TEXT, "Year" TEXT, "Total_pounds" REAL, PRIMARY KEY ("Member_ID", "Branch_ID", "Year"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Branch_ID") REFERENCES branch ("Branch_ID") )
CREATE TABLE branch ( "Branch_ID" INTEGER, "Name" TEXT, "Open_year" TEXT, "Address_road" TEXT, "City" TEXT, membership_amount TEXT, PRIMARY KEY ("Branch_ID") ) /* 2 rows from branch table: Branch_ID Name Open_year Address_road City membership_amount 1 Alexandre 2001 Valleys Place London 112 2 Popert 2009 Oaks Crescent London 11 */ CREATE TABLE member ( "Member_ID" INTEGER, "Card_Number" TEXT, "Name" TEXT, "Hometown" TEXT, "Level" INTEGER, PRIMARY KEY ("Member_ID") ) /* 2 rows from member table: Member_ID Card_Number Name Hometown Level 1 LE99 Jeremy Jarmon Collierville, Tennessee 6 2 LT98 Myron Pryor Louisville, Kentucky 6 */ CREATE TABLE membership_register_branch ( "Member_ID" INTEGER, "Branch_ID" TEXT, "Register_Year" TEXT, PRIMARY KEY ("Member_ID"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Branch_ID") REFERENCES branch ("Branch_ID") ) /* 2 rows from membership_register_branch table: Member_ID Branch_ID Register_Year 1 1 2016 2 4 2016 */ CREATE TABLE purchase ( "Member_ID" INTEGER, "Branch_ID" TEXT, "Year" TEXT, "Total_pounds" REAL, PRIMARY KEY ("Member_ID", "Branch_ID", "Year"), FOREIGN KEY("Member_ID") REFERENCES member ("Member_ID"), FOREIGN KEY("Branch_ID") REFERENCES branch ("Branch_ID") ) /* 2 rows from purchase table: Member_ID Branch_ID Year Total_pounds 1 3 2018 2013.32 2 5 2018 321.13 */
What are the names and cities of the branches that do not have any registered members?
SELECT name , city FROM branch WHERE branch_id NOT IN (SELECT branch_id FROM membership_register_branch)
[{'Name': 'Stanley', 'City': 'London'}, {'Name': 'Saint Amant', 'City': 'London'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many bank branches are there?[/QUESTION] [SQL]SELECT count(*) FROM bank[/SQL]
[QUESTION]How many bank branches are there?[/QUESTION] [SQL]SELECT count(*) FROM bank[/SQL]
[QUESTION]How many bank branches are there?[/QUESTION] [SQL]SELECT count(*) FROM bank[/SQL]
roller_coaster
CREATE TABLE country ( "Country_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Area" INTEGER, "Languages" TEXT, PRIMARY KEY ("Country_ID") ) CREATE TABLE roller_coaster ( "Roller_Coaster_ID" INTEGER, "Name" TEXT, "Park" TEXT, "Country_ID" INTEGER, "Length" REAL, "Height" REAL, "Speed" TEXT, "Opened" TEXT, "Status" TEXT, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY("Country_ID") REFERENCES country ("Country_ID") )
CREATE TABLE country ( "Country_ID" INTEGER, "Name" TEXT, "Population" INTEGER, "Area" INTEGER, "Languages" TEXT, PRIMARY KEY ("Country_ID") ) /* 2 rows from country table: Country_ID Name Population Area Languages 1 Austria 8206524 83871 German 2 Finland 5261008 338145 Finnish Swedish */ CREATE TABLE roller_coaster ( "Roller_Coaster_ID" INTEGER, "Name" TEXT, "Park" TEXT, "Country_ID" INTEGER, "Length" REAL, "Height" REAL, "Speed" TEXT, "Opened" TEXT, "Status" TEXT, PRIMARY KEY ("Roller_Coaster_ID"), FOREIGN KEY("Country_ID") REFERENCES country ("Country_ID") ) /* 2 rows from roller_coaster table: Roller_Coaster_ID Name Park Country_ID Length Height Speed Opened Status 1 Boardwalk Bullet Kemah Boardwalk 1 3236.0 96.0 51 August 31, 2007 Operating 2 Dauling Dragon Happy Valley 1 3914.0 105.0 55 2012 Operating */
Show the names of roller coasters and names of country they are in.
SELECT T2.Name , T1.Name FROM country AS T1 JOIN roller_coaster AS T2 ON T1.Country_ID = T2.Country_ID
[{'Name': 'Austria'}, {'Name': 'Austria'}, {'Name': 'Austria'}, {'Name': 'Finland'}, {'Name': 'Finland'}, {'Name': 'Sweden'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
bike_1
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER )
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT, PRIMARY KEY (id) ) /* 2 rows from station table: id name lat long dock_count city installation_date 2 San Jose Diridon Caltrain Station 37.3297320000 -121.9017820000 27 San Jose 8/6/2013 3 San Jose Civic Center 37.3306980000 -121.8889790000 15 San Jose 8/5/2013 */ CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT, FOREIGN KEY(station_id) REFERENCES station (id) ) /* 2 rows from status table: station_id bikes_available docks_available time 3 12 3 2015-06-02 12:46:02 3 12 3 2015-06-02 12:47:02 */ CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER, PRIMARY KEY (id) ) /* 2 rows from trip table: id duration start_date start_station_name start_station_id end_date end_station_name end_station_id bike_id subscription_type zip_code 900504 384 8/21/2015 17:03 Howard at 2nd 63 8/21/2015 17:10 San Francisco Caltrain 2 (330 Townsend) 69 454 Subscriber 94041 900505 588 8/21/2015 17:03 South Van Ness at Market 66 8/21/2015 17:13 San Francisco Caltrain 2 (330 Townsend) 69 574 Subscriber 95119 */ CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pressure_inches NUMERIC, mean_sea_level_pressure_inches NUMERIC, min_sea_level_pressure_inches NUMERIC, max_visibility_miles INTEGER, mean_visibility_miles INTEGER, min_visibility_miles INTEGER, "max_wind_Speed_mph" INTEGER, mean_wind_speed_mph INTEGER, max_gust_speed_mph INTEGER, precipitation_inches INTEGER, cloud_cover INTEGER, events TEXT, wind_dir_degrees INTEGER, zip_code INTEGER ) /* 2 rows from weather table: date max_temperature_f mean_temperature_f min_temperature_f max_dew_point_f mean_dew_point_f min_dew_point_f max_humidity mean_humidity min_humidity max_sea_level_pressure_inches mean_sea_level_pressure_inches min_sea_level_pressure_inches max_visibility_miles mean_visibility_miles min_visibility_miles max_wind_Speed_mph mean_wind_speed_mph max_gust_speed_mph precipitation_inches cloud_cover events wind_dir_degrees zip_code 8/29/2013 74 68 61 61 58 56 93 75 57 30.0700000000 30.0200000000 29.9700000000 10 10 10 23 11 28 0 4 286 94107 8/30/2013 78 69 60 61 58 56 90 70 50 30.0500000000 30.0000000000 29.9300000000 10 10 7 29 13 35 0 2 291 94107 */
What are the name, latitude, and city of the station with the lowest latitude?
SELECT name , lat , city FROM station ORDER BY lat LIMIT 1
[{'name': 'San Jose Diridon Caltrain Station', 'lat': 37.329732, 'city': 'San Jose'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
company_office
CREATE TABLE "Companies" ( id INTEGER, name TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value_billion" TEXT, PRIMARY KEY (id) ) CREATE TABLE "Office_locations" ( building_id INTEGER, company_id INTEGER, move_in_year INTEGER, PRIMARY KEY (building_id, company_id), FOREIGN KEY(building_id) REFERENCES buildings (id), FOREIGN KEY(company_id) REFERENCES "Companies" (id) ) CREATE TABLE buildings ( id INTEGER, name TEXT, "City" TEXT, "Height" INTEGER, "Stories" INTEGER, "Status" TEXT, PRIMARY KEY (id) )
CREATE TABLE "Companies" ( id INTEGER, name TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_billion" REAL, "Profits_billion" REAL, "Assets_billion" REAL, "Market_Value_billion" TEXT, PRIMARY KEY (id) ) /* 2 rows from Companies table: id name Headquarters Industry Sales_billion Profits_billion Assets_billion Market_Value_billion 1 JPMorgan Chase USA Banking 115.5 17.4 2117.6 182.2 2 HSBC UK Banking 103.3 13.3 2467.9 186.5 */ CREATE TABLE "Office_locations" ( building_id INTEGER, company_id INTEGER, move_in_year INTEGER, PRIMARY KEY (building_id, company_id), FOREIGN KEY(building_id) REFERENCES buildings (id), FOREIGN KEY(company_id) REFERENCES "Companies" (id) ) /* 2 rows from Office_locations table: building_id company_id move_in_year 1 1 2021 2 2 2022 */ CREATE TABLE buildings ( id INTEGER, name TEXT, "City" TEXT, "Height" INTEGER, "Stories" INTEGER, "Status" TEXT, PRIMARY KEY (id) ) /* 2 rows from buildings table: id name City Height Stories Status 1 Torre KOI Monterrey 220 67 under construction 2 Torre Mitikah Mexico City 210 60 under construction */
What are the average profits of companies?
SELECT avg(Profits_billion) FROM Companies
[{'avg(Profits_billion)': 17.063157894736843}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the average and largest salary of all employees?[/QUESTION] [SQL]SELECT avg(salary) , max(salary) FROM Employee[/SQL]
[QUESTION]What is the average and largest salary of all employees?[/QUESTION] [SQL]SELECT avg(salary) , max(salary) FROM Employee[/SQL]
[QUESTION]What is the average and largest salary of all employees?[/QUESTION] [SQL]SELECT avg(salary) , max(salary) FROM Employee[/SQL]
[QUESTION]What is the average and largest salary of all employees?[/QUESTION] [SQL]SELECT avg(salary) , max(salary) FROM Employee[/SQL]
game_1
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") )
CREATE TABLE "Plays_Games" ( "StuID" INTEGER, "GameID" INTEGER, "Hours_Played" INTEGER, FOREIGN KEY("GameID") REFERENCES "Video_Games" ("GameID"), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from Plays_Games table: StuID GameID Hours_Played 1001 1 35 1001 2 15 */ CREATE TABLE "SportsInfo" ( "StuID" INTEGER, "SportName" VARCHAR(32), "HoursPerWeek" INTEGER, "GamesPlayed" INTEGER, "OnScholarship" VARCHAR(1), FOREIGN KEY("StuID") REFERENCES "Student" ("StuID") ) /* 2 rows from SportsInfo table: StuID SportName HoursPerWeek GamesPlayed OnScholarship 1001 Athletics 2 5 N 1002 Football 7 20 Y */ CREATE TABLE "Student" ( "StuID" INTEGER, "LName" VARCHAR(12), "Fname" VARCHAR(12), "Age" INTEGER, "Sex" VARCHAR(1), "Major" INTEGER, "Advisor" INTEGER, city_code VARCHAR(3), PRIMARY KEY ("StuID") ) /* 2 rows from Student table: StuID LName Fname Age Sex Major Advisor city_code 1001 Smith Linda 18 F 600 1121 BAL 1002 Kim Tracy 19 F 600 7712 HKG */ CREATE TABLE "Video_Games" ( "GameID" INTEGER, "GName" VARCHAR(40), "GType" VARCHAR(40), PRIMARY KEY ("GameID") ) /* 2 rows from Video_Games table: GameID GName GType 1 RNG Stone Collectible card game 2 The Vanishing of Eric Calder Walking Simulator */
What is the name of the game that has been played the most?
SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1
[{'GName': 'Works of Widenius'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What are the first name, last name and id of the player with the most all star game experiences? Also list the count.[/QUESTION] [SQL]SELECT T1.name_first , T1.name_last , T1.player_id , count(*) FROM player AS T1 JOIN all_star AS T2 ON T1.player_id = T2.player_id GROUP BY T1.player_id ORDER BY count(*) DESC LIMIT 1;[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
which topics were most popular at NIPS 2015
SELECT DISTINCT COUNT ( t3.paperid ) , t1.keyphraseid FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN venue AS t4 ON t4.venueid = t3.venueid WHERE t3.year = 2015 AND t4.venuename = "NIPS" GROUP BY t1.keyphraseid ORDER BY COUNT ( t3.paperid ) DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
school_finance
CREATE TABLE "School" ( "School_id" TEXT, "School_name" TEXT, "Location" TEXT, "Mascot" TEXT, "Enrollment" INTEGER, "IHSAA_Class" TEXT, "IHSAA_Football_Class" TEXT, "County" TEXT, PRIMARY KEY ("School_id") ) CREATE TABLE budget ( "School_id" INTEGER, "Year" INTEGER, "Budgeted" INTEGER, total_budget_percent_budgeted REAL, "Invested" INTEGER, total_budget_percent_invested REAL, "Budget_invested_percent" TEXT, PRIMARY KEY ("School_id", "Year"), FOREIGN KEY("School_id") REFERENCES "School" ("School_id") ) CREATE TABLE endowment ( endowment_id INTEGER, "School_id" INTEGER, donator_name TEXT, amount REAL, PRIMARY KEY (endowment_id), FOREIGN KEY("School_id") REFERENCES "School" ("School_id") )
CREATE TABLE "School" ( "School_id" TEXT, "School_name" TEXT, "Location" TEXT, "Mascot" TEXT, "Enrollment" INTEGER, "IHSAA_Class" TEXT, "IHSAA_Football_Class" TEXT, "County" TEXT, PRIMARY KEY ("School_id") ) /* 2 rows from School table: School_id School_name Location Mascot Enrollment IHSAA_Class IHSAA_Football_Class County 1 Bremen Bremen Lions 495 AA AA 50 Marshall 2 Culver Community Culver Cavaliers 287 A A 50 Marshall */ CREATE TABLE budget ( "School_id" INTEGER, "Year" INTEGER, "Budgeted" INTEGER, total_budget_percent_budgeted REAL, "Invested" INTEGER, total_budget_percent_invested REAL, "Budget_invested_percent" TEXT, PRIMARY KEY ("School_id", "Year"), FOREIGN KEY("School_id") REFERENCES "School" ("School_id") ) /* 2 rows from budget table: School_id Year Budgeted total_budget_percent_budgeted Invested total_budget_percent_invested Budget_invested_percent 2 1999 4979 2.0 2134 2.0 42.9 2 2000 3666 2.0 5840 2.0 159.3 */ CREATE TABLE endowment ( endowment_id INTEGER, "School_id" INTEGER, donator_name TEXT, amount REAL, PRIMARY KEY (endowment_id), FOREIGN KEY("School_id") REFERENCES "School" ("School_id") ) /* 2 rows from endowment table: endowment_id School_id donator_name amount 1 1 Monte Plata 9.51 2 2 San José de Ocoa 9.83 */
How many donors have endowment for school named "Glenn"?
SELECT count(DISTINCT T1.donator_name) FROM endowment AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = "Glenn"
[{'count(DISTINCT T1.donator_name)': 3}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
epinions_1
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) )
CREATE TABLE item ( i_id INTEGER NOT NULL, title VARCHAR(20) DEFAULT NULL, PRIMARY KEY (i_id) ) /* 2 rows from item table: i_id title 0 pear 1 orange */ CREATE TABLE review ( a_id INTEGER NOT NULL, u_id INTEGER NOT NULL, i_id INTEGER NOT NULL, rating INTEGER DEFAULT NULL, rank INTEGER DEFAULT NULL, PRIMARY KEY (a_id), FOREIGN KEY(i_id) REFERENCES item (i_id), FOREIGN KEY(u_id) REFERENCES useracct (u_id) ) /* 2 rows from review table: a_id u_id i_id rating rank 1 1 1 10 1 2 2 1 5 2 */ CREATE TABLE trust ( source_u_id INTEGER NOT NULL, target_u_id INTEGER NOT NULL, trust INTEGER NOT NULL, FOREIGN KEY(target_u_id) REFERENCES useracct (u_id), FOREIGN KEY(source_u_id) REFERENCES useracct (u_id) ) /* 2 rows from trust table: source_u_id target_u_id trust 1 2 10 1 3 6 */ CREATE TABLE useracct ( u_id INTEGER NOT NULL, name VARCHAR(128) DEFAULT NULL, PRIMARY KEY (u_id) ) /* 2 rows from useracct table: u_id name 1 Helen 2 Mark */
Find the average and maximum rating of all reviews.
SELECT avg(rating) , max(rating) FROM review
[{'avg(rating)': 7.142857142857143, 'max(rating)': 10}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the average credit score of the customers who have some loan.[/QUESTION] [SQL]SELECT avg(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan)[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
what is the capital of the state with the largest population
SELECT capital FROM state WHERE population = ( SELECT MAX ( population ) FROM state );
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]Give the name, population, and head of state for the country that has the largest area.[/QUESTION] [SQL]SELECT Name , population , HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1[/SQL]
[QUESTION]Give the name, population, and head of state for the country that has the largest area.[/QUESTION] [SQL]SELECT Name , population , HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1[/SQL]
[QUESTION]Give the name, population, and head of state for the country that has the largest area.[/QUESTION] [SQL]SELECT Name , population , HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1[/SQL]
[QUESTION]Give the name, population, and head of state for the country that has the largest area.[/QUESTION] [SQL]SELECT Name , population , HeadOfState FROM country ORDER BY SurfaceArea DESC LIMIT 1[/SQL]
gymnast
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") )
CREATE TABLE gymnast ( "Gymnast_ID" INTEGER, "Floor_Exercise_Points" REAL, "Pommel_Horse_Points" REAL, "Rings_Points" REAL, "Vault_Points" REAL, "Parallel_Bars_Points" REAL, "Horizontal_Bar_Points" REAL, "Total_Points" REAL, PRIMARY KEY ("Gymnast_ID"), FOREIGN KEY("Gymnast_ID") REFERENCES people ("People_ID") ) /* 2 rows from gymnast table: Gymnast_ID Floor_Exercise_Points Pommel_Horse_Points Rings_Points Vault_Points Parallel_Bars_Points Horizontal_Bar_Points Total_Points 1 9.725 9.737 9.512 9.575 9.762 9.75 58.061 2 9.7 9.625 9.625 9.65 9.587 9.737 57.924 */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Age" REAL, "Height" REAL, "Hometown" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Age Height Hometown 1 Paul Hamm 24.0 1.71 Santo Domingo 2 Lorraine Súarez Carmona 21.0 1.75 Bonao */
From which hometowns did no gymnasts come from?
SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID
[{'Hometown': 'La Romana'}, {'Hometown': 'Miami'}]
Hard
true
false
false
false
false
false
false
true
false
false
false
true
false
customers_and_invoices
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Accounts table: account_id customer_id date_account_opened account_name other_account_details 1 8 2016-07-30 22:22:24 900 Regular 2 3 2017-05-29 16:45:17 520 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(50), customer_middle_initial VARCHAR(1), customer_last_name VARCHAR(50), gender VARCHAR(1), email_address VARCHAR(255), login_name VARCHAR(80), login_password VARCHAR(20), phone_number VARCHAR(255), town_city VARCHAR(50), state_county_province VARCHAR(50), country VARCHAR(50), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_middle_initial customer_last_name gender email_address login_name login_password phone_number town_city state_county_province country 1 Dee A Larkin 1 [email protected] xhartmann 77789d292604ea04406f 241.796.1219x37862 North Nellie WestVirginia USA 2 Brennon H Weimann 0 [email protected] shayne.lesch ce97a3e4539347daab96 (943)219-4234x415 South Isabell Oklahoma USA */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, account_id INTEGER NOT NULL, invoice_number INTEGER, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DECIMAL(19, 4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number) ) /* 2 rows from Financial_Transactions table: transaction_id account_id invoice_number transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 13 12 Payment 2018-03-15 21:13:57 613.9600 None None 2 9 1 Payment 2018-03-13 13:27:46 368.4600 None None */ CREATE TABLE "Invoice_Line_Items" ( order_item_id INTEGER NOT NULL, invoice_number INTEGER NOT NULL, product_id INTEGER NOT NULL, product_title VARCHAR(80), product_quantity VARCHAR(50), product_price DECIMAL(19, 4), derived_product_cost DECIMAL(19, 4), derived_vat_payable DECIMAL(19, 4), derived_total_cost DECIMAL(19, 4), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(invoice_number) REFERENCES "Invoices" (invoice_number), FOREIGN KEY(order_item_id) REFERENCES "Order_Items" (order_item_id) ) /* 2 rows from Invoice_Line_Items table: order_item_id invoice_number product_id product_title product_quantity product_price derived_product_cost derived_vat_payable derived_total_cost 14 9 5 prod_name 4 742.3700 191.1100 None 69.8200 3 9 15 prod_name 1 814.8700 176.2900 None 59.5600 */ CREATE TABLE "Invoices" ( invoice_number INTEGER, order_id INTEGER NOT NULL, invoice_date DATETIME, PRIMARY KEY (invoice_number), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id) ) /* 2 rows from Invoices table: invoice_number order_id invoice_date 1 9 2018-03-01 16:40:48 2 9 2018-03-20 00:21:41 */ CREATE TABLE "Order_Items" ( order_item_id INTEGER, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, product_quantity VARCHAR(50), other_order_item_details VARCHAR(255), PRIMARY KEY (order_item_id), FOREIGN KEY(order_id) REFERENCES "Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) /* 2 rows from Order_Items table: order_item_id order_id product_id product_quantity other_order_item_details 1 4 4 6 None 2 4 10 7 None */ CREATE TABLE "Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, date_order_placed DATETIME NOT NULL, order_details VARCHAR(255), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Orders table: order_id customer_id date_order_placed order_details 1 12 2012-06-27 20:49:56 None 2 12 2012-08-25 07:51:54 None */ CREATE TABLE "Product_Categories" ( production_type_code VARCHAR(15), product_type_description VARCHAR(80), vat_rating DECIMAL(19, 4), PRIMARY KEY (production_type_code) ) /* 2 rows from Product_Categories table: production_type_code product_type_description vat_rating Food Food 15.8400 DVDs Dvd products 11.4000 */ CREATE TABLE "Products" ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15) NOT NULL, unit_price DECIMAL(19, 4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20), PRIMARY KEY (product_id), FOREIGN KEY(production_type_code) REFERENCES "Product_Categories" (production_type_code) ) /* 2 rows from Products table: product_id parent_product_id production_type_code unit_price product_name product_color product_size 1 4 Food 617.9500 Coffee Bean Red Medium 2 4 Books 558.4900 Learning French Yellow Medium */
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'
[{'account_id': 1, 'date_account_opened': '2016-07-30 22:22:24', 'account_name': '900', 'other_account_details': 'Regular'}, {'account_id': 3, 'date_account_opened': '2012-05-04 18:50:32', 'account_name': '323', 'other_account_details': 'Regular'}, {'account_id': 9, 'date_account_opened': '2010-10-22 13:33:45', 'account_name': '337', 'other_account_details': 'Regular'}, {'account_id': 12, 'date_account_opened': '2015-02-02 09:47:08', 'account_name': '601', 'other_account_details': 'Regular'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the names of all customers, ordered by account balance?[/QUESTION] [SQL]SELECT cust_name FROM customer ORDER BY acc_bal[/SQL]
tracking_grants_for_research
CREATE TABLE "Document_Types" ( document_type_code VARCHAR(10), document_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_type_code) ) CREATE TABLE "Documents" ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER NOT NULL, sent_date DATETIME NOT NULL, response_received_date DATETIME NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (document_id), FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id), FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code) ) CREATE TABLE "Grants" ( grant_id INTEGER, organisation_id INTEGER NOT NULL, grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL, grant_start_date DATETIME NOT NULL, grant_end_date DATETIME NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (grant_id), FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id) ) CREATE TABLE "Organisation_Types" ( organisation_type VARCHAR(10), organisation_type_description VARCHAR(255) NOT NULL, PRIMARY KEY (organisation_type) ) CREATE TABLE "Organisations" ( organisation_id INTEGER, organisation_type VARCHAR(10) NOT NULL, organisation_details VARCHAR(255) NOT NULL, PRIMARY KEY (organisation_id), FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type) ) CREATE TABLE "Project_Outcomes" ( project_id INTEGER NOT NULL, outcome_code VARCHAR(10) NOT NULL, outcome_details VARCHAR(255), FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) ) CREATE TABLE "Project_Staff" ( staff_id DOUBLE, project_id INTEGER NOT NULL, role_code VARCHAR(10) NOT NULL, date_from DATETIME, date_to DATETIME, other_details VARCHAR(255), PRIMARY KEY (staff_id), FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) ) CREATE TABLE "Projects" ( project_id INTEGER, organisation_id INTEGER NOT NULL, project_details VARCHAR(255) NOT NULL, PRIMARY KEY (project_id), FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id) ) CREATE TABLE "Research_Outcomes" ( outcome_code VARCHAR(10), outcome_description VARCHAR(255) NOT NULL, PRIMARY KEY (outcome_code) ) CREATE TABLE "Research_Staff" ( staff_id INTEGER, employer_organisation_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id), FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id) ) CREATE TABLE "Staff_Roles" ( role_code VARCHAR(10), role_description VARCHAR(255) NOT NULL, PRIMARY KEY (role_code) ) CREATE TABLE "Tasks" ( task_id INTEGER, project_id INTEGER NOT NULL, task_details VARCHAR(255) NOT NULL, "eg Agree Objectives" VARCHAR(1), PRIMARY KEY (task_id), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) )
CREATE TABLE "Document_Types" ( document_type_code VARCHAR(10), document_description VARCHAR(255) NOT NULL, PRIMARY KEY (document_type_code) ) /* 2 rows from Document_Types table: document_type_code document_description APP Initial Application REG Regular */ CREATE TABLE "Documents" ( document_id INTEGER, document_type_code VARCHAR(10), grant_id INTEGER NOT NULL, sent_date DATETIME NOT NULL, response_received_date DATETIME NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (document_id), FOREIGN KEY(grant_id) REFERENCES "Grants" (grant_id), FOREIGN KEY(document_type_code) REFERENCES "Document_Types" (document_type_code) ) /* 2 rows from Documents table: document_id document_type_code grant_id sent_date response_received_date other_details 1 APP 5 1986-11-30 07:56:35 1977-12-01 02:18:53 2 APP 13 2004-01-23 11:57:08 1979-12-08 10:38:07 */ CREATE TABLE "Grants" ( grant_id INTEGER, organisation_id INTEGER NOT NULL, grant_amount DECIMAL(19, 4) DEFAULT 0 NOT NULL, grant_start_date DATETIME NOT NULL, grant_end_date DATETIME NOT NULL, other_details VARCHAR(255) NOT NULL, PRIMARY KEY (grant_id), FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id) ) /* 2 rows from Grants table: grant_id organisation_id grant_amount grant_start_date grant_end_date other_details 1 10 4094.5420 2016-11-20 00:18:51 2004-10-24 09:09:39 et 2 3 281.2446 1985-10-09 20:08:49 1985-06-08 00:22:07 occaecati */ CREATE TABLE "Organisation_Types" ( organisation_type VARCHAR(10), organisation_type_description VARCHAR(255) NOT NULL, PRIMARY KEY (organisation_type) ) /* 2 rows from Organisation_Types table: organisation_type organisation_type_description RES Research SPON Sponsor */ CREATE TABLE "Organisations" ( organisation_id INTEGER, organisation_type VARCHAR(10) NOT NULL, organisation_details VARCHAR(255) NOT NULL, PRIMARY KEY (organisation_id), FOREIGN KEY(organisation_type) REFERENCES "Organisation_Types" (organisation_type) ) /* 2 rows from Organisations table: organisation_id organisation_type organisation_details 1 RES et 2 RES eius */ CREATE TABLE "Project_Outcomes" ( project_id INTEGER NOT NULL, outcome_code VARCHAR(10) NOT NULL, outcome_details VARCHAR(255), FOREIGN KEY(outcome_code) REFERENCES "Research_Outcomes" (outcome_code), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) ) /* 2 rows from Project_Outcomes table: project_id outcome_code outcome_details 4 Paper None 3 Patent None */ CREATE TABLE "Project_Staff" ( staff_id DOUBLE, project_id INTEGER NOT NULL, role_code VARCHAR(10) NOT NULL, date_from DATETIME, date_to DATETIME, other_details VARCHAR(255), PRIMARY KEY (staff_id), FOREIGN KEY(role_code) REFERENCES "Staff_Roles" (role_code), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) ) /* 2 rows from Project_Staff table: staff_id project_id role_code date_from date_to other_details 0.0 2 leader 1981-10-04 22:44:50 1985-05-30 22:26:30 None 674810.0 5 leader 2003-04-19 15:06:20 2010-12-08 11:55:36 None */ CREATE TABLE "Projects" ( project_id INTEGER, organisation_id INTEGER NOT NULL, project_details VARCHAR(255) NOT NULL, PRIMARY KEY (project_id), FOREIGN KEY(organisation_id) REFERENCES "Organisations" (organisation_id) ) /* 2 rows from Projects table: project_id organisation_id project_details 1 15 porro 2 11 et */ CREATE TABLE "Research_Outcomes" ( outcome_code VARCHAR(10), outcome_description VARCHAR(255) NOT NULL, PRIMARY KEY (outcome_code) ) /* 2 rows from Research_Outcomes table: outcome_code outcome_description Paper Published Research Paper Patent Research Patent */ CREATE TABLE "Research_Staff" ( staff_id INTEGER, employer_organisation_id INTEGER NOT NULL, staff_details VARCHAR(255) NOT NULL, PRIMARY KEY (staff_id), FOREIGN KEY(employer_organisation_id) REFERENCES "Organisations" (organisation_id) ) /* 2 rows from Research_Staff table: staff_id employer_organisation_id staff_details 1 1 quo 2 4 est */ CREATE TABLE "Staff_Roles" ( role_code VARCHAR(10), role_description VARCHAR(255) NOT NULL, PRIMARY KEY (role_code) ) /* 2 rows from Staff_Roles table: role_code role_description leader Project Leader researcher Project Researcher */ CREATE TABLE "Tasks" ( task_id INTEGER, project_id INTEGER NOT NULL, task_details VARCHAR(255) NOT NULL, "eg Agree Objectives" VARCHAR(1), PRIMARY KEY (task_id), FOREIGN KEY(project_id) REFERENCES "Projects" (project_id) ) /* 2 rows from Tasks table: task_id project_id task_details eg Agree Objectives 1 1 a None 2 2 b None */
For each project id, how many staff does it have? List them in increasing order.
SELECT T1.project_id , count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC
[{'project_id': 3, 'count(*)': 1}, {'project_id': 4, 'count(*)': 1}, {'project_id': 7, 'count(*)': 1}, {'project_id': 8, 'count(*)': 1}, {'project_id': 9, 'count(*)': 1}, {'project_id': 15, 'count(*)': 1}, {'project_id': 1, 'count(*)': 2}, {'project_id': 5, 'count(*)': 2}, {'project_id': 11, 'count(*)': 2}, {'project_id': 2, 'count(*)': 3}]
Medium
false
false
false
true
false
true
false
true
false
false
false
false
false
[QUESTION]How many employees are there?[/QUESTION] [SQL]SELECT count(*) FROM employee[/SQL]
[QUESTION]How many employees are there?[/QUESTION] [SQL]SELECT count(*) FROM employee[/SQL]
[QUESTION]How many employees are there?[/QUESTION] [SQL]SELECT count(*) FROM employee[/SQL]
[QUESTION]How many employees are there?[/QUESTION] [SQL]SELECT count(*) FROM employee[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
hot topics at NIPS 2015
SELECT DISTINCT COUNT ( t3.paperid ) , t1.keyphraseid FROM paperkeyphrase AS t2 JOIN keyphrase AS t1 ON t2.keyphraseid = t1.keyphraseid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN venue AS t4 ON t4.venueid = t3.venueid WHERE t3.year = 2015 AND t4.venuename = "NIPS" GROUP BY t1.keyphraseid ORDER BY COUNT ( t3.paperid ) DESC;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
true
false
false
true
false
false
false
false
driving_school
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) CREATE TABLE "Customer_Payments" ( customer_id INTEGER NOT NULL, datetime_payment DATETIME NOT NULL, payment_method_code VARCHAR(10) NOT NULL, amount_payment DOUBLE, PRIMARY KEY (customer_id, datetime_payment), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_address_id INTEGER NOT NULL, customer_status_code VARCHAR(15) NOT NULL, date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80), amount_outstanding DOUBLE, email_address VARCHAR(250), phone_number VARCHAR(255), cell_mobile_phone_number VARCHAR(255), PRIMARY KEY (customer_id), FOREIGN KEY(customer_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Lessons" ( lesson_id INTEGER, customer_id INTEGER NOT NULL, lesson_status_code VARCHAR(15) NOT NULL, staff_id INTEGER, vehicle_id INTEGER NOT NULL, lesson_date DATETIME, lesson_time VARCHAR(10), price DOUBLE, PRIMARY KEY (lesson_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(vehicle_id) REFERENCES "Vehicles" (vehicle_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_address_id INTEGER NOT NULL, nickname VARCHAR(80), first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME, PRIMARY KEY (staff_id), FOREIGN KEY(staff_address_id) REFERENCES "Addresses" (address_id) ) CREATE TABLE "Vehicles" ( vehicle_id INTEGER, vehicle_details VARCHAR(255), PRIMARY KEY (vehicle_id) )
CREATE TABLE "Addresses" ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), PRIMARY KEY (address_id) ) /* 2 rows from Addresses table: address_id line_1_number_building city zip_postcode state_province_county country 1 3904 Stroman Passage Port Melyssa 14445 Georgia USA 2 053 Quigley Island Hagenesfurt 22194 Kentucky USA */ CREATE TABLE "Customer_Payments" ( customer_id INTEGER NOT NULL, datetime_payment DATETIME NOT NULL, payment_method_code VARCHAR(10) NOT NULL, amount_payment DOUBLE, PRIMARY KEY (customer_id, datetime_payment), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Payments table: customer_id datetime_payment payment_method_code amount_payment 11 2018-02-05 18:44:46 Direct Debit 9570.93 2 2018-02-24 10:07:05 Direct Debit 8180.26 */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_address_id INTEGER NOT NULL, customer_status_code VARCHAR(15) NOT NULL, date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80), amount_outstanding DOUBLE, email_address VARCHAR(250), phone_number VARCHAR(255), cell_mobile_phone_number VARCHAR(255), PRIMARY KEY (customer_id), FOREIGN KEY(customer_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Customers table: customer_id customer_address_id customer_status_code date_became_customer date_of_birth first_name last_name amount_outstanding email_address phone_number cell_mobile_phone_number 1 13 Bad Customer 2016-05-11 17:03:48 1998-12-15 13:24:40 Carole Bernhard 255.0 [email protected] 07278206718 861-638-9797 2 10 Bad Customer 2015-11-16 22:52:14 1995-07-17 12:13:16 Genevieve Terry 7256.0 [email protected] +14(5)2351480248 578-518-4785x612 */ CREATE TABLE "Lessons" ( lesson_id INTEGER, customer_id INTEGER NOT NULL, lesson_status_code VARCHAR(15) NOT NULL, staff_id INTEGER, vehicle_id INTEGER NOT NULL, lesson_date DATETIME, lesson_time VARCHAR(10), price DOUBLE, PRIMARY KEY (lesson_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id), FOREIGN KEY(staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(vehicle_id) REFERENCES "Vehicles" (vehicle_id) ) /* 2 rows from Lessons table: lesson_id customer_id lesson_status_code staff_id vehicle_id lesson_date lesson_time price 1 6 Cancelled 8 3 2018-02-28 10:55:36 5 199.0 2 8 Cancelled 14 3 2018-03-07 16:12:36 6 167.0 */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_address_id INTEGER NOT NULL, nickname VARCHAR(80), first_name VARCHAR(80), middle_name VARCHAR(80), last_name VARCHAR(80), date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME, PRIMARY KEY (staff_id), FOREIGN KEY(staff_address_id) REFERENCES "Addresses" (address_id) ) /* 2 rows from Staff table: staff_id staff_address_id nickname first_name middle_name last_name date_of_birth date_joined_staff date_left_staff 1 14 thompson.constantin Janessa Amara Sawayn 2010-12-08 16:55:14 2017-04-27 03:21:26 2018-03-23 22:53:12 2 3 santos45 Camylle Icie Weissnat 2015-08-01 13:22:43 2016-06-06 08:54:28 2018-03-10 15:25:00 */ CREATE TABLE "Vehicles" ( vehicle_id INTEGER, vehicle_details VARCHAR(255), PRIMARY KEY (vehicle_id) ) /* 2 rows from Vehicles table: vehicle_id vehicle_details 1 Van 2 Truck */
Show the detail of vehicle with id 1.
SELECT vehicle_details FROM Vehicles WHERE vehicle_id = 1;
[{'vehicle_details': 'Van'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the name and distance for aircraft with id 12?[/QUESTION] [SQL]SELECT name , distance FROM Aircraft WHERE aid = 12[/SQL]
formula_1
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") )
CREATE TABLE "constructorResults" ( "constructorResultsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, status TEXT, PRIMARY KEY ("constructorResultsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorResults table: constructorResultsId raceId constructorId points status 1 18 1 14.0 NULL 2 18 2 8.0 NULL */ CREATE TABLE "constructorStandings" ( "constructorStandingsId" INTEGER, "raceId" INTEGER, "constructorId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("constructorStandingsId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId") ) /* 2 rows from constructorStandings table: constructorStandingsId raceId constructorId points position positionText wins 1 18 1 14.0 1 1 1 2 18 2 8.0 3 3 0 */ CREATE TABLE "driverStandings" ( "driverStandingsId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, points REAL, position INTEGER, "positionText" TEXT, wins INTEGER, PRIMARY KEY ("driverStandingsId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from driverStandings table: driverStandingsId raceId driverId points position positionText wins 1 18 1 10.0 1 1 1 2 18 2 8.0 2 2 0 */ CREATE TABLE "lapTimes" ( "raceId" INTEGER, "driverId" INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", lap), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from lapTimes table: raceId driverId lap position time milliseconds */ CREATE TABLE "pitStops" ( "raceId" INTEGER, "driverId" INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER, PRIMARY KEY ("raceId", "driverId", stop), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from pitStops table: raceId driverId stop lap time duration milliseconds */ CREATE TABLE circuits ( "circuitId" INTEGER, "circuitRef" TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT, PRIMARY KEY ("circuitId") ) /* 2 rows from circuits table: circuitId circuitRef name location country lat lng alt url 1 albert_park Albert Park Grand Prix Circuit Melbourne Australia -37.8497 144.968 10 http://en.wikipedia.org/wiki/Melbourne_Grand_Prix_Circuit 2 sepang Sepang International Circuit Kuala Lumpur Malaysia 2.76083 101.738 http://en.wikipedia.org/wiki/Sepang_International_Circuit */ CREATE TABLE constructors ( "constructorId" INTEGER, "constructorRef" TEXT, name TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("constructorId") ) /* 2 rows from constructors table: constructorId constructorRef name nationality url 1 mclaren McLaren British http://en.wikipedia.org/wiki/McLaren 2 bmw_sauber BMW Sauber German http://en.wikipedia.org/wiki/BMW_Sauber */ CREATE TABLE drivers ( "driverId" INTEGER, "driverRef" TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT, PRIMARY KEY ("driverId") ) /* 2 rows from drivers table: driverId driverRef number code forename surname dob nationality url 1 hamilton 44 HAM Lewis Hamilton 07/01/1985 British http://en.wikipedia.org/wiki/Lewis_Hamilton 2 heidfeld HEI Nick Heidfeld 10/05/1977 German http://en.wikipedia.org/wiki/Nick_Heidfeld */ CREATE TABLE qualifying ( "qualifyId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT, PRIMARY KEY ("qualifyId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from qualifying table: qualifyId raceId driverId constructorId number position q1 q2 q3 1 18 1 1 22 1 1:26.572 1:25.187 1:26.714 2 18 9 2 4 2 1:26.103 1:25.315 1:26.869 */ CREATE TABLE races ( "raceId" INTEGER, year INTEGER, round INTEGER, "circuitId" INTEGER, name TEXT, date TEXT, time TEXT, url TEXT, PRIMARY KEY ("raceId"), FOREIGN KEY("circuitId") REFERENCES circuits ("circuitId") ) /* 2 rows from races table: raceId year round circuitId name date time url 1 2009 1 1 Australian Grand Prix 2009-03-29 06:00:00 http://en.wikipedia.org/wiki/2009_Australian_Grand_Prix 2 2009 2 2 Malaysian Grand Prix 2009-04-05 09:00:00 http://en.wikipedia.org/wiki/2009_Malaysian_Grand_Prix */ CREATE TABLE results ( "resultId" INTEGER, "raceId" INTEGER, "driverId" INTEGER, "constructorId" INTEGER, number INTEGER, grid INTEGER, position TEXT, "positionText" TEXT, "positionOrder" INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, "fastestLap" TEXT, rank TEXT, "fastestLapTime" TEXT, "fastestLapSpeed" TEXT, "statusId" INTEGER, PRIMARY KEY ("resultId"), FOREIGN KEY("constructorId") REFERENCES constructors ("constructorId"), FOREIGN KEY("raceId") REFERENCES races ("raceId"), FOREIGN KEY("driverId") REFERENCES drivers ("driverId") ) /* 2 rows from results table: resultId raceId driverId constructorId number grid position positionText positionOrder points laps time milliseconds fastestLap rank fastestLapTime fastestLapSpeed statusId 1 18 1 1 22 1 1 1 1 10.0 58 34:50.6 5690616 39 2 01:27.5 218.3 1 2 18 2 2 3 5 2 2 2 8.0 58 5.478 5696094 41 3 01:27.7 217.586 1 */ CREATE TABLE seasons ( year INTEGER, url TEXT, PRIMARY KEY (year) ) /* 2 rows from seasons table: year url 1950 http://en.wikipedia.org/wiki/1950_Formula_One_season 1951 http://en.wikipedia.org/wiki/1951_Formula_One_season */ CREATE TABLE status ( "statusId" INTEGER, status TEXT, PRIMARY KEY ("statusId") ) /* 2 rows from status table: statusId status 1 Finished 2 Disqualified */
What are the maximum fastest lap speed in races held after 2004 grouped by race name and ordered by year?
SELECT max(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year
[{'max(T2.fastestlapspeed)': '202.946', 'name': 'European Grand Prix', 'year': 2016}, {'max(T2.fastestlapspeed)': '209.918', 'name': 'German Grand Prix', 'year': 2016}, {'max(T2.fastestlapspeed)': '198.652', 'name': 'Abu Dhabi Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '220.605', 'name': 'Australian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '230.597', 'name': 'Austrian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '208.919', 'name': 'Azerbaijan Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '209.952', 'name': 'Bahrain Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '236.583', 'name': 'Belgian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '218.349', 'name': 'Brazilian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '234.025', 'name': 'British Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '210.588', 'name': 'Canadian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '205.745', 'name': 'Chinese Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '196.697', 'name': 'Hungarian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '250.174', 'name': 'Italian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '224.439', 'name': 'Japanese Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '212.104', 'name': 'Malaysian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '196.666', 'name': 'Mexican Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '160.561', 'name': 'Monaco Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '217.388', 'name': 'Russian Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '173.643', 'name': 'Singapore Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '200.471', 'name': 'Spanish Grand Prix', 'year': 2017}, {'max(T2.fastestlapspeed)': '203.003', 'name': 'United States Grand Prix', 'year': 2017}]
Medium
false
false
false
true
false
true
false
true
false
false
false
false
false
network_2
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) )
CREATE TABLE "Person" ( name VARCHAR(20), age INTEGER, city TEXT, gender TEXT, job TEXT, PRIMARY KEY (name) ) /* 2 rows from Person table: name age city gender job Alice 25 new york city female student Bob 35 salt lake city male engineer */ CREATE TABLE "PersonFriend" ( name VARCHAR(20), friend VARCHAR(20), year INTEGER, FOREIGN KEY(name) REFERENCES "Person" (name), FOREIGN KEY(friend) REFERENCES "Person" (name) ) /* 2 rows from PersonFriend table: name friend year Alice Bob 10 Zach Dan 12 */
What is the average age for each gender?
SELECT avg(age) , gender FROM Person GROUP BY gender
[{'avg(age)': 25.5, 'gender': 'female'}, {'avg(age)': 40.0, 'gender': 'male'}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]What is the average age of all the dogs?[/QUESTION] [SQL]SELECT avg(age) FROM Dogs[/SQL]
[QUESTION]What is the average age of all the dogs?[/QUESTION] [SQL]SELECT avg(age) FROM Dogs[/SQL]
[QUESTION]What is the average age of all the dogs?[/QUESTION] [SQL]SELECT avg(age) FROM Dogs[/SQL]
[QUESTION]What is the average age of all the dogs?[/QUESTION] [SQL]SELECT avg(age) FROM Dogs[/SQL]
geo
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) )
CREATE TABLE border_info ( state_name TEXT, border TEXT, PRIMARY KEY (border, state_name), FOREIGN KEY(border) REFERENCES state (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from border_info table: state_name border */ CREATE TABLE city ( city_name TEXT, population INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (city_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from city table: city_name population country_name state_name */ CREATE TABLE highlow ( state_name TEXT, highest_elevation TEXT, lowest_point TEXT, highest_point TEXT, lowest_elevation TEXT, PRIMARY KEY (state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from highlow table: state_name highest_elevation lowest_point highest_point lowest_elevation */ CREATE TABLE lake ( lake_name TEXT, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT ) /* 2 rows from lake table: lake_name area country_name state_name */ CREATE TABLE mountain ( mountain_name TEXT, mountain_altitude INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, state_name TEXT, PRIMARY KEY (mountain_name, state_name), FOREIGN KEY(state_name) REFERENCES state (state_name) ) /* 2 rows from mountain table: mountain_name mountain_altitude country_name state_name */ CREATE TABLE river ( river_name TEXT, length INTEGER DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, traverse TEXT, PRIMARY KEY (river_name), FOREIGN KEY(traverse) REFERENCES state (state_name) ) /* 2 rows from river table: river_name length country_name traverse */ CREATE TABLE state ( state_name TEXT, population INTEGER DEFAULT NULL, area DOUBLE DEFAULT NULL, country_name VARCHAR(3) DEFAULT '' NOT NULL, capital TEXT, density DOUBLE DEFAULT NULL, PRIMARY KEY (state_name) ) /* 2 rows from state table: state_name population area country_name capital density */
how many rivers are there in us
SELECT COUNT ( river_name ) FROM river;
[{'COUNT ( river_name )': 0}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
[QUESTION]how many rivers are in the state with the largest population[/QUESTION] [SQL]SELECT COUNT ( t2.river_name ) FROM river AS t2 JOIN state AS t1 ON t1.state_name = t2.traverse WHERE t1.state_name = ( SELECT state_name FROM state WHERE population = ( SELECT MAX ( population ) FROM state ) );[/SQL]
scholar
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") )
CREATE TABLE "paperDataset" ( "paperId" INTEGER DEFAULT NULL, "datasetId" INTEGER DEFAULT NULL, PRIMARY KEY ("datasetId", "paperId") ) /* 2 rows from paperDataset table: paperId datasetId */ CREATE TABLE "paperKeyphrase" ( "paperId" INTEGER DEFAULT NULL, "keyphraseId" INTEGER DEFAULT NULL, PRIMARY KEY ("keyphraseId", "paperId"), FOREIGN KEY("keyphraseId") REFERENCES keyphrase ("keyphraseId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from paperKeyphrase table: paperId keyphraseId */ CREATE TABLE author ( "authorId" INTEGER NOT NULL, "authorName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("authorId") ) /* 2 rows from author table: authorId authorName */ CREATE TABLE cite ( "citingPaperId" INTEGER NOT NULL, "citedPaperId" INTEGER NOT NULL, PRIMARY KEY ("citingPaperId", "citedPaperId"), FOREIGN KEY("citingPaperId") REFERENCES paper ("paperId"), FOREIGN KEY("citedPaperId") REFERENCES paper ("paperId") ) /* 2 rows from cite table: citingPaperId citedPaperId */ CREATE TABLE dataset ( "datasetId" INTEGER NOT NULL, "datasetName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("datasetId") ) /* 2 rows from dataset table: datasetId datasetName */ CREATE TABLE journal ( "journalId" INTEGER NOT NULL, "journalName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("journalId") ) /* 2 rows from journal table: journalId journalName */ CREATE TABLE keyphrase ( "keyphraseId" INTEGER NOT NULL, "keyphraseName" VARCHAR(50) DEFAULT NULL, PRIMARY KEY ("keyphraseId") ) /* 2 rows from keyphrase table: keyphraseId keyphraseName */ CREATE TABLE paper ( "paperId" INTEGER NOT NULL, title VARCHAR(300) DEFAULT NULL, "venueId" INTEGER DEFAULT NULL, year INTEGER DEFAULT NULL, "numCiting" INTEGER DEFAULT NULL, "numCitedBy" INTEGER DEFAULT NULL, "journalId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId"), FOREIGN KEY("venueId") REFERENCES venue ("venueId"), FOREIGN KEY("journalId") REFERENCES journal ("journalId") ) /* 2 rows from paper table: paperId title venueId year numCiting numCitedBy journalId */ CREATE TABLE venue ( "venueId" INTEGER NOT NULL, "venueName" VARCHAR(100) DEFAULT NULL, PRIMARY KEY ("venueId") ) /* 2 rows from venue table: venueId venueName */ CREATE TABLE writes ( "paperId" INTEGER DEFAULT NULL, "authorId" INTEGER DEFAULT NULL, PRIMARY KEY ("paperId", "authorId"), FOREIGN KEY("authorId") REFERENCES author ("authorId"), FOREIGN KEY("paperId") REFERENCES paper ("paperId") ) /* 2 rows from writes table: paperId authorId */
who writes papers with Noah A Smith ?
SELECT DISTINCT t1.authorid FROM writes AS t3 JOIN author AS t2 ON t3.authorid = t2.authorid JOIN writes AS t4 ON t4.paperid = t3.paperid JOIN author AS t1 ON t4.authorid = t1.authorid WHERE t2.authorname = "Noah A Smith";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
apartment_rentals
CREATE TABLE "Apartment_Bookings" ( apt_booking_id INTEGER NOT NULL, apt_id INTEGER, guest_id INTEGER NOT NULL, booking_status_code CHAR(15) NOT NULL, booking_start_date DATETIME, booking_end_date DATETIME, PRIMARY KEY (apt_booking_id), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id), UNIQUE (apt_booking_id) ) CREATE TABLE "Apartment_Buildings" ( building_id INTEGER NOT NULL, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80), PRIMARY KEY (building_id), UNIQUE (building_id) ) CREATE TABLE "Apartment_Facilities" ( apt_id INTEGER NOT NULL, facility_code CHAR(15) NOT NULL, PRIMARY KEY (apt_id, facility_code), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id) ) CREATE TABLE "Apartments" ( apt_id INTEGER NOT NULL, building_id INTEGER NOT NULL, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5), PRIMARY KEY (apt_id), FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id), UNIQUE (apt_id) ) CREATE TABLE "Guests" ( guest_id INTEGER NOT NULL, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME, PRIMARY KEY (guest_id), UNIQUE (guest_id) ) CREATE TABLE "View_Unit_Status" ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME NOT NULL, available_yn NUMERIC, PRIMARY KEY (status_date), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id) )
CREATE TABLE "Apartment_Bookings" ( apt_booking_id INTEGER NOT NULL, apt_id INTEGER, guest_id INTEGER NOT NULL, booking_status_code CHAR(15) NOT NULL, booking_start_date DATETIME, booking_end_date DATETIME, PRIMARY KEY (apt_booking_id), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(guest_id) REFERENCES "Guests" (guest_id), UNIQUE (apt_booking_id) ) /* 2 rows from Apartment_Bookings table: apt_booking_id apt_id guest_id booking_status_code booking_start_date booking_end_date 258 10 2 Provisional 2016-09-26 17:13:49 2017-10-07 11:38:48 279 15 15 Provisional 2016-04-01 06:28:08 2017-10-25 11:08:42 */ CREATE TABLE "Apartment_Buildings" ( building_id INTEGER NOT NULL, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80), PRIMARY KEY (building_id), UNIQUE (building_id) ) /* 2 rows from Apartment_Buildings table: building_id building_short_name building_full_name building_description building_address building_manager building_phone 133 Normandie Court Normandie Court Studio 7950 Casper Vista Apt. 176 Marquiseberg, CA 70496 Emma (948)040-1064x387 153 Mercedes House Mercedes House Studio 354 Otto Villages Charliefort, VT 71664 Brenden 915-617-2408x832 */ CREATE TABLE "Apartment_Facilities" ( apt_id INTEGER NOT NULL, facility_code CHAR(15) NOT NULL, PRIMARY KEY (apt_id, facility_code), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id) ) /* 2 rows from Apartment_Facilities table: apt_id facility_code 1 Boardband 2 Boardband */ CREATE TABLE "Apartments" ( apt_id INTEGER NOT NULL, building_id INTEGER NOT NULL, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5), PRIMARY KEY (apt_id), FOREIGN KEY(building_id) REFERENCES "Apartment_Buildings" (building_id), UNIQUE (apt_id) ) /* 2 rows from Apartments table: apt_id building_id apt_type_code apt_number bathroom_count bedroom_count room_count 1 808 Flat Suite 645 1 3 7 2 624 Flat Apt. 585 2 4 5 */ CREATE TABLE "Guests" ( guest_id INTEGER NOT NULL, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME, PRIMARY KEY (guest_id), UNIQUE (guest_id) ) /* 2 rows from Guests table: guest_id gender_code guest_first_name guest_last_name date_of_birth 1 Male Kip DuBuque 1995-11-04 07:09:57 2 Unknown Rebeca Runolfsdottir 1974-05-12 21:53:58 */ CREATE TABLE "View_Unit_Status" ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME NOT NULL, available_yn NUMERIC, PRIMARY KEY (status_date), FOREIGN KEY(apt_id) REFERENCES "Apartments" (apt_id), FOREIGN KEY(apt_booking_id) REFERENCES "Apartment_Bookings" (apt_booking_id) ) /* 2 rows from View_Unit_Status table: apt_id apt_booking_id status_date available_yn 11 920 1970-09-28 10:24:29 1.0000000000 15 575 1972-03-23 22:55:53 1.0000000000 */
Show each apartment type code, and the maximum and minimum number of rooms for each type.
SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code
[{'apt_type_code': 'Duplex', 'max(room_count)': '9', 'min(room_count)': '3'}, {'apt_type_code': 'Flat', 'max(room_count)': '9', 'min(room_count)': '3'}, {'apt_type_code': 'Studio', 'max(room_count)': '9', 'min(room_count)': '6'}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
[QUESTION]What are the names of properties that are either houses or apartments with more than 1 room?[/QUESTION] [SQL]SELECT property_name FROM Properties WHERE property_type_code = "House" UNION SELECT property_name FROM Properties WHERE property_type_code = "Apartment" AND room_count > 1[/SQL]
train_station
CREATE TABLE station ( "Station_ID" INTEGER, "Name" TEXT, "Annual_entry_exit" REAL, "Annual_interchanges" REAL, "Total_Passengers" REAL, "Location" TEXT, "Main_Services" TEXT, "Number_of_Platforms" INTEGER, PRIMARY KEY ("Station_ID") ) CREATE TABLE train ( "Train_ID" INTEGER, "Name" TEXT, "Time" TEXT, "Service" TEXT, PRIMARY KEY ("Train_ID") ) CREATE TABLE train_station ( "Train_ID" INTEGER, "Station_ID" INTEGER, PRIMARY KEY ("Train_ID", "Station_ID"), FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID") )
CREATE TABLE station ( "Station_ID" INTEGER, "Name" TEXT, "Annual_entry_exit" REAL, "Annual_interchanges" REAL, "Total_Passengers" REAL, "Location" TEXT, "Main_Services" TEXT, "Number_of_Platforms" INTEGER, PRIMARY KEY ("Station_ID") ) /* 2 rows from station table: Station_ID Name Annual_entry_exit Annual_interchanges Total_Passengers Location Main_Services Number_of_Platforms 1 London Waterloo 94.046 9.489 103.534 London South Western Main Line West of England Main Line 19 2 London Victoria 76.231 9.157 85.38 London Brighton Main Line Chatham Main Line 19 */ CREATE TABLE train ( "Train_ID" INTEGER, "Name" TEXT, "Time" TEXT, "Service" TEXT, PRIMARY KEY ("Train_ID") ) /* 2 rows from train table: Train_ID Name Time Service 1 Ananthapuri Express 17:15 Daily 2 Guruvayur Express 22:10 Daily */ CREATE TABLE train_station ( "Train_ID" INTEGER, "Station_ID" INTEGER, PRIMARY KEY ("Train_ID", "Station_ID"), FOREIGN KEY("Train_ID") REFERENCES train ("Train_ID"), FOREIGN KEY("Station_ID") REFERENCES station ("Station_ID") ) /* 2 rows from train_station table: Train_ID Station_ID 1 1 2 1 */
Show the station name with at least two trains.
SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING count(*) >= 2
[{'Name': 'London Waterloo'}, {'Name': 'Glasgow Central'}, {'Name': 'East Croydon'}]
Medium
false
false
false
false
false
true
true
true
false
false
false
false
false
department_management
CREATE TABLE department ( "Department_ID" INTEGER, "Name" TEXT, "Creation" TEXT, "Ranking" INTEGER, "Budget_in_Billions" REAL, "Num_Employees" REAL, PRIMARY KEY ("Department_ID") ) CREATE TABLE head ( "head_ID" INTEGER, name TEXT, born_state TEXT, age REAL, PRIMARY KEY ("head_ID") ) CREATE TABLE management ( "department_ID" INTEGER, "head_ID" INTEGER, temporary_acting TEXT, PRIMARY KEY ("department_ID", "head_ID"), FOREIGN KEY("head_ID") REFERENCES head ("head_ID"), FOREIGN KEY("department_ID") REFERENCES department ("Department_ID") )
CREATE TABLE department ( "Department_ID" INTEGER, "Name" TEXT, "Creation" TEXT, "Ranking" INTEGER, "Budget_in_Billions" REAL, "Num_Employees" REAL, PRIMARY KEY ("Department_ID") ) /* 2 rows from department table: Department_ID Name Creation Ranking Budget_in_Billions Num_Employees 1 State 1789 1 9.96 30266.0 2 Treasury 1789 2 11.1 115897.0 */ CREATE TABLE head ( "head_ID" INTEGER, name TEXT, born_state TEXT, age REAL, PRIMARY KEY ("head_ID") ) /* 2 rows from head table: head_ID name born_state age 1 Tiger Woods Alabama 67.0 2 Sergio García California 68.0 */ CREATE TABLE management ( "department_ID" INTEGER, "head_ID" INTEGER, temporary_acting TEXT, PRIMARY KEY ("department_ID", "head_ID"), FOREIGN KEY("head_ID") REFERENCES head ("head_ID"), FOREIGN KEY("department_ID") REFERENCES department ("Department_ID") ) /* 2 rows from management table: department_ID head_ID temporary_acting 2 5 Yes 15 4 Yes */
What are the names of the heads who are born outside the California state?
SELECT name FROM head WHERE born_state != 'California'
[{'name': 'Tiger Woods'}, {'name': 'K. J. Choi'}, {'name': 'Jeff Maggert'}, {'name': 'Stewart Cink'}, {'name': 'Pádraig Harrington'}, {'name': 'Franklin Langham'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false