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
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 name, type, and flag of the ship that is built in the most recent year.
SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1
[{'Name': 'HMS Gorgon', 'Type': 'Panamax', 'Flag': 'Panama'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
railway
CREATE TABLE manager ( "Manager_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Working_year_starts" TEXT, "Age" INTEGER, "Level" INTEGER, PRIMARY KEY ("Manager_ID") ) CREATE TABLE railway ( "Railway_ID" INTEGER, "Railway" TEXT, "Builder" TEXT, "Built" TEXT, "Wheels" TEXT, "Location" TEXT, "ObjectNumber" TEXT, PRIMARY KEY ("Railway_ID") ) CREATE TABLE railway_manage ( "Railway_ID" INTEGER, "Manager_ID" INTEGER, "From_Year" TEXT, PRIMARY KEY ("Railway_ID", "Manager_ID"), FOREIGN KEY("Manager_ID") REFERENCES manager ("Manager_ID"), FOREIGN KEY("Railway_ID") REFERENCES railway ("Railway_ID") ) CREATE TABLE train ( "Train_ID" INTEGER, "Train_Num" TEXT, "Name" TEXT, "From" TEXT, "Arrival" TEXT, "Railway_ID" INTEGER, PRIMARY KEY ("Train_ID"), FOREIGN KEY("Railway_ID") REFERENCES railway ("Railway_ID") )
CREATE TABLE manager ( "Manager_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Working_year_starts" TEXT, "Age" INTEGER, "Level" INTEGER, PRIMARY KEY ("Manager_ID") ) /* 2 rows from manager table: Manager_ID Name Country Working_year_starts Age Level 1 Ben Curtis United States 2003 45 5 2 Todd Hamilton United States 2004 55 5 */ CREATE TABLE railway ( "Railway_ID" INTEGER, "Railway" TEXT, "Builder" TEXT, "Built" TEXT, "Wheels" TEXT, "Location" TEXT, "ObjectNumber" TEXT, PRIMARY KEY ("Railway_ID") ) /* 2 rows from railway table: Railway_ID Railway Builder Built Wheels Location ObjectNumber 1 SECR SECR Ashford 1901 4-4-0 York 1975-7006 2 MR MR Derby 1902 Midland Railway 1000 was rebuilt in 1914. 4-4-0 Bo'ness 1975-7018 */ CREATE TABLE railway_manage ( "Railway_ID" INTEGER, "Manager_ID" INTEGER, "From_Year" TEXT, PRIMARY KEY ("Railway_ID", "Manager_ID"), FOREIGN KEY("Manager_ID") REFERENCES manager ("Manager_ID"), FOREIGN KEY("Railway_ID") REFERENCES railway ("Railway_ID") ) /* 2 rows from railway_manage table: Railway_ID Manager_ID From_Year 8 1 2010 9 2 2011 */ CREATE TABLE train ( "Train_ID" INTEGER, "Train_Num" TEXT, "Name" TEXT, "From" TEXT, "Arrival" TEXT, "Railway_ID" INTEGER, PRIMARY KEY ("Train_ID"), FOREIGN KEY("Railway_ID") REFERENCES railway ("Railway_ID") ) /* 2 rows from train table: Train_ID Train_Num Name From Arrival Railway_ID 1 51195 Wardha-Ballarshah Pass Wardha 08:54 1 2 12139 Sewagram Exp Mumbai CST 09:08 1 */
Show different builders of railways, along with the corresponding number of railways using each builder.
SELECT Builder , COUNT(*) FROM railway GROUP BY Builder
[{'Builder': 'Avonside', 'COUNT(*)': 1}, {'Builder': 'GER Hartford', 'COUNT(*)': 1}, {'Builder': 'GER Stratford', 'COUNT(*)': 1}, {'Builder': 'GNR Doncaster', 'COUNT(*)': 1}, {'Builder': 'GWR Swindon', 'COUNT(*)': 2}, {'Builder': 'MR Derby', 'COUNT(*)': 1}, {'Builder': 'SECR Ashford', 'COUNT(*)': 1}, {'Builder': 'Stephenson', 'COUNT(*)': 1}, {'Builder': 'Swindon Works', 'COUNT(*)': 1}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
products_gen_characteristics
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) )
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) /* 2 rows from Characteristics table: characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details 1 Grade numquam slow None 2 Grade doloribus fast None */ CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) /* 2 rows from Product_Characteristics table: product_id characteristic_id product_characteristic_value 13 13 low 11 2 low */ CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) /* 2 rows from Products table: product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details 1 4 Spices cumin 2878.3 et None 2 2 Spices peper 352447.2874677 1892070.2803543 rerum None */ CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) /* 2 rows from Ref_Characteristic_Types table: characteristic_type_code characteristic_type_description Grade Grade Purity Purity */ CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) /* 2 rows from Ref_Colors table: color_code color_description 9 red 5 green */ CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) ) /* 2 rows from Ref_Product_Categories table: product_category_code product_category_description unit_of_measure Herbs Herbs Handful Seeds Seeds Weight - pound,kilo. */
Return the category code and typical price of 'cumin'.
SELECT product_category_code , typical_buying_price FROM products WHERE product_name = "cumin"
[{'product_category_code': 'Spices', 'typical_buying_price': ''}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
aircraft
CREATE TABLE "match" ( "Round" REAL, "Location" TEXT, "Country" TEXT, "Date" TEXT, "Fastest_Qualifying" TEXT, "Winning_Pilot" TEXT, "Winning_Aircraft" TEXT, PRIMARY KEY ("Round"), FOREIGN KEY("Winning_Pilot") REFERENCES pilot ("Pilot_Id"), FOREIGN KEY("Winning_Aircraft") REFERENCES aircraft ("Aircraft_ID") ) CREATE TABLE aircraft ( "Aircraft_ID" INTEGER NOT NULL, "Aircraft" VARCHAR(50) NOT NULL, "Description" VARCHAR(50) NOT NULL, "Max_Gross_Weight" VARCHAR(50) NOT NULL, "Total_disk_area" VARCHAR(50) NOT NULL, "Max_disk_Loading" VARCHAR(50) NOT NULL, PRIMARY KEY ("Aircraft_ID") ) CREATE TABLE airport ( "Airport_ID" INTEGER, "Airport_Name" TEXT, "Total_Passengers" REAL, "%_Change_2007" TEXT, "International_Passengers" REAL, "Domestic_Passengers" REAL, "Transit_Passengers" REAL, "Aircraft_Movements" REAL, "Freight_Metric_Tonnes" REAL, PRIMARY KEY ("Airport_ID") ) CREATE TABLE airport_aircraft ( "ID" INTEGER, "Airport_ID" INTEGER, "Aircraft_ID" INTEGER, PRIMARY KEY ("Airport_ID", "Aircraft_ID"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Airport_ID") REFERENCES airport ("Airport_ID") ) CREATE TABLE pilot ( "Pilot_Id" INTEGER NOT NULL, "Name" VARCHAR(50) NOT NULL, "Age" INTEGER NOT NULL, PRIMARY KEY ("Pilot_Id") )
CREATE TABLE "match" ( "Round" REAL, "Location" TEXT, "Country" TEXT, "Date" TEXT, "Fastest_Qualifying" TEXT, "Winning_Pilot" TEXT, "Winning_Aircraft" TEXT, PRIMARY KEY ("Round"), FOREIGN KEY("Winning_Pilot") REFERENCES pilot ("Pilot_Id"), FOREIGN KEY("Winning_Aircraft") REFERENCES aircraft ("Aircraft_ID") ) /* 2 rows from match table: Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft 1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1 2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1 */ CREATE TABLE aircraft ( "Aircraft_ID" INTEGER NOT NULL, "Aircraft" VARCHAR(50) NOT NULL, "Description" VARCHAR(50) NOT NULL, "Max_Gross_Weight" VARCHAR(50) NOT NULL, "Total_disk_area" VARCHAR(50) NOT NULL, "Max_disk_Loading" VARCHAR(50) NOT NULL, PRIMARY KEY ("Aircraft_ID") ) /* 2 rows from aircraft table: Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading 1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²) 2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²) */ CREATE TABLE airport ( "Airport_ID" INTEGER, "Airport_Name" TEXT, "Total_Passengers" REAL, "%_Change_2007" TEXT, "International_Passengers" REAL, "Domestic_Passengers" REAL, "Transit_Passengers" REAL, "Aircraft_Movements" REAL, "Freight_Metric_Tonnes" REAL, PRIMARY KEY ("Airport_ID") ) /* 2 rows from airport table: Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes 1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0 2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0 */ CREATE TABLE airport_aircraft ( "ID" INTEGER, "Airport_ID" INTEGER, "Aircraft_ID" INTEGER, PRIMARY KEY ("Airport_ID", "Aircraft_ID"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Airport_ID") REFERENCES airport ("Airport_ID") ) /* 2 rows from airport_aircraft table: ID Airport_ID Aircraft_ID 1 6 5 2 2 1 */ CREATE TABLE pilot ( "Pilot_Id" INTEGER NOT NULL, "Name" VARCHAR(50) NOT NULL, "Age" INTEGER NOT NULL, PRIMARY KEY ("Pilot_Id") ) /* 2 rows from pilot table: Pilot_Id Name Age 1 Prof. Zackery Collins 23 2 Katheryn Gorczany IV 20 */
What are the names of all aircrafts that are associated with both London Heathrow and Gatwick airports?
SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Heathrow" INTERSECT SELECT T1.Aircraft FROM aircraft AS T1 JOIN airport_aircraft AS T2 ON T1.Aircraft_ID = T2.Aircraft_ID JOIN airport AS T3 ON T2.Airport_ID = T3.Airport_ID WHERE T3.Airport_Name = "London Gatwick"
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
true
false
false
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
cre_Drama_Workshop_Groups
CREATE TABLE "Addresses" ( "Address_ID" VARCHAR(100) NOT NULL, "Line_1" VARCHAR(255), "Line_2" VARCHAR(255), "City_Town" VARCHAR(255), "State_County" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Address_ID"), UNIQUE ("Address_ID") ) CREATE TABLE "Bookings" ( "Booking_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Workshop_Group_ID" VARCHAR(100) NOT NULL, "Status_Code" CHAR(15) NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Booking_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Clients" ("Client_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), UNIQUE ("Booking_ID") ) CREATE TABLE "Bookings_Services" ( "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Product_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY("Product_ID") REFERENCES "Services" ("Service_ID") ) CREATE TABLE "Clients" ( "Client_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Email_Address" VARCHAR(255), "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Client_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Client_ID") ) CREATE TABLE "Customer_Orders" ( "Order_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Order_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Store_ID") REFERENCES "Stores" ("Store_ID"), UNIQUE ("Order_ID") ) CREATE TABLE "Customers" ( "Customer_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Customer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Customer_ID") ) CREATE TABLE "Drama_Workshop_Groups" ( "Workshop_Group_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Currency_Code" CHAR(15) NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Workshop_Group_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Workshop_Group_ID") ) CREATE TABLE "Invoice_Items" ( "Invoice_Item_ID" INTEGER NOT NULL, "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Order_Item_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" INTEGER, "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Invoice_Item_ID"), FOREIGN KEY("Order_Item_ID") REFERENCES "Order_Items" ("Order_Item_ID"), FOREIGN KEY("Invoice_ID") REFERENCES "Invoices" ("Invoice_ID"), FOREIGN KEY("Order_ID", "Product_ID") REFERENCES "Bookings_Services" ("Order_ID", "Product_ID") ) CREATE TABLE "Invoices" ( "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, payment_method_code CHAR(15), "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), "Order_Item_ID" INTEGER NOT NULL, PRIMARY KEY ("Invoice_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY(payment_method_code) REFERENCES "Ref_Payment_Methods" (payment_method_code) ) CREATE TABLE "Marketing_Regions" ( "Marketing_Region_Code" CHAR(15) NOT NULL, "Marketing_Region_Name" VARCHAR(255) NOT NULL, "Marketing_Region_Descriptrion" VARCHAR(255) NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Marketing_Region_Code"), UNIQUE ("Marketing_Region_Code") ) CREATE TABLE "Order_Items" ( "Order_Item_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Order_Item_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Product_ID") REFERENCES "Products" ("Product_ID") ) CREATE TABLE "Performers" ( "Performer_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Performer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Performer_ID") ) CREATE TABLE "Performers_in_Bookings" ( "Order_ID" INTEGER NOT NULL, "Performer_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Performer_ID"), FOREIGN KEY("Performer_ID") REFERENCES "Performers" ("Performer_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID") ) CREATE TABLE "Products" ( "Product_ID" VARCHAR(100) NOT NULL, "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Product_Description" VARCHAR(255), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Product_ID"), UNIQUE ("Product_ID") ) CREATE TABLE "Ref_Payment_Methods" ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) CREATE TABLE "Ref_Service_Types" ( "Service_Type_Code" CHAR(15) NOT NULL, "Parent_Service_Type_Code" CHAR(15), "Service_Type_Description" VARCHAR(255), PRIMARY KEY ("Service_Type_Code"), UNIQUE ("Service_Type_Code") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Type_Code" CHAR(15), "Workshop_Group_ID" INTEGER NOT NULL, "Product_Description" VARCHAR(255), "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), FOREIGN KEY("Service_Type_Code") REFERENCES "Ref_Service_Types" ("Service_Type_Code"), UNIQUE ("Service_ID") ) CREATE TABLE "Stores" ( "Store_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Store_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), FOREIGN KEY("Marketing_Region_Code") REFERENCES "Marketing_Regions" ("Marketing_Region_Code"), UNIQUE ("Store_ID") )
CREATE TABLE "Addresses" ( "Address_ID" VARCHAR(100) NOT NULL, "Line_1" VARCHAR(255), "Line_2" VARCHAR(255), "City_Town" VARCHAR(255), "State_County" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Address_ID"), UNIQUE ("Address_ID") ) /* 2 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None */ CREATE TABLE "Bookings" ( "Booking_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Workshop_Group_ID" VARCHAR(100) NOT NULL, "Status_Code" CHAR(15) NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Booking_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Clients" ("Client_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), UNIQUE ("Booking_ID") ) /* 2 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None */ CREATE TABLE "Bookings_Services" ( "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Product_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY("Product_ID") REFERENCES "Services" ("Service_ID") ) /* 2 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 */ CREATE TABLE "Clients" ( "Client_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Email_Address" VARCHAR(255), "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Client_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Client_ID") ) /* 2 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 [email protected] Clifford (042)912-3404x5135 VIP 426 383 [email protected] Bettye (604)849-0214 None */ CREATE TABLE "Customer_Orders" ( "Order_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Order_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Store_ID") REFERENCES "Stores" ("Store_ID"), UNIQUE ("Order_ID") ) /* 2 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None */ CREATE TABLE "Customers" ( "Customer_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Customer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Customer_ID") ) /* 2 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 [email protected] None 267 98 Federico 914-915-7483 [email protected] None */ CREATE TABLE "Drama_Workshop_Groups" ( "Workshop_Group_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Currency_Code" CHAR(15) NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Workshop_Group_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Workshop_Group_ID") ) /* 2 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 [email protected] None 140 180 EU DE Veda Film 793-966-9311x5303 [email protected] None */ CREATE TABLE "Invoice_Items" ( "Invoice_Item_ID" INTEGER NOT NULL, "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Order_Item_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" INTEGER, "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Invoice_Item_ID"), FOREIGN KEY("Order_Item_ID") REFERENCES "Order_Items" ("Order_Item_ID"), FOREIGN KEY("Invoice_ID") REFERENCES "Invoices" ("Invoice_ID"), FOREIGN KEY("Order_ID", "Product_ID") REFERENCES "Bookings_Services" ("Order_ID", "Product_ID") ) /* 2 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality */ CREATE TABLE "Invoices" ( "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, payment_method_code CHAR(15), "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), "Order_Item_ID" INTEGER NOT NULL, PRIMARY KEY ("Invoice_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY(payment_method_code) REFERENCES "Ref_Payment_Methods" (payment_method_code) ) /* 2 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 */ CREATE TABLE "Marketing_Regions" ( "Marketing_Region_Code" CHAR(15) NOT NULL, "Marketing_Region_Name" VARCHAR(255) NOT NULL, "Marketing_Region_Descriptrion" VARCHAR(255) NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Marketing_Region_Code"), UNIQUE ("Marketing_Region_Code") ) /* 2 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None */ CREATE TABLE "Order_Items" ( "Order_Item_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Order_Item_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Product_ID") REFERENCES "Products" ("Product_ID") ) /* 2 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None */ CREATE TABLE "Performers" ( "Performer_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Performer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Performer_ID") ) /* 2 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 [email protected] None 211 124 Ashley 893-536-8857 [email protected] None */ CREATE TABLE "Performers_in_Bookings" ( "Order_ID" INTEGER NOT NULL, "Performer_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Performer_ID"), FOREIGN KEY("Performer_ID") REFERENCES "Performers" ("Performer_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID") ) /* 2 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 */ CREATE TABLE "Products" ( "Product_ID" VARCHAR(100) NOT NULL, "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Product_Description" VARCHAR(255), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Product_ID"), UNIQUE ("Product_ID") ) /* 2 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536.0000 None None 154 film 2302.0000 None None */ CREATE TABLE "Ref_Payment_Methods" ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) /* 2 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit */ CREATE TABLE "Ref_Service_Types" ( "Service_Type_Code" CHAR(15) NOT NULL, "Parent_Service_Type_Code" CHAR(15), "Service_Type_Description" VARCHAR(255), PRIMARY KEY ("Service_Type_Code"), UNIQUE ("Service_Type_Code") ) /* 2 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service */ CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Type_Code" CHAR(15), "Workshop_Group_ID" INTEGER NOT NULL, "Product_Description" VARCHAR(255), "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), FOREIGN KEY("Service_Type_Code") REFERENCES "Ref_Service_Types" ("Service_Type_Code"), UNIQUE ("Service_ID") ) /* 2 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 58932775.8822 None 219 2 838 None film 2704.4719 None */ CREATE TABLE "Stores" ( "Store_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Store_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), FOREIGN KEY("Marketing_Region_Code") REFERENCES "Marketing_Regions" ("Marketing_Region_Code"), UNIQUE ("Store_ID") ) /* 2 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 [email protected] None 229 266 CA Rob Dinning 1-327-185-9368 [email protected] 5 stars */
Which status code is the most common of all the bookings?
SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY count(*) DESC LIMIT 1
[{'Status_Code': 'good'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
icfp_1
CREATE TABLE "Authors" ( "authID" INTEGER, lname TEXT, fname TEXT, PRIMARY KEY ("authID") ) CREATE TABLE "Authorship" ( "authID" INTEGER, "instID" INTEGER, "paperID" INTEGER, "authOrder" INTEGER, PRIMARY KEY ("authID", "instID", "paperID"), FOREIGN KEY("authID") REFERENCES "Authors" ("authID"), FOREIGN KEY("instID") REFERENCES "Inst" ("instID"), FOREIGN KEY("paperID") REFERENCES "Papers" ("paperID") ) CREATE TABLE "Inst" ( "instID" INTEGER, name TEXT, country TEXT, PRIMARY KEY ("instID") ) CREATE TABLE "Papers" ( "paperID" INTEGER, title TEXT, PRIMARY KEY ("paperID") )
CREATE TABLE "Authors" ( "authID" INTEGER, lname TEXT, fname TEXT, PRIMARY KEY ("authID") ) /* 2 rows from Authors table: authID lname fname 50 Gibbons Jeremy 51 Hinze Ralf */ CREATE TABLE "Authorship" ( "authID" INTEGER, "instID" INTEGER, "paperID" INTEGER, "authOrder" INTEGER, PRIMARY KEY ("authID", "instID", "paperID"), FOREIGN KEY("authID") REFERENCES "Authors" ("authID"), FOREIGN KEY("instID") REFERENCES "Inst" ("instID"), FOREIGN KEY("paperID") REFERENCES "Papers" ("paperID") ) /* 2 rows from Authorship table: authID instID paperID authOrder 50 1000 200 1 51 1000 200 2 */ CREATE TABLE "Inst" ( "instID" INTEGER, name TEXT, country TEXT, PRIMARY KEY ("instID") ) /* 2 rows from Inst table: instID name country 1000 University of Oxford UK 1010 Northeastern University USA */ CREATE TABLE "Papers" ( "paperID" INTEGER, title TEXT, PRIMARY KEY ("paperID") ) /* 2 rows from Papers table: paperID title 200 Just do it: Simple Monadic Equational Reasoning 201 Proving the Unique Fixed-Point Principle Correct: An Adventure with Category Theory */
Retrieve all the first and last names of authors in the alphabetical order of last names.
SELECT fname , lname FROM authors ORDER BY lname
[{'fname': 'Amal', 'lname': 'Ahmed'}, {'fname': 'Matthias', 'lname': 'Blume'}, {'fname': 'Jeremy', 'lname': 'Gibbons'}, {'fname': 'Ralf', 'lname': 'Hinze'}, {'fname': 'Daniel W. H.', 'lname': 'James'}, {'fname': 'Atsushi', 'lname': 'Ohori'}, {'fname': 'Nicolas', 'lname': 'Pouillard'}, {'fname': 'Tim', 'lname': 'Sheard'}, {'fname': 'Olin', 'lname': 'Shivers'}, {'fname': 'Aaron', 'lname': 'Turon'}, {'fname': 'Katsuhiro', 'lname': 'Ueno'}, {'fname': 'Stephanie', 'lname': 'Weirich'}, {'fname': 'Brent', 'lname': 'Yorgey'}]
Easy
false
false
false
true
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]
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 before 2010 about character recognition
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 WHERE t1.keyphrasename = "character recognition" AND t3.year < 2010;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
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 */
How many activities does Mark Giuliano participate in?
SELECT count(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
[{'count(*)': 3}]
Medium
false
false
false
false
false
false
false
true
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 */
For the oldest movie listed, what is its average rating and title?
SELECT avg(T1.stars) , T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT min(YEAR) FROM Movie)
[{'avg(T1.stars)': 4.5, 'title': 'Snow White'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What is the number of movies directed by " Woody Allen " per year ?[/QUESTION] [SQL]SELECT COUNT ( DISTINCT t3.title ) , t3.release_year FROM director AS t2 JOIN directed_by AS t1 ON t2.did = t1.did JOIN movie AS t3 ON t3.mid = t1.msid WHERE t2.name = "Woody Allen" GROUP BY t3.release_year;[/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 personal name, family name, and author ID of the course author that teaches the most courses.
SELECT T1.personal_name , T1.family_name , T2.author_id FROM Course_Authors_and_Tutors AS T1 JOIN Courses AS T2 ON T1.author_id = T2.author_id GROUP BY T2.author_id ORDER BY COUNT(*) DESC LIMIT 1
[{'personal_name': 'Dusty', 'family_name': 'Crist', 'author_id': 14}]
Medium
false
false
false
true
true
true
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]
company_employee
CREATE TABLE company ( "Company_ID" REAL, "Name" TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_in_Billion" REAL, "Profits_in_Billion" REAL, "Assets_in_Billion" REAL, "Market_Value_in_Billion" REAL, PRIMARY KEY ("Company_ID") ) CREATE TABLE employment ( "Company_ID" INTEGER, "People_ID" INTEGER, "Year_working" INTEGER, PRIMARY KEY ("Company_ID", "People_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Age" INTEGER, "Name" TEXT, "Nationality" TEXT, "Graduation_College" TEXT, PRIMARY KEY ("People_ID") )
CREATE TABLE company ( "Company_ID" REAL, "Name" TEXT, "Headquarters" TEXT, "Industry" TEXT, "Sales_in_Billion" REAL, "Profits_in_Billion" REAL, "Assets_in_Billion" REAL, "Market_Value_in_Billion" REAL, PRIMARY KEY ("Company_ID") ) /* 2 rows from company table: Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion 1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4 2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1 */ CREATE TABLE employment ( "Company_ID" INTEGER, "People_ID" INTEGER, "Year_working" INTEGER, PRIMARY KEY ("Company_ID", "People_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Company_ID") REFERENCES company ("Company_ID") ) /* 2 rows from employment table: Company_ID People_ID Year_working 11 3 2 13 2 3 */ CREATE TABLE people ( "People_ID" INTEGER, "Age" INTEGER, "Name" TEXT, "Nationality" TEXT, "Graduation_College" TEXT, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Age Name Nationality Graduation_College 1 27 Reggie Lewis United States Northeastern 2 25 Brad Lohaus United States Iowa */
Show names of companies and that of employees in descending order of number of years working for that employee.
SELECT T3.Name , T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID ORDER BY T1.Year_working
[{'Name': 'Reggie Lewis'}, {'Name': 'Darryl Kennedy'}, {'Name': 'Tom Sheehey'}, {'Name': 'Brad Lohaus'}, {'Name': 'Jerry Corcoran'}]
Hard
false
false
false
true
false
false
false
false
true
false
false
false
false
[QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION] [SQL]SELECT name FROM employee ORDER BY age[/SQL]
[QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION] [SQL]SELECT name FROM employee ORDER BY age[/SQL]
[QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION] [SQL]SELECT name FROM employee ORDER BY age[/SQL]
[QUESTION]List the names of employees and sort in ascending order of age.[/QUESTION] [SQL]SELECT name FROM employee ORDER BY age[/SQL]
candidate_poll
CREATE TABLE candidate ( "Candidate_ID" INTEGER, "People_ID" INTEGER, "Poll_Source" TEXT, "Date" TEXT, "Support_rate" REAL, "Consider_rate" REAL, "Oppose_rate" REAL, "Unsure_rate" REAL, PRIMARY KEY ("Candidate_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Sex" TEXT, "Name" TEXT, "Date_of_Birth" TEXT, "Height" REAL, "Weight" REAL, PRIMARY KEY ("People_ID") )
CREATE TABLE candidate ( "Candidate_ID" INTEGER, "People_ID" INTEGER, "Poll_Source" TEXT, "Date" TEXT, "Support_rate" REAL, "Consider_rate" REAL, "Oppose_rate" REAL, "Unsure_rate" REAL, PRIMARY KEY ("Candidate_ID"), FOREIGN KEY("People_ID") REFERENCES people ("People_ID") ) /* 2 rows from candidate table: Candidate_ID People_ID Poll_Source Date Support_rate Consider_rate Oppose_rate Unsure_rate 1 1 WNBC/Marist Poll Feb 12–15, 2007 0.25 0.3 0.43 0.2 2 3 WNBC/Marist Poll Feb 12–15, 2007 0.17 0.42 0.32 0.9 */ CREATE TABLE people ( "People_ID" INTEGER, "Sex" TEXT, "Name" TEXT, "Date_of_Birth" TEXT, "Height" REAL, "Weight" REAL, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Sex Name Date_of_Birth Height Weight 1 M Hubert Henno 06.10.1976 188.0 83.0 2 M Dominique Daquin 10.11.1972 197.0 85.0 */
what are the names of people who did not participate in the candidate election.
SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate)
[{'Name': 'Dominique Daquin'}, {'Name': 'Frantz Granvorka'}, {'Name': 'Philippe Barça-Cysique'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many contestants did not get voted?[/QUESTION] [SQL]SELECT count(*) FROM contestants WHERE contestant_number NOT IN ( SELECT contestant_number FROM votes )[/SQL]
[QUESTION]How many contestants did not get voted?[/QUESTION] [SQL]SELECT count(*) FROM contestants WHERE contestant_number NOT IN ( SELECT contestant_number FROM votes )[/SQL]
[QUESTION]How many contestants did not get voted?[/QUESTION] [SQL]SELECT count(*) FROM contestants WHERE contestant_number NOT IN ( SELECT contestant_number FROM votes )[/SQL]
party_host
CREATE TABLE host ( "Host_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, PRIMARY KEY ("Host_ID") ) CREATE TABLE party ( "Party_ID" INTEGER, "Party_Theme" TEXT, "Location" TEXT, "First_year" TEXT, "Last_year" TEXT, "Number_of_hosts" INTEGER, PRIMARY KEY ("Party_ID") ) CREATE TABLE party_host ( "Party_ID" INTEGER, "Host_ID" INTEGER, "Is_Main_in_Charge" BOOLEAN, PRIMARY KEY ("Party_ID", "Host_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID"), FOREIGN KEY("Host_ID") REFERENCES host ("Host_ID") )
CREATE TABLE host ( "Host_ID" INTEGER, "Name" TEXT, "Nationality" TEXT, "Age" TEXT, PRIMARY KEY ("Host_ID") ) /* 2 rows from host table: Host_ID Name Nationality Age 1 Austin Daye United States 43 2 Lloyd Daniels United States 37 */ CREATE TABLE party ( "Party_ID" INTEGER, "Party_Theme" TEXT, "Location" TEXT, "First_year" TEXT, "Last_year" TEXT, "Number_of_hosts" INTEGER, PRIMARY KEY ("Party_ID") ) /* 2 rows from party table: Party_ID Party_Theme Location First_year Last_year Number_of_hosts 1 Spring Hemkade 48 Zaandam 2000 2001 5 2 Club Q-BASE Hemkade 48 Zaandam 2002 2002 23 */ CREATE TABLE party_host ( "Party_ID" INTEGER, "Host_ID" INTEGER, "Is_Main_in_Charge" BOOLEAN, PRIMARY KEY ("Party_ID", "Host_ID"), FOREIGN KEY("Party_ID") REFERENCES party ("Party_ID"), FOREIGN KEY("Host_ID") REFERENCES host ("Host_ID") ) /* 2 rows from party_host table: Party_ID Host_ID Is_Main_in_Charge 1 1 True 8 7 True */
Give me the theme and location of each party.
SELECT Party_Theme , LOCATION FROM party
[{'Party_Theme': 'Spring', 'Location': 'Hemkade 48 Zaandam'}, {'Party_Theme': 'Club Q-BASE', 'Location': 'Hemkade 48 Zaandam'}, {'Party_Theme': 'Hardcore Resurrection', 'Location': 'Various locations'}, {'Party_Theme': 'Teqnology', 'Location': 'Heineken Music Hall Amsterdam'}, {'Party_Theme': 'Qlubtempo', 'Location': 'Hemkade 48 Zaandam, Heineken Music Hall Amsterdam'}, {'Party_Theme': 'QrimeTime', 'Location': 'Heineken Music Hall Amsterdam'}, {'Party_Theme': 'In Qontrol', 'Location': 'RAI Amsterdam'}, {'Party_Theme': 'Houseqlassics', 'Location': 'Various locations'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
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 */
Give all information regarding instructors, in order of salary from least to greatest.
SELECT * FROM instructor ORDER BY salary
[{'ID': '14365', 'name': 'Lembr', 'dept_name': 'Accounting', 'salary': 32241.56}, {'ID': '50885', 'name': 'Konstantinides', 'dept_name': 'Languages', 'salary': 32570.5}, {'ID': '42782', 'name': 'Vicentino', 'dept_name': 'Elec. Eng.', 'salary': 34272.67}, {'ID': '28097', 'name': 'Kean', 'dept_name': 'English', 'salary': 35023.18}, {'ID': '36897', 'name': 'Morris', 'dept_name': 'Marketing', 'salary': 43770.36}, {'ID': '57180', 'name': 'Hau', 'dept_name': 'Accounting', 'salary': 43966.29}, {'ID': '64871', 'name': 'Gutierrez', 'dept_name': 'Statistics', 'salary': 45310.53}, {'ID': '80759', 'name': 'Queiroz', 'dept_name': 'Biology', 'salary': 45538.32}, {'ID': '72553', 'name': 'Yin', 'dept_name': 'English', 'salary': 46397.59}, {'ID': '79081', 'name': 'Ullman ', 'dept_name': 'Accounting', 'salary': 47307.1}, {'ID': '59795', 'name': 'Desyl', 'dept_name': 'Languages', 'salary': 48803.38}, {'ID': '41930', 'name': 'Tung', 'dept_name': 'Athletics', 'salary': 50482.03}, {'ID': '97302', 'name': 'Bertolino', 'dept_name': 'Mech. Eng.', 'salary': 51647.57}, {'ID': '95030', 'name': 'Arinb', 'dept_name': 'Statistics', 'salary': 54805.11}, {'ID': '90643', 'name': 'Choll', 'dept_name': 'Statistics', 'salary': 57807.09}, {'ID': '78699', 'name': 'Pingr', 'dept_name': 'Statistics', 'salary': 59303.62}, {'ID': '22591', 'name': 'DAgostino', 'dept_name': 'Psychology', 'salary': 59706.49}, {'ID': '4034', 'name': 'Murata', 'dept_name': 'Athletics', 'salary': 61387.56}, {'ID': '35579', 'name': 'Soisalon-Soininen', 'dept_name': 'Psychology', 'salary': 62579.61}, {'ID': '58558', 'name': 'Dusserre', 'dept_name': 'Marketing', 'salary': 66143.25}, {'ID': '31955', 'name': 'Moreira', 'dept_name': 'Accounting', 'salary': 71351.42}, {'ID': '15347', 'name': 'Bawa', 'dept_name': 'Athletics', 'salary': 72140.88}, {'ID': '81991', 'name': 'Valtchev', 'dept_name': 'Biology', 'salary': 77036.18}, {'ID': '43779', 'name': 'Romero', 'dept_name': 'Astronomy', 'salary': 79070.08}, {'ID': '65931', 'name': 'Pimenta', 'dept_name': 'Cybernetics', 'salary': 79866.95}, {'ID': '3335', 'name': 'Bourrier', 'dept_name': 'Comp. Sci.', 'salary': 80797.83}, {'ID': '3199', 'name': 'Gustafsson', 'dept_name': 'Elec. Eng.', 'salary': 82534.37}, {'ID': '28400', 'name': 'Atanassov', 'dept_name': 'Statistics', 'salary': 84982.92}, {'ID': '48570', 'name': 'Sarkar', 'dept_name': 'Pol. Sci.', 'salary': 87549.8}, {'ID': '52647', 'name': 'Bancilhon', 'dept_name': 'Pol. Sci.', 'salary': 87958.01}, {'ID': '4233', 'name': 'Luo', 'dept_name': 'English', 'salary': 88791.45}, {'ID': '79653', 'name': 'Levine', 'dept_name': 'Elec. Eng.', 'salary': 89805.83}, {'ID': '73623', 'name': 'Sullivan', 'dept_name': 'Elec. Eng.', 'salary': 90038.09}, {'ID': '25946', 'name': 'Liley', 'dept_name': 'Languages', 'salary': 90891.69}, {'ID': '99052', 'name': 'Dale', 'dept_name': 'Cybernetics', 'salary': 93348.83}, {'ID': '63395', 'name': 'McKinnon', 'dept_name': 'Cybernetics', 'salary': 94333.99}, {'ID': '16807', 'name': 'Yazdi', 'dept_name': 'Athletics', 'salary': 98333.65}, {'ID': '77346', 'name': 'Mahmoud', 'dept_name': 'Geology', 'salary': 99382.59}, {'ID': '63287', 'name': 'Jaekel', 'dept_name': 'Athletics', 'salary': 103146.87}, {'ID': '37687', 'name': 'Arias', 'dept_name': 'Statistics', 'salary': 104563.38}, {'ID': '6569', 'name': 'Mingoz', 'dept_name': 'Finance', 'salary': 105311.38}, {'ID': '74426', 'name': 'Kenje', 'dept_name': 'Marketing', 'salary': 106554.73}, {'ID': '48507', 'name': 'Lent', 'dept_name': 'Mech. Eng.', 'salary': 107978.47}, {'ID': '50330', 'name': 'Shuming', 'dept_name': 'Physics', 'salary': 108011.81}, {'ID': '34175', 'name': 'Bondi', 'dept_name': 'Comp. Sci.', 'salary': 115469.11}, {'ID': '90376', 'name': 'Bietzk', 'dept_name': 'Cybernetics', 'salary': 117836.5}, {'ID': '95709', 'name': 'Sakurai', 'dept_name': 'English', 'salary': 118143.98}, {'ID': '96895', 'name': 'Mird', 'dept_name': 'Marketing', 'salary': 119921.41}, {'ID': '74420', 'name': 'Voronina', 'dept_name': 'Physics', 'salary': 121141.99}, {'ID': '19368', 'name': 'Wieland', 'dept_name': 'Pol. Sci.', 'salary': 124651.41}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?[/QUESTION] [SQL]SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name 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 JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code[/SQL]
[QUESTION]What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?[/QUESTION] [SQL]SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name 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 JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code[/SQL]
[QUESTION]What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?[/QUESTION] [SQL]SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name 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 JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code[/SQL]
[QUESTION]What are the first names, office locations, and departments of all instructors, and also what are the descriptions of the courses they teach?[/QUESTION] [SQL]SELECT T2.emp_fname , T4.prof_office , T3.crs_description , T5.dept_name 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 JOIN professor AS T4 ON T2.emp_num = T4.emp_num JOIN department AS T5 ON T4.dept_code = T5.dept_code[/SQL]
flight_2
CREATE TABLE airlines ( uid INTEGER, "Airline" TEXT, "Abbreviation" TEXT, "Country" TEXT, PRIMARY KEY (uid) ) CREATE TABLE airports ( "City" TEXT, "AirportCode" TEXT, "AirportName" TEXT, "Country" TEXT, "CountryAbbrev" TEXT, PRIMARY KEY ("AirportCode") ) CREATE TABLE flights ( "Airline" INTEGER, "FlightNo" INTEGER, "SourceAirport" TEXT, "DestAirport" TEXT, PRIMARY KEY ("Airline", "FlightNo"), FOREIGN KEY("SourceAirport") REFERENCES airports ("AirportCode"), FOREIGN KEY("DestAirport") REFERENCES airports ("AirportCode") )
CREATE TABLE airlines ( uid INTEGER, "Airline" TEXT, "Abbreviation" TEXT, "Country" TEXT, PRIMARY KEY (uid) ) /* 2 rows from airlines table: uid Airline Abbreviation Country 1 United Airlines UAL USA 2 US Airways USAir USA */ CREATE TABLE airports ( "City" TEXT, "AirportCode" TEXT, "AirportName" TEXT, "Country" TEXT, "CountryAbbrev" TEXT, PRIMARY KEY ("AirportCode") ) /* 2 rows from airports table: City AirportCode AirportName Country CountryAbbrev Aberdeen APG Phillips AAF United States US Aberdeen ABR Municipal United States US */ CREATE TABLE flights ( "Airline" INTEGER, "FlightNo" INTEGER, "SourceAirport" TEXT, "DestAirport" TEXT, PRIMARY KEY ("Airline", "FlightNo"), FOREIGN KEY("SourceAirport") REFERENCES airports ("AirportCode"), FOREIGN KEY("DestAirport") REFERENCES airports ("AirportCode") ) /* 2 rows from flights table: Airline FlightNo SourceAirport DestAirport 1 28 APG ASY 1 29 ASY APG */
Return the number of United Airlines flights leaving from AHD Airport.
SELECT count(*) FROM AIRLINES AS T1 JOIN FLIGHTS AS T2 ON T2.Airline = T1.uid WHERE T1.Airline = "United Airlines" AND T2.SourceAirport = "AHD"
[{'count(*)': 0}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]Which flight numbers correspond to United Airlines flights?[/QUESTION] [SQL]SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = "United Airlines"[/SQL]
[QUESTION]Which flight numbers correspond to United Airlines flights?[/QUESTION] [SQL]SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = "United Airlines"[/SQL]
[QUESTION]Which flight numbers correspond to United Airlines flights?[/QUESTION] [SQL]SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = "United Airlines"[/SQL]
[QUESTION]Which flight numbers correspond to United Airlines flights?[/QUESTION] [SQL]SELECT T1.FlightNo FROM FLIGHTS AS T1 JOIN AIRLINES AS T2 ON T2.uid = T1.Airline WHERE T2.Airline = "United Airlines"[/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 */
When did Luke S Zettlemoyer publish ?
SELECT DISTINCT t3.year FROM writes AS t2 JOIN author AS t1 ON t2.authorid = t1.authorid JOIN paper AS t3 ON t2.paperid = t3.paperid WHERE t1.authorname = "Luke S Zettlemoyer" ORDER BY t3.year;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
true
false
false
false
false
true
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 */
new deep learning papers
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
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 */
List all budget type codes and descriptions.
SELECT budget_type_code , budget_type_description FROM Ref_budget_codes
[{'Budget_Type_Code': 'GV', 'Budget_Type_Description': 'Government'}, {'Budget_Type_Code': 'ORG', 'Budget_Type_Description': 'Organisation'}, {'Budget_Type_Code': 'SF', 'Budget_Type_Description': 'Self founded'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the type codes and descriptions for all template types?[/QUESTION] [SQL]SELECT template_type_code , template_type_description FROM Ref_template_types[/SQL]
[QUESTION]What are the type codes and descriptions for all template types?[/QUESTION] [SQL]SELECT template_type_code , template_type_description FROM Ref_template_types[/SQL]
[QUESTION]What are the type codes and descriptions for all template types?[/QUESTION] [SQL]SELECT template_type_code , template_type_description FROM Ref_template_types[/SQL]
debate
CREATE TABLE debate ( "Debate_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Num_of_Audience" INTEGER, PRIMARY KEY ("Debate_ID") ) CREATE TABLE debate_people ( "Debate_ID" INTEGER, "Affirmative" INTEGER, "Negative" INTEGER, "If_Affirmative_Win" BOOLEAN, PRIMARY KEY ("Debate_ID", "Affirmative", "Negative"), FOREIGN KEY("Negative") REFERENCES people ("People_ID"), FOREIGN KEY("Affirmative") REFERENCES people ("People_ID"), FOREIGN KEY("Debate_ID") REFERENCES debate ("Debate_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "District" TEXT, "Name" TEXT, "Party" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") )
CREATE TABLE debate ( "Debate_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Num_of_Audience" INTEGER, PRIMARY KEY ("Debate_ID") ) /* 2 rows from debate table: Debate_ID Date Venue Num_of_Audience 1 October 21, 2011 Manama , Bahrain 342 2 December 17, 2014 Doha , Qatar 134 */ CREATE TABLE debate_people ( "Debate_ID" INTEGER, "Affirmative" INTEGER, "Negative" INTEGER, "If_Affirmative_Win" BOOLEAN, PRIMARY KEY ("Debate_ID", "Affirmative", "Negative"), FOREIGN KEY("Negative") REFERENCES people ("People_ID"), FOREIGN KEY("Affirmative") REFERENCES people ("People_ID"), FOREIGN KEY("Debate_ID") REFERENCES debate ("Debate_ID") ) /* 2 rows from debate_people table: Debate_ID Affirmative Negative If_Affirmative_Win 1 1 10 True 5 2 8 True */ CREATE TABLE people ( "People_ID" INTEGER, "District" TEXT, "Name" TEXT, "Party" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID District Name Party Age 1 New York 1 Luther C. Carter Republican 35 2 New York 2 James Humphrey Republican 38 */
List the dates of debates with number of audience bigger than 150
SELECT Date FROM debate WHERE Num_of_Audience > 150
[{'Date': 'October 21, 2011'}, {'Date': 'October 27, 2015'}, {'Date': 'January 12, 2017'}, {'Date': 'January 21, 2017'}]
Easy
false
false
false
false
false
false
false
false
false
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 */
When did the staff member Janessa Sawayn leave the company?
SELECT date_left_staff FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn";
[{'date_left_staff': '2018-03-23 22:53:12'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
workshop_paper
CREATE TABLE "Acceptance" ( "Submission_ID" INTEGER, "Workshop_ID" INTEGER, "Result" TEXT, PRIMARY KEY ("Submission_ID", "Workshop_ID"), FOREIGN KEY("Workshop_ID") REFERENCES workshop ("Workshop_ID"), FOREIGN KEY("Submission_ID") REFERENCES submission ("Submission_ID") ) CREATE TABLE submission ( "Submission_ID" INTEGER, "Scores" REAL, "Author" TEXT, "College" TEXT, PRIMARY KEY ("Submission_ID") ) CREATE TABLE workshop ( "Workshop_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, PRIMARY KEY ("Workshop_ID") )
CREATE TABLE "Acceptance" ( "Submission_ID" INTEGER, "Workshop_ID" INTEGER, "Result" TEXT, PRIMARY KEY ("Submission_ID", "Workshop_ID"), FOREIGN KEY("Workshop_ID") REFERENCES workshop ("Workshop_ID"), FOREIGN KEY("Submission_ID") REFERENCES submission ("Submission_ID") ) /* 2 rows from Acceptance table: Submission_ID Workshop_ID Result 2 5 Accepted 2 3 Rejected */ CREATE TABLE submission ( "Submission_ID" INTEGER, "Scores" REAL, "Author" TEXT, "College" TEXT, PRIMARY KEY ("Submission_ID") ) /* 2 rows from submission table: Submission_ID Scores Author College 1 72.0 Steve Niehaus Notre Dame 2 79.0 Sammy Green Florida */ CREATE TABLE workshop ( "Workshop_ID" INTEGER, "Date" TEXT, "Venue" TEXT, "Name" TEXT, PRIMARY KEY ("Workshop_ID") ) /* 2 rows from workshop table: Workshop_ID Date Venue Name 1 August 18, 2007 London UK ABC 2007 2 August 21, 2007 London UK Conference 2007 */
Which submission received the highest score in acceptance result. Show me the result.
SELECT T1.Result FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY T2.Scores DESC LIMIT 1
[{'Result': 'Rejected'}]
Medium
false
false
false
true
true
false
false
true
false
false
false
false
false
[QUESTION]Which employee received the most awards in evaluations? Give me the employee name.[/QUESTION] [SQL]SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY count(*) DESC LIMIT 1[/SQL]
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 */
Who is the youngest male?
SELECT name FROM Person WHERE gender = 'male' AND age = (SELECT min(age) FROM person WHERE gender = 'male' )
[{'name': 'Bob'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Where is the youngest teacher from?[/QUESTION] [SQL]SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1[/SQL]
[QUESTION]Where is the youngest teacher from?[/QUESTION] [SQL]SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1[/SQL]
[QUESTION]Where is the youngest teacher from?[/QUESTION] [SQL]SELECT Hometown FROM teacher ORDER BY Age ASC LIMIT 1[/SQL]
[QUESTION]Where is the youngest teacher from?[/QUESTION] [SQL]SELECT Hometown FROM teacher ORDER BY Age 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 the number of customers that did not have any payment history.
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payments );
[{'count(*)': 4}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]Find the name of customers who do not have a loan with a type of Mortgages.[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages'[/SQL]
[QUESTION]Find the name of customers who do not have a loan with a type of Mortgages.[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages'[/SQL]
[QUESTION]Find the name of customers who do not have a loan with a type of Mortgages.[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages'[/SQL]
[QUESTION]Find the name of customers who do not have a loan with a type of Mortgages.[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id WHERE T2.loan_type = 'Mortgages'[/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 */
For each course id, how many students are registered and what are the course names?
SELECT T3.course_name , count(*) FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id JOIN courses AS T3 ON T2.course_id = T3.course_id GROUP BY T2.course_id
[{'course_name': 'statistics', 'count(*)': 4}, {'course_name': 'English', 'count(*)': 2}, {'course_name': 'French', 'count(*)': 2}, {'course_name': 'data structure', 'count(*)': 1}]
Hard
false
false
false
false
false
true
false
false
true
false
false
false
false
[QUESTION]For each semester, what is the name and id of the one with the most students registered?[/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]For each semester, what is the name and id of the one with the most students registered?[/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]For each semester, what is the name and id of the one with the most students registered?[/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]For each semester, what is the name and id of the one with the most students registered?[/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]
cre_Drama_Workshop_Groups
CREATE TABLE "Addresses" ( "Address_ID" VARCHAR(100) NOT NULL, "Line_1" VARCHAR(255), "Line_2" VARCHAR(255), "City_Town" VARCHAR(255), "State_County" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Address_ID"), UNIQUE ("Address_ID") ) CREATE TABLE "Bookings" ( "Booking_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Workshop_Group_ID" VARCHAR(100) NOT NULL, "Status_Code" CHAR(15) NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Booking_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Clients" ("Client_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), UNIQUE ("Booking_ID") ) CREATE TABLE "Bookings_Services" ( "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Product_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY("Product_ID") REFERENCES "Services" ("Service_ID") ) CREATE TABLE "Clients" ( "Client_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Email_Address" VARCHAR(255), "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Client_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Client_ID") ) CREATE TABLE "Customer_Orders" ( "Order_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Order_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Store_ID") REFERENCES "Stores" ("Store_ID"), UNIQUE ("Order_ID") ) CREATE TABLE "Customers" ( "Customer_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Customer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Customer_ID") ) CREATE TABLE "Drama_Workshop_Groups" ( "Workshop_Group_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Currency_Code" CHAR(15) NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Workshop_Group_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Workshop_Group_ID") ) CREATE TABLE "Invoice_Items" ( "Invoice_Item_ID" INTEGER NOT NULL, "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Order_Item_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" INTEGER, "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Invoice_Item_ID"), FOREIGN KEY("Order_Item_ID") REFERENCES "Order_Items" ("Order_Item_ID"), FOREIGN KEY("Invoice_ID") REFERENCES "Invoices" ("Invoice_ID"), FOREIGN KEY("Order_ID", "Product_ID") REFERENCES "Bookings_Services" ("Order_ID", "Product_ID") ) CREATE TABLE "Invoices" ( "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, payment_method_code CHAR(15), "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), "Order_Item_ID" INTEGER NOT NULL, PRIMARY KEY ("Invoice_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY(payment_method_code) REFERENCES "Ref_Payment_Methods" (payment_method_code) ) CREATE TABLE "Marketing_Regions" ( "Marketing_Region_Code" CHAR(15) NOT NULL, "Marketing_Region_Name" VARCHAR(255) NOT NULL, "Marketing_Region_Descriptrion" VARCHAR(255) NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Marketing_Region_Code"), UNIQUE ("Marketing_Region_Code") ) CREATE TABLE "Order_Items" ( "Order_Item_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Order_Item_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Product_ID") REFERENCES "Products" ("Product_ID") ) CREATE TABLE "Performers" ( "Performer_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Performer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Performer_ID") ) CREATE TABLE "Performers_in_Bookings" ( "Order_ID" INTEGER NOT NULL, "Performer_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Performer_ID"), FOREIGN KEY("Performer_ID") REFERENCES "Performers" ("Performer_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID") ) CREATE TABLE "Products" ( "Product_ID" VARCHAR(100) NOT NULL, "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Product_Description" VARCHAR(255), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Product_ID"), UNIQUE ("Product_ID") ) CREATE TABLE "Ref_Payment_Methods" ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) CREATE TABLE "Ref_Service_Types" ( "Service_Type_Code" CHAR(15) NOT NULL, "Parent_Service_Type_Code" CHAR(15), "Service_Type_Description" VARCHAR(255), PRIMARY KEY ("Service_Type_Code"), UNIQUE ("Service_Type_Code") ) CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Type_Code" CHAR(15), "Workshop_Group_ID" INTEGER NOT NULL, "Product_Description" VARCHAR(255), "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), FOREIGN KEY("Service_Type_Code") REFERENCES "Ref_Service_Types" ("Service_Type_Code"), UNIQUE ("Service_ID") ) CREATE TABLE "Stores" ( "Store_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Store_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), FOREIGN KEY("Marketing_Region_Code") REFERENCES "Marketing_Regions" ("Marketing_Region_Code"), UNIQUE ("Store_ID") )
CREATE TABLE "Addresses" ( "Address_ID" VARCHAR(100) NOT NULL, "Line_1" VARCHAR(255), "Line_2" VARCHAR(255), "City_Town" VARCHAR(255), "State_County" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Address_ID"), UNIQUE ("Address_ID") ) /* 2 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None */ CREATE TABLE "Bookings" ( "Booking_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Workshop_Group_ID" VARCHAR(100) NOT NULL, "Status_Code" CHAR(15) NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Booking_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Clients" ("Client_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), UNIQUE ("Booking_ID") ) /* 2 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None */ CREATE TABLE "Bookings_Services" ( "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Product_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY("Product_ID") REFERENCES "Services" ("Service_ID") ) /* 2 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 */ CREATE TABLE "Clients" ( "Client_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Email_Address" VARCHAR(255), "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Client_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Client_ID") ) /* 2 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 [email protected] Clifford (042)912-3404x5135 VIP 426 383 [email protected] Bettye (604)849-0214 None */ CREATE TABLE "Customer_Orders" ( "Order_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Store_ID" INTEGER NOT NULL, "Order_Date" DATETIME NOT NULL, "Planned_Delivery_Date" DATETIME NOT NULL, "Actual_Delivery_Date" DATETIME NOT NULL, "Other_Order_Details" VARCHAR(255), PRIMARY KEY ("Order_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID"), FOREIGN KEY("Store_ID") REFERENCES "Stores" ("Store_ID"), UNIQUE ("Order_ID") ) /* 2 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None */ CREATE TABLE "Customers" ( "Customer_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Customer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Customer_ID") ) /* 2 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 [email protected] None 267 98 Federico 914-915-7483 [email protected] None */ CREATE TABLE "Drama_Workshop_Groups" ( "Workshop_Group_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Currency_Code" CHAR(15) NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Workshop_Group_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Workshop_Group_ID") ) /* 2 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 [email protected] None 140 180 EU DE Veda Film 793-966-9311x5303 [email protected] None */ CREATE TABLE "Invoice_Items" ( "Invoice_Item_ID" INTEGER NOT NULL, "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Order_Item_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" INTEGER, "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Invoice_Item_ID"), FOREIGN KEY("Order_Item_ID") REFERENCES "Order_Items" ("Order_Item_ID"), FOREIGN KEY("Invoice_ID") REFERENCES "Invoices" ("Invoice_ID"), FOREIGN KEY("Order_ID", "Product_ID") REFERENCES "Bookings_Services" ("Order_ID", "Product_ID") ) /* 2 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality */ CREATE TABLE "Invoices" ( "Invoice_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, payment_method_code CHAR(15), "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), "Order_Item_ID" INTEGER NOT NULL, PRIMARY KEY ("Invoice_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID"), FOREIGN KEY(payment_method_code) REFERENCES "Ref_Payment_Methods" (payment_method_code) ) /* 2 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 */ CREATE TABLE "Marketing_Regions" ( "Marketing_Region_Code" CHAR(15) NOT NULL, "Marketing_Region_Name" VARCHAR(255) NOT NULL, "Marketing_Region_Descriptrion" VARCHAR(255) NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Marketing_Region_Code"), UNIQUE ("Marketing_Region_Code") ) /* 2 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None */ CREATE TABLE "Order_Items" ( "Order_Item_ID" INTEGER NOT NULL, "Order_ID" INTEGER NOT NULL, "Product_ID" INTEGER NOT NULL, "Order_Quantity" VARCHAR(288), "Other_Item_Details" VARCHAR(255), PRIMARY KEY ("Order_Item_ID"), FOREIGN KEY("Order_ID") REFERENCES "Customer_Orders" ("Order_ID"), FOREIGN KEY("Product_ID") REFERENCES "Products" ("Product_ID") ) /* 2 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None */ CREATE TABLE "Performers" ( "Performer_ID" INTEGER NOT NULL, "Address_ID" INTEGER NOT NULL, "Customer_Name" VARCHAR(255), "Customer_Phone" VARCHAR(255), "Customer_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Performer_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), UNIQUE ("Performer_ID") ) /* 2 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 [email protected] None 211 124 Ashley 893-536-8857 [email protected] None */ CREATE TABLE "Performers_in_Bookings" ( "Order_ID" INTEGER NOT NULL, "Performer_ID" INTEGER NOT NULL, PRIMARY KEY ("Order_ID", "Performer_ID"), FOREIGN KEY("Performer_ID") REFERENCES "Performers" ("Performer_ID"), FOREIGN KEY("Order_ID") REFERENCES "Bookings" ("Booking_ID") ) /* 2 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 */ CREATE TABLE "Products" ( "Product_ID" VARCHAR(100) NOT NULL, "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Product_Description" VARCHAR(255), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Product_ID"), UNIQUE ("Product_ID") ) /* 2 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536.0000 None None 154 film 2302.0000 None None */ CREATE TABLE "Ref_Payment_Methods" ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) /* 2 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit */ CREATE TABLE "Ref_Service_Types" ( "Service_Type_Code" CHAR(15) NOT NULL, "Parent_Service_Type_Code" CHAR(15), "Service_Type_Description" VARCHAR(255), PRIMARY KEY ("Service_Type_Code"), UNIQUE ("Service_Type_Code") ) /* 2 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service */ CREATE TABLE "Services" ( "Service_ID" INTEGER NOT NULL, "Service_Type_Code" CHAR(15), "Workshop_Group_ID" INTEGER NOT NULL, "Product_Description" VARCHAR(255), "Product_Name" VARCHAR(255), "Product_Price" DECIMAL(20, 4), "Other_Product_Service_Details" VARCHAR(255), PRIMARY KEY ("Service_ID"), FOREIGN KEY("Workshop_Group_ID") REFERENCES "Drama_Workshop_Groups" ("Workshop_Group_ID"), FOREIGN KEY("Service_Type_Code") REFERENCES "Ref_Service_Types" ("Service_Type_Code"), UNIQUE ("Service_ID") ) /* 2 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 58932775.8822 None 219 2 838 None film 2704.4719 None */ CREATE TABLE "Stores" ( "Store_ID" VARCHAR(100) NOT NULL, "Address_ID" INTEGER NOT NULL, "Marketing_Region_Code" CHAR(15) NOT NULL, "Store_Name" VARCHAR(255), "Store_Phone" VARCHAR(255), "Store_Email_Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Store_ID"), FOREIGN KEY("Address_ID") REFERENCES "Addresses" ("Address_ID"), FOREIGN KEY("Marketing_Region_Code") REFERENCES "Marketing_Regions" ("Marketing_Region_Code"), UNIQUE ("Store_ID") ) /* 2 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 [email protected] None 229 266 CA Rob Dinning 1-327-185-9368 [email protected] 5 stars */
Show all payment method codes and the number of orders for each code.
SELECT payment_method_code , count(*) FROM INVOICES GROUP BY payment_method_code
[{'payment_method_code': 'American E', 'count(*)': 4}, {'payment_method_code': 'MasterCard', 'count(*)': 6}, {'payment_method_code': 'Visa', 'count(*)': 5}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]Show all template type codes and number of templates for each.[/QUESTION] [SQL]SELECT template_type_code , count(*) FROM Templates GROUP BY template_type_code[/SQL]
[QUESTION]Show all template type codes and number of templates for each.[/QUESTION] [SQL]SELECT template_type_code , count(*) FROM Templates GROUP BY template_type_code[/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 on VLDB conference after 2000 .
SELECT t2.title FROM publication AS t2 JOIN conference AS t1 ON t2.cid = t1.cid WHERE t1.name = "VLDB" AND t2.year > 2000;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]return me the authors who have more than 10 papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name HAVING COUNT ( DISTINCT t4.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name HAVING COUNT ( DISTINCT t4.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name HAVING COUNT ( DISTINCT t4.title ) > 10;[/SQL]
[QUESTION]return me the authors who have more than 10 papers in the VLDB conference .[/QUESTION] [SQL]SELECT t1.name FROM publication AS t4 JOIN conference AS t2 ON t4.cid = t2.cid JOIN writes AS t3 ON t3.pid = t4.pid JOIN author AS t1 ON t3.aid = t1.aid WHERE t2.name = "VLDB" GROUP BY t1.name HAVING COUNT ( DISTINCT t4.title ) > 10;[/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 */
Give me the name of each club.
SELECT clubname FROM club
[{'ClubName': 'Bootup Baltimore'}, {'ClubName': 'Hopkins Student Enterprises'}, {'ClubName': 'Pen and Paper Gaming'}, {'ClubName': 'Tennis Club'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
wedding
CREATE TABLE church ( "Church_ID" INTEGER, "Name" TEXT, "Organized_by" TEXT, "Open_Date" INTEGER, "Continuation_of" TEXT, PRIMARY KEY ("Church_ID") ) CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Is_Male" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") ) CREATE TABLE wedding ( "Church_ID" INTEGER, "Male_ID" INTEGER, "Female_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Church_ID", "Male_ID", "Female_ID"), FOREIGN KEY("Female_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Male_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Church_ID") REFERENCES church ("Church_ID") )
CREATE TABLE church ( "Church_ID" INTEGER, "Name" TEXT, "Organized_by" TEXT, "Open_Date" INTEGER, "Continuation_of" TEXT, PRIMARY KEY ("Church_ID") ) /* 2 rows from church table: Church_ID Name Organized_by Open_Date Continuation_of 1 Pure Church of Christ Wycam Clark 1831 Church of Christ 2 Independent Church – Hoton 1832 Church of Christ */ CREATE TABLE people ( "People_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Is_Male" TEXT, "Age" INTEGER, PRIMARY KEY ("People_ID") ) /* 2 rows from people table: People_ID Name Country Is_Male Age 1 Mike Weir Canada T 34 2 Juli Hanson Sweden F 32 */ CREATE TABLE wedding ( "Church_ID" INTEGER, "Male_ID" INTEGER, "Female_ID" INTEGER, "Year" INTEGER, PRIMARY KEY ("Church_ID", "Male_ID", "Female_ID"), FOREIGN KEY("Female_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Male_ID") REFERENCES people ("People_ID"), FOREIGN KEY("Church_ID") REFERENCES church ("Church_ID") ) /* 2 rows from wedding table: Church_ID Male_ID Female_ID Year 1 1 2 2014 3 3 4 2015 */
Show all countries and the number of people from each country.
SELECT country , count(*) FROM people GROUP BY country
[{'Country': 'Australia', 'count(*)': 1}, {'Country': 'Canada', 'count(*)': 1}, {'Country': 'Northern Ireland', 'count(*)': 1}, {'Country': 'Sweden', 'count(*)': 1}, {'Country': 'United States', 'count(*)': 8}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]Count the number of countries in Asia.[/QUESTION] [SQL]SELECT count(*) FROM country WHERE continent = "Asia"[/SQL]
[QUESTION]Count the number of countries in Asia.[/QUESTION] [SQL]SELECT count(*) FROM country WHERE continent = "Asia"[/SQL]
[QUESTION]Count the number of countries in Asia.[/QUESTION] [SQL]SELECT count(*) FROM country WHERE continent = "Asia"[/SQL]
[QUESTION]Count the number of countries in Asia.[/QUESTION] [SQL]SELECT count(*) FROM country WHERE continent = "Asia"[/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 the first name middle name and last name of all staff.
SELECT first_name , middle_name , last_name FROM Staff;
[{'first_name': 'Janessa', 'middle_name': 'Amara', 'last_name': 'Sawayn'}, {'first_name': 'Camylle', 'middle_name': 'Icie', 'last_name': 'Weissnat'}, {'first_name': 'Kaitlin', 'middle_name': 'Stephania', 'last_name': 'Mertz'}, {'first_name': 'Rebekah', 'middle_name': 'Sherwood', 'last_name': 'Hermann'}, {'first_name': 'Jedidiah', 'middle_name': 'Dejon', 'last_name': 'Herzog'}, {'first_name': 'Eulalia', 'middle_name': 'Tre', 'last_name': 'Maggio'}, {'first_name': 'Queenie', 'middle_name': 'Madelyn', 'last_name': 'Macejkovic'}, {'first_name': 'Titus', 'middle_name': 'Duane', 'last_name': 'Durgan'}, {'first_name': 'Margie', 'middle_name': 'Caesar', 'last_name': 'Doyle'}, {'first_name': 'Jaleel', 'middle_name': 'Maiya', 'last_name': 'Rogahn'}, {'first_name': 'Winnifred', 'middle_name': 'Liam', 'last_name': 'Jast'}, {'first_name': 'Lincoln', 'middle_name': 'Benny', 'last_name': 'Carroll'}, {'first_name': 'Ernestina', 'middle_name': 'Clarabelle', 'last_name': 'Mraz'}, {'first_name': 'Ludie', 'middle_name': 'Ulices', 'last_name': 'Kuphal'}, {'first_name': 'Simeon', 'middle_name': 'Mayra', 'last_name': 'Turner'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the first names of all employees that are professors ordered by date of birth?[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]What are the first names of all employees that are professors ordered by date of birth?[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]What are the first names of all employees that are professors ordered by date of birth?[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/SQL]
[QUESTION]What are the first names of all employees that are professors ordered by date of birth?[/QUESTION] [SQL]SELECT emp_fname FROM employee WHERE emp_jobcode = 'PROF' ORDER BY emp_dob[/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 name of the source user with the highest average trust score.
SELECT T1.name FROM useracct AS T1 JOIN trust AS T2 ON T1.u_id = T2.source_u_id GROUP BY T2.source_u_id ORDER BY avg(trust) DESC LIMIT 1
[{'name': 'Terry'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]find the name of employee who was awarded the most times in the evaluation.[/QUESTION] [SQL]SELECT t1.name FROM employee AS t1 JOIN evaluation AS t2 ON t1.Employee_ID = t2.Employee_ID GROUP BY t2.Employee_ID ORDER BY count(*) DESC LIMIT 1[/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 */
What are the staff roles of the staff who
SELECT role_code FROM Project_Staff WHERE date_from > '2003-04-19 15:06:20' AND date_to < '2016-03-15 00:33:18'
[{'role_code': 'leader'}, {'role_code': 'researcher'}]
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 of the person who has no student friends.
SELECT name FROM person EXCEPT SELECT T2.name FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.job = 'student'
[{'name': 'Alice'}, {'name': 'Bob'}, {'name': 'Dan'}]
Hard
false
false
false
false
false
false
false
true
false
false
false
true
false
[QUESTION]What are the names of students who have no friends?[/QUESTION] [SQL]SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id[/SQL]
[QUESTION]What are the names of students who have no friends?[/QUESTION] [SQL]SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id[/SQL]
[QUESTION]What are the names of students who have no friends?[/QUESTION] [SQL]SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id[/SQL]
[QUESTION]What are the names of students who have no friends?[/QUESTION] [SQL]SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id[/SQL]
yelp
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) )
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) /* 2 rows from business table: bid business_id name full_address city latitude longitude review_count is_open rating state */ CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from category table: id business_id category_name */ CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from checkin table: cid business_id count day */ CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from neighbourhood table: id business_id neighbourhood_name */ CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from review table: rid business_id user_id rating text year month */ CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from tip table: tip_id business_id text user_id likes year month */ CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) ) /* 2 rows from user table: uid user_id name */
How many users have reviewed Irish Pub in Dallas ?
SELECT COUNT ( DISTINCT t4.name ) FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id JOIN USER AS t4 ON t4.user_id = t3.user_id WHERE t1.city = "Dallas" AND t2.category_name = "Irish Pub";
[{'COUNT ( DISTINCT t4.name )': 0}]
Hard
true
false
false
false
false
false
false
false
true
false
false
false
false
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 name of instructors who didn't teach any courses?
SELECT name FROM instructor WHERE id NOT IN (SELECT id FROM teaches)
[{'name': 'McKinnon'}, {'name': 'Pingr'}, {'name': 'Mird'}, {'name': 'Murata'}, {'name': 'Konstantinides'}, {'name': 'Levine'}, {'name': 'Bertolino'}, {'name': 'Hau'}, {'name': 'Soisalon-Soininen'}, {'name': 'Moreira'}, {'name': 'Arias'}, {'name': 'Yazdi'}, {'name': 'Arinb'}, {'name': 'Kenje'}, {'name': 'Dusserre'}, {'name': 'Desyl'}, {'name': 'Bancilhon'}, {'name': 'Yin'}, {'name': 'Gutierrez'}]
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]
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 */
List all the types of forms.
SELECT DISTINCT form_type_code FROM forms
[{'form_type_code': 'Basic'}, {'form_type_code': 'Complex'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the type codes and descriptions for all template types?[/QUESTION] [SQL]SELECT template_type_code , template_type_description FROM Ref_template_types[/SQL]
car_1
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") )
CREATE TABLE car_makers ( "Id" INTEGER, "Maker" TEXT, "FullName" TEXT, "Country" TEXT, PRIMARY KEY ("Id"), FOREIGN KEY("Country") REFERENCES countries ("CountryId") ) /* 2 rows from car_makers table: Id Maker FullName Country 1 amc American Motor Company 1 2 volkswagen Volkswagen 2 */ CREATE TABLE car_names ( "MakeId" INTEGER, "Model" TEXT, "Make" TEXT, PRIMARY KEY ("MakeId"), FOREIGN KEY("Model") REFERENCES model_list ("Model") ) /* 2 rows from car_names table: MakeId Model Make 1 chevrolet chevrolet chevelle malibu 2 buick buick skylark 320 */ CREATE TABLE cars_data ( "Id" INTEGER, "MPG" TEXT, "Cylinders" INTEGER, "Edispl" REAL, "Horsepower" TEXT, "Weight" INTEGER, "Accelerate" REAL, "Year" INTEGER, PRIMARY KEY ("Id"), FOREIGN KEY("Id") REFERENCES car_names ("MakeId") ) /* 2 rows from cars_data table: Id MPG Cylinders Edispl Horsepower Weight Accelerate Year 1 18 8 307.0 130 3504 12.0 1970 2 15 8 350.0 165 3693 11.5 1970 */ CREATE TABLE continents ( "ContId" INTEGER, "Continent" TEXT, PRIMARY KEY ("ContId") ) /* 2 rows from continents table: ContId Continent 1 america 2 europe */ CREATE TABLE countries ( "CountryId" INTEGER, "CountryName" TEXT, "Continent" INTEGER, PRIMARY KEY ("CountryId"), FOREIGN KEY("Continent") REFERENCES continents ("ContId") ) /* 2 rows from countries table: CountryId CountryName Continent 1 usa 1 2 germany 2 */ CREATE TABLE model_list ( "ModelId" INTEGER, "Maker" INTEGER, "Model" TEXT, PRIMARY KEY ("ModelId"), FOREIGN KEY("Maker") REFERENCES car_makers ("Id"), UNIQUE ("Model") ) /* 2 rows from model_list table: ModelId Maker Model 1 1 amc 2 2 audi */
How many continents are there?
SELECT count(*) FROM CONTINENTS;
[{'count(*)': 5}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What is the number of distinct continents where Chinese is spoken?[/QUESTION] [SQL]SELECT COUNT( DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "Chinese"[/SQL]
[QUESTION]What is the number of distinct continents where Chinese is spoken?[/QUESTION] [SQL]SELECT COUNT( DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "Chinese"[/SQL]
[QUESTION]What is the number of distinct continents where Chinese is spoken?[/QUESTION] [SQL]SELECT COUNT( DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "Chinese"[/SQL]
[QUESTION]What is the number of distinct continents where Chinese is spoken?[/QUESTION] [SQL]SELECT COUNT( DISTINCT Continent) FROM country AS T1 JOIN countrylanguage AS T2 ON T1.Code = T2.CountryCode WHERE T2.Language = "Chinese"[/SQL]
customers_card_transactions
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) /* 2 rows from Accounts table: account_id customer_id account_name other_account_details 1 6 338 Regular 2 14 562 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_last_name customer_address customer_phone customer_email other_customer_details 1 Aniyah Feest 55975 Theodore Estates Lake Brody, VT 57078 (673)872-5338 [email protected] None 2 Susie Wiza 6478 Moen Isle Suite 910 Schimmelmouth, VT 96364-4898 679-845-8645x94312 [email protected] None */ CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) /* 2 rows from Customers_Cards table: card_id customer_id card_type_code card_number date_valid_from date_valid_to other_card_details 1 14 Credit 4560596484842 2011-04-17 09:05:28 2018-03-07 17:06:19 5567915676420343 2 9 Credit 4859448397570735 2012-05-22 02:05:41 2018-02-25 15:43:32 4539333582760 */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) ) /* 2 rows from Financial_Transactions table: transaction_id previous_transaction_id account_id card_id transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 925 15 1 Payment 2018-03-24 06:41:41 1701.23 None None 2 494 3 2 Refund 2018-03-24 12:08:55 1931.76 None None */
What is the card type code with most number of cards?
SELECT card_type_code FROM Customers_cards GROUP BY card_type_code ORDER BY count(*) DESC LIMIT 1
[{'card_type_code': 'Debit'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]What are the number of different course codes?[/QUESTION] [SQL]SELECT count(DISTINCT crs_code) FROM CLASS[/SQL]
[QUESTION]What are the number of different course codes?[/QUESTION] [SQL]SELECT count(DISTINCT crs_code) FROM CLASS[/SQL]
[QUESTION]What are the number of different course codes?[/QUESTION] [SQL]SELECT count(DISTINCT crs_code) FROM CLASS[/SQL]
[QUESTION]What are the number of different course codes?[/QUESTION] [SQL]SELECT count(DISTINCT crs_code) FROM CLASS[/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 name of students who took some course offered by Statistics department.
SELECT T3.name FROM course AS T1 JOIN takes AS T2 ON T1.course_id = T2.course_id JOIN student AS T3 ON T2.id = T3.id WHERE T1.dept_name = 'Statistics'
[{'name': 'Zelty'}, {'name': 'Zelty'}, {'name': 'Colin'}, {'name': 'Rzecz'}, {'name': 'Rzecz'}, {'name': 'Ugarte'}, {'name': 'Kieras'}, {'name': 'Kieras'}, {'name': 'Reed'}, {'name': 'Okaf'}, {'name': 'Terauchi'}, {'name': 'More'}, {'name': 'Marlet'}, {'name': 'Marlet'}, {'name': 'Arnoux'}, {'name': 'Schultz'}, {'name': 'Ng'}, {'name': 'Ng'}, {'name': 'Neff'}, {'name': 'Knutson'}, {'name': 'Wingb'}, {'name': 'Sin'}, {'name': 'Ren'}, {'name': 'Hammond'}, {'name': 'Liu'}, {'name': 'Wolter'}, {'name': 'Adam'}, {'name': 'Adam'}, {'name': 'Bedny'}, {'name': 'Lazos'}, {'name': 'Ramadan'}, {'name': 'Haigh'}, {'name': 'Lehtinen'}, {'name': 'Lehtinen'}, {'name': 'Philippe'}, {'name': 'Kawahara'}, {'name': 'Lapio'}, {'name': 'Januszewski'}, {'name': 'Marques'}, {'name': 'Marques'}, {'name': 'Wicki'}, {'name': 'Sacchi'}, {'name': 'Bandekar'}, {'name': 'Morimoto'}, {'name': 'Biehl'}, {'name': 'Swartj'}, {'name': 'Kang'}, {'name': 'Kang'}, {'name': 'Holn'}, {'name': 'Matsunami'}, {'name': 'Mathur'}, {'name': 'Peter'}, {'name': 'Tewari'}, {'name': 'Ishikawa'}, {'name': 'Chanon'}, {'name': 'Brailsford'}, {'name': 'Marinov'}, {'name': 'Coppens'}, {'name': 'Ma'}, {'name': 'Williamson'}, {'name': 'Pampal'}, {'name': 'Benson'}, {'name': 'Linden'}, {'name': 'Rubio'}, {'name': 'Denecker'}, {'name': 'Erdem'}, {'name': 'Cavalcanti'}, {'name': 'Cai'}, {'name': 'Chang'}, {'name': 'Bhattacharya'}, {'name': 'Frank'}, {'name': 'Dawson'}, {'name': 'Fournier'}, {'name': 'Adda'}, {'name': 'Reyes'}, {'name': 'Lomi'}, {'name': 'Pavlovico'}, {'name': 'Nardi'}, {'name': 'Nardi'}, {'name': 'Bradshaw'}, {'name': 'Ockerb'}, {'name': 'Gerstend'}, {'name': 'Gordon'}, {'name': 'Larion'}, {'name': 'Daat'}, {'name': 'Daat'}, {'name': 'Wecker'}, {'name': 'Ceze'}, {'name': 'Kempn'}, {'name': 'Bouras'}, {'name': 'Kinney'}, {'name': 'Kinney'}, {'name': 'Sokolov'}, {'name': 'Russa'}, {'name': 'Hirakuri'}, {'name': 'Jo'}, {'name': 'Halbert'}, {'name': 'Jessup'}, {'name': 'Tran-'}, {'name': 'Cotterill'}, {'name': 'Visr'}, {'name': 'Fenwick'}, {'name': 'Boulah'}, {'name': 'Aschoff'}, {'name': 'Birchler'}, {'name': 'Simmel'}, {'name': 'Goldbu'}, {'name': 'Neru'}, {'name': 'Baber'}, {'name': 'Trur'}, {'name': 'Date'}, {'name': 'Leitner'}, {'name': 'Tabarr'}, {'name': 'Duong'}, {'name': 'McQuillan'}, {'name': 'Evano'}, {'name': 'Rougemont'}, {'name': 'Mai'}, {'name': 'Catani'}, {'name': 'Birkett'}, {'name': 'Canellas'}, {'name': 'Reiss'}, {'name': 'Williamson'}, {'name': 'Duxbury'}, {'name': 'Ahso'}, {'name': 'Aufr'}, {'name': 'Aufr'}, {'name': 'Sutter'}, {'name': 'Stokic'}, {'name': 'Gaspar'}, {'name': 'Harmon'}, {'name': 'Youseffi'}, {'name': 'Folkers'}, {'name': 'Marsh'}, {'name': 'Brookh'}, {'name': 'Paniez'}, {'name': 'Mali'}, {'name': 'Inoue'}, {'name': 'Fonseca'}, {'name': 'Shaffer'}, {'name': 'Arnoux'}, {'name': 'Zulueta'}, {'name': 'Lhomme'}, {'name': 'Porter'}, {'name': 'Rotter'}, {'name': 'Frost'}, {'name': 'Ouaz'}, {'name': 'Nakajima'}, {'name': 'Atre'}, {'name': 'Atre'}, {'name': 'Bagato'}, {'name': 'Damas'}, {'name': 'Curutchet'}, {'name': 'Leonard'}, {'name': 'Wood'}, {'name': 'Orono'}, {'name': 'Schreitm'}, {'name': 'Bosnjak'}, {'name': 'Nestor'}, {'name': 'Kacpr'}, {'name': 'Lauciu'}, {'name': 'Fries'}, {'name': 'Basile'}, {'name': 'Basile'}, {'name': 'Nives'}, {'name': 'Shilv'}, {'name': 'Ebou'}, {'name': 'Gradino'}, {'name': 'Lanfr'}, {'name': 'John'}, {'name': 'Suppan'}, {'name': 'Szendrei'}, {'name': 'Neuhold'}, {'name': 'Kaupp'}, {'name': 'Triebel'}, {'name': 'Hippu'}, {'name': 'Fathi'}, {'name': 'Okaf'}, {'name': 'Grieng'}, {'name': 'Poize'}, {'name': 'Sohn'}, {'name': 'Norman'}, {'name': 'Frasinc'}, {'name': 'Mes'}, {'name': 'Signah'}, {'name': 'Soni'}, {'name': 'Jiao'}, {'name': 'Jiao'}, {'name': 'Zuyev'}, {'name': 'Kosken'}, {'name': 'Matsuda'}, {'name': 'Rzecz'}, {'name': 'Swien'}, {'name': 'Xiang'}, {'name': 'Castle'}, {'name': 'Elme'}, {'name': 'Macias'}, {'name': 'Urano'}, {'name': 'Montilla'}, {'name': 'Holt'}, {'name': 'Rowe'}, {'name': 'Petzo'}, {'name': 'Hubr'}, {'name': 'Tola'}, {'name': 'Beavis'}, {'name': 'Meneses'}, {'name': 'Pietkiewicz'}, {'name': 'Erol'}, {'name': 'Kaufman'}, {'name': 'Kaufman'}, {'name': 'Tassel'}, {'name': 'Fournier'}, {'name': 'Wright'}, {'name': 'Tsantis'}, {'name': 'Palma'}, {'name': 'Shim'}, {'name': 'Shim'}, {'name': 'Yong'}, {'name': 'Scher'}, {'name': 'Yoon'}, {'name': 'Cui'}, {'name': 'Tam'}, {'name': 'Gilmour'}, {'name': 'Steinmetz'}, {'name': 'Gilliam'}, {'name': 'Nguyen'}, {'name': 'Agar'}, {'name': 'Burman'}, {'name': 'Ahmadian'}, {'name': 'Kiltz'}, {'name': 'Yeoh'}, {'name': 'Herrmann'}, {'name': 'Kruglyak'}, {'name': 'Kruglyak'}, {'name': 'Richardson'}, {'name': 'Yalk'}, {'name': 'Correia'}, {'name': 'Kolodko'}, {'name': 'Agraz'}, {'name': 'Wilson'}, {'name': 'Rammer'}, {'name': 'Gotoh'}, {'name': 'Seaz'}, {'name': 'Karande'}, {'name': 'Petersen'}, {'name': 'Haigh'}, {'name': 'Haigh'}, {'name': 'Milanic'}, {'name': 'Spengler'}, {'name': 'Ng'}, {'name': 'She'}, {'name': 'Rajnov'}, {'name': 'Blanchard'}, {'name': 'Lindner'}, {'name': 'Concilio'}, {'name': 'Terauchi'}, {'name': 'Abdellatif'}, {'name': 'Holz'}, {'name': 'Klivansky'}, {'name': 'MacIntyre'}, {'name': 'Guthk'}, {'name': 'Guthk'}, {'name': 'Nicol'}, {'name': 'Engen'}, {'name': 'Garg'}, {'name': 'Noda'}, {'name': 'Redw'}, {'name': 'Higuchi'}, {'name': 'Higuchi'}, {'name': 'Sznajder'}, {'name': 'Sznajder'}, {'name': 'Saito'}, {'name': 'Adeni'}, {'name': 'Hasan'}, {'name': 'Reina-'}, {'name': 'Neubert'}, {'name': 'Eck'}, {'name': 'Chun'}, {'name': 'Uchiyama'}, {'name': 'Hancock'}, {'name': 'Reiss'}, {'name': 'Pohlem'}, {'name': 'Apostolov'}, {'name': 'Choung'}, {'name': 'Someren'}, {'name': 'Mezzar'}, {'name': 'Schelten'}, {'name': 'Yusop'}, {'name': 'Rolland'}, {'name': 'Lansi'}, {'name': 'Sadry'}, {'name': 'DeMil'}, {'name': 'Carey'}, {'name': 'Swain'}, {'name': 'Katsik'}, {'name': 'Roeder'}, {'name': 'Holloway'}, {'name': 'Coddington'}, {'name': 'Trezz'}, {'name': 'Alexandri'}, {'name': 'Ivanov'}, {'name': 'Fengl'}, {'name': 'Ray'}, {'name': 'Collet'}, {'name': 'Kimu'}, {'name': 'Belmes'}, {'name': 'Maw'}, {'name': 'Morris'}, {'name': 'Williams'}, {'name': 'Harrison'}, {'name': 'Harrison'}, {'name': 'Kothari'}, {'name': 'Cox'}, {'name': 'Samel'}, {'name': 'Dage'}, {'name': 'Kostie'}, {'name': 'Zander'}, {'name': 'Emms'}, {'name': 'Pietkiewicz'}, {'name': 'Barranco'}, {'name': 'Barranco'}, {'name': 'Roytman'}, {'name': 'Towsey'}, {'name': 'Oba'}, {'name': 'Durrant'}, {'name': 'Durrant'}, {'name': 'Stylian'}, {'name': 'Stylian'}, {'name': 'Makowski'}, {'name': 'Makowski'}, {'name': 'Wagner'}, {'name': 'Hoov'}, {'name': 'Dostal'}, {'name': 'Enokib'}, {'name': 'Enokib'}, {'name': 'Pulido'}, {'name': 'Mandviwall'}, {'name': 'Kuo'}, {'name': 'Tiroz'}, {'name': 'Tiroz'}, {'name': 'Midu'}, {'name': 'Zander'}, {'name': 'Kalantari'}, {'name': 'Kubo'}, {'name': 'Kamez'}, {'name': 'Deupree'}, {'name': 'Yuanq'}, {'name': 'Katzenb'}, {'name': 'Gall'}, {'name': 'Kean'}, {'name': 'Butler'}, {'name': 'Riser'}, {'name': 'Aufr'}, {'name': 'Loudn'}, {'name': 'Hughes'}, {'name': 'Chenu'}, {'name': 'Morrison'}, {'name': 'Qvi'}, {'name': 'Gibson'}, {'name': 'Xi'}, {'name': 'Westervelt'}, {'name': 'Yun'}, {'name': 'Labroc'}, {'name': 'Ueno'}, {'name': 'Garcia-Ferr'}, {'name': 'Psil'}, {'name': 'Jones'}, {'name': 'Pigd'}, {'name': 'Blecken'}, {'name': 'Cameron'}, {'name': 'Kim'}, {'name': 'Tillmann'}, {'name': 'Becker'}, {'name': 'Jessup'}, {'name': 'Kouan'}, {'name': 'Kouan'}, {'name': 'Larsson'}, {'name': 'Portillo'}, {'name': 'Sciore'}, {'name': 'Masum'}, {'name': 'Kannan'}, {'name': 'Gierl'}, {'name': 'Bouamama'}, {'name': 'Muñoz'}, {'name': 'Aydin'}, {'name': 'Zhiyong'}, {'name': 'Zle'}, {'name': 'Hirvas'}, {'name': 'Lorinczi'}, {'name': 'Al-Hu'}, {'name': 'Holn'}, {'name': 'Fredrickso'}, {'name': 'Mizuno'}, {'name': 'Scheine'}, {'name': 'Scheine'}, {'name': 'Stephenn'}, {'name': 'Schinag'}, {'name': 'Otsuki'}, {'name': 'Eller'}, {'name': 'Wetzel'}, {'name': 'Mulet'}, {'name': 'Queiroz'}, {'name': 'Tadjo'}, {'name': 'Guix'}, {'name': 'Fall'}, {'name': 'Stokic'}, {'name': 'Richardson'}, {'name': 'Moei'}, {'name': 'Chettao'}, {'name': 'Eggers'}, {'name': 'Schill'}, {'name': 'Hamagi'}, {'name': 'Samar'}, {'name': 'Rical'}, {'name': 'Hughes'}, {'name': 'Huo'}, {'name': 'Oller'}, {'name': 'Dumont'}, {'name': 'Simmel'}, {'name': 'Simmel'}, {'name': 'Keuk'}, {'name': 'Hahn-'}, {'name': 'Yoshimoto'}, {'name': 'Kotsonis'}, {'name': 'Ingram'}, {'name': 'Tavan'}, {'name': 'Jovicic'}, {'name': 'Potry'}, {'name': 'Pettersen'}, {'name': 'Miliko'}, {'name': 'Rani'}, {'name': 'Oblak'}, {'name': 'Oblak'}, {'name': 'Monger'}, {'name': 'Lemoine'}, {'name': 'Tyler'}, {'name': 'Lohman'}, {'name': 'Hayrapetyan'}, {'name': 'Kok'}, {'name': 'Frazin'}, {'name': 'Lui'}, {'name': 'Erdem'}, {'name': 'Visr'}, {'name': 'Ohki'}, {'name': 'Michael'}, {'name': 'Kurt'}, {'name': 'Abdul-Rahman'}, {'name': 'Kei'}, {'name': 'Shavel'}, {'name': 'Shavel'}, {'name': 'Lingamp'}, {'name': 'Velikovs'}, {'name': 'Rumat'}, {'name': 'Frost'}, {'name': 'Martel-'}, {'name': 'Breed'}, {'name': 'Witty'}, {'name': 'Corr'}, {'name': 'Clemme'}, {'name': 'Karv'}, {'name': 'Bansal'}, {'name': 'Eynd'}, {'name': 'Homyk'}, {'name': 'Atkins'}, {'name': 'Cordt'}, {'name': 'Ching'}, {'name': 'Ching'}, {'name': 'Urwin'}, {'name': 'Kereth'}, {'name': 'Peeri'}, {'name': 'Peeri'}, {'name': 'Grant'}, {'name': 'Wyes'}, {'name': 'Nirenbu'}, {'name': 'So'}, {'name': 'So'}, {'name': 'Peip'}, {'name': 'Duncan'}, {'name': 'Ladu'}, {'name': 'Chow'}, {'name': 'Quinta'}, {'name': 'Godfrey'}, {'name': 'Khalil'}, {'name': 'Achilles'}, {'name': 'Gregory'}, {'name': 'Stenv'}, {'name': 'Sveti'}, {'name': 'Sakanushi'}, {'name': 'Jode'}, {'name': 'Jode'}, {'name': 'Harass'}, {'name': 'Braña'}, {'name': 'Lucas'}, {'name': 'Rammer'}, {'name': 'Rammer'}, {'name': 'Hennig'}, {'name': 'Fernandez-Gonzalez'}, {'name': 'Erol'}, {'name': 'Chapman'}, {'name': 'Wilks'}, {'name': 'Betho'}, {'name': 'Aufr'}, {'name': 'Stoltzfus'}, {'name': 'Levitan'}, {'name': 'Kahs'}, {'name': 'Spikov'}, {'name': 'Moscarini'}, {'name': 'Cordt'}, {'name': 'Dair'}, {'name': 'Dave'}, {'name': 'Peter'}, {'name': 'Leister'}, {'name': 'Pottos'}, {'name': 'Dellwo'}, {'name': 'Kim'}, {'name': 'Carrera'}, {'name': 'Liang'}, {'name': 'Reiss'}, {'name': 'Bouamama'}, {'name': 'Lesaffre'}, {'name': 'Reiss'}, {'name': 'Henriksen'}, {'name': 'Henriksen'}, {'name': 'Hung'}, {'name': 'Smoro'}, {'name': 'Fonseca'}, {'name': 'Wodn'}, {'name': 'Palaniswami'}, {'name': 'Palaniswami'}, {'name': 'Juan'}, {'name': 'Janssen'}, {'name': 'Hird'}, {'name': 'Shapiro'}, {'name': 'Walker'}, {'name': 'Maesf'}, {'name': 'Donofrio'}, {'name': 'Esparza'}, {'name': 'Giannoulis'}, {'name': 'Busch'}, {'name': 'Sram'}, {'name': 'Sud'}, {'name': 'Clarkson'}, {'name': 'Cabr'}, {'name': 'Streitf'}, {'name': 'Pourkas'}, {'name': 'Nicol'}, {'name': 'Godfrey'}, {'name': 'Dubink'}, {'name': 'Mattor'}, {'name': 'Mattor'}, {'name': 'Makinen'}, {'name': 'Mesne'}, {'name': 'McQuillan'}, {'name': 'Graham'}, {'name': 'Bengtss'}, {'name': 'Milner'}, {'name': 'Gierl'}, {'name': 'Pampal'}, {'name': 'Yip'}, {'name': 'Ailamaki'}, {'name': 'Neff'}, {'name': 'Buril'}, {'name': 'Lykin'}, {'name': 'Oliveira'}, {'name': 'Mercank'}, {'name': 'Guiho'}, {'name': 'Yang'}, {'name': 'Hands'}, {'name': 'Morgan'}, {'name': 'Pampal'}, {'name': 'Tellez'}, {'name': 'Tellez'}, {'name': 'Mauras'}, {'name': 'Nakajima'}, {'name': 'Nakajima'}, {'name': 'Wood'}, {'name': 'Nisso'}, {'name': 'Hay'}, {'name': 'Katehakis'}, {'name': 'Rieger'}, {'name': 'Mohamed'}, {'name': 'Bussel'}, {'name': 'Bulash'}, {'name': 'Ratcliff'}, {'name': 'Winzer'}, {'name': 'Rammer'}, {'name': 'Sacchi'}, {'name': 'ODono'}, {'name': 'Schinag'}, {'name': 'Furukawa'}, {'name': 'Kun'}, {'name': 'Kun'}, {'name': 'Makarychev'}, {'name': 'Soricu'}, {'name': 'Morales'}, {'name': 'Klingenb'}, {'name': 'Duan'}, {'name': 'Fickl'}, {'name': 'Bouzeghoub'}, {'name': 'Wilks'}, {'name': 'Savolainen'}, {'name': 'Bennett'}, {'name': 'Califieri'}, {'name': 'Epley'}, {'name': 'Epley'}, {'name': 'Samo'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]Find the name of department that offers the class whose description has the word "Statistics".[/QUESTION] [SQL]SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'[/SQL]
[QUESTION]Find the name of department that offers the class whose description has the word "Statistics".[/QUESTION] [SQL]SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'[/SQL]
[QUESTION]Find the name of department that offers the class whose description has the word "Statistics".[/QUESTION] [SQL]SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'[/SQL]
[QUESTION]Find the name of department that offers the class whose description has the word "Statistics".[/QUESTION] [SQL]SELECT T2.dept_name FROM course AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.crs_description LIKE '%Statistics%'[/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 */
For each faculty rank, show the number of faculty members who have it.
SELECT rank , count(*) FROM Faculty GROUP BY rank
[{'Rank': 'AssocProf', 'count(*)': 8}, {'Rank': 'AsstProf', 'count(*)': 15}, {'Rank': 'Instructor', 'count(*)': 8}, {'Rank': 'Professor', 'count(*)': 27}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]Find the number of professors with a Ph.D. degree in each department.[/QUESTION] [SQL]SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code[/SQL]
[QUESTION]Find the number of professors with a Ph.D. degree in each department.[/QUESTION] [SQL]SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code[/SQL]
[QUESTION]Find the number of professors with a Ph.D. degree in each department.[/QUESTION] [SQL]SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code[/SQL]
[QUESTION]Find the number of professors with a Ph.D. degree in each department.[/QUESTION] [SQL]SELECT count(*) , dept_code FROM professor WHERE prof_high_degree = 'Ph.D.' GROUP BY dept_code[/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 total number of courses offered.
SELECT count(*) FROM COURSES
[{'count(*)': 15}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many courses in total are listed?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses in total are listed?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses in total are listed?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
[QUESTION]How many courses in total are listed?[/QUESTION] [SQL]SELECT count(*) FROM Courses[/SQL]
musical
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") )
CREATE TABLE actor ( "Actor_ID" INTEGER, "Name" TEXT, "Musical_ID" INTEGER, "Character" TEXT, "Duration" TEXT, age INTEGER, PRIMARY KEY ("Actor_ID"), FOREIGN KEY("Musical_ID") REFERENCES actor ("Actor_ID") ) /* 2 rows from actor table: Actor_ID Name Musical_ID Character Duration age 1 Ray Meagher 1 Alf Stewart 1988— 26 2 Tom Oliver 1 Lou Carpenter 1988, 1992— 22 */ CREATE TABLE musical ( "Musical_ID" INTEGER, "Name" TEXT, "Year" INTEGER, "Award" TEXT, "Category" TEXT, "Nominee" TEXT, "Result" TEXT, PRIMARY KEY ("Musical_ID") ) /* 2 rows from musical table: Musical_ID Name Year Award Category Nominee Result 1 The Phantom of the Opera 1986 Tony Award Best Book of a Musical Bob Fosse Nominated 2 Les Misérables 1986 Tony Award Best Performance by a Leading Actor in a Musical Cleavant Derricks Nominated */
What are the names of actors, ordered alphabetically?
SELECT Name FROM actor ORDER BY Name ASC
[{'Name': 'Alan Fletcher'}, {'Name': 'Ian Smith'}, {'Name': 'Jackie Woodburne'}, {'Name': 'Kate Ritchie'}, {'Name': 'Lynne McGranger'}, {'Name': 'Ray Meagher'}, {'Name': 'Ryan Moloney'}, {'Name': 'Stefan Dennis'}, {'Name': 'Tom Oliver'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/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 are the authors with the most published papers in syntactic parsing ?
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
[QUESTION]return me the authors who have the most number of papers in PVLDB .[/QUESTION] [SQL]SELECT t1.name 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 t2.name = "PVLDB" GROUP BY t1.name ORDER BY COUNT ( DISTINCT t4.title ) DESC LIMIT 1;[/SQL]
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 */
How many companies are in either "Banking" industry or "Conglomerate" industry?
SELECT count(*) FROM Companies WHERE Industry = "Banking" OR Industry = "Conglomerate"
[{'count(*)': 10}]
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]
[QUESTION]How many bank branches are there?[/QUESTION] [SQL]SELECT count(*) FROM bank[/SQL]
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 */
What are the names of customers using the most popular payment method?
SELECT customer_name FROM customers WHERE payment_method = (SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1)
[{'customer_name': 'Tillman Ernser'}, {'customer_name': 'Prof. Reyes Berge II'}, {'customer_name': 'Devin Mills'}, {'customer_name': 'Salvatore Tillman'}, {'customer_name': 'Clifford Pagac'}, {'customer_name': 'Alexane Kilback'}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]What is the name of the customer who has greatest total loan amount?[/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 ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the customer who has greatest total loan amount?[/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 ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the customer who has greatest total loan amount?[/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 ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the customer who has greatest total loan amount?[/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 ORDER BY sum(T2.amount) DESC LIMIT 1[/SQL]
products_gen_characteristics
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) )
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) /* 2 rows from Characteristics table: characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details 1 Grade numquam slow None 2 Grade doloribus fast None */ CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) /* 2 rows from Product_Characteristics table: product_id characteristic_id product_characteristic_value 13 13 low 11 2 low */ CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) /* 2 rows from Products table: product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details 1 4 Spices cumin 2878.3 et None 2 2 Spices peper 352447.2874677 1892070.2803543 rerum None */ CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) /* 2 rows from Ref_Characteristic_Types table: characteristic_type_code characteristic_type_description Grade Grade Purity Purity */ CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) /* 2 rows from Ref_Colors table: color_code color_description 9 red 5 green */ CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) ) /* 2 rows from Ref_Product_Categories table: product_category_code product_category_description unit_of_measure Herbs Herbs Handful Seeds Seeds Weight - pound,kilo. */
Find the unit of measurement and product category code of product named "chervil".
SELECT t2.unit_of_measure , t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
[{'unit_of_measure': 'Handful ', 'product_category_code': 'Herbs'}]
Medium
false
false
false
false
false
false
false
true
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 */
List all countries of markets in ascending alphabetical order.
SELECT Country FROM market ORDER BY Country ASC
[{'Country': 'China'}, {'Country': 'France'}, {'Country': 'Japan'}, {'Country': 'Poland'}, {'Country': 'Russia'}, {'Country': 'USA'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]Return the name, location and district of all shops in descending order of number of products.[/QUESTION] [SQL]SELECT name , LOCATION , district FROM shop ORDER BY number_products DESC[/SQL]
[QUESTION]Return the name, location and district of all shops in descending order of number of products.[/QUESTION] [SQL]SELECT name , LOCATION , district FROM shop ORDER BY number_products DESC[/SQL]
small_bank_1
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) )
CREATE TABLE "ACCOUNTS" ( custid BIGINT NOT NULL, name VARCHAR(64) NOT NULL, PRIMARY KEY (custid) ) /* 2 rows from ACCOUNTS table: custid name 1 Brown 2 Wang */ CREATE TABLE "CHECKING" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from CHECKING table: custid balance 1 10000.0 2 2000.0 */ CREATE TABLE "SAVINGS" ( custid BIGINT NOT NULL, balance FLOAT NOT NULL, PRIMARY KEY (custid), FOREIGN KEY(custid) REFERENCES "ACCOUNTS" (custid) ) /* 2 rows from SAVINGS table: custid balance 1 200000.0 2 999999999.0 */
Find the total checking and saving balance of all accounts sorted by the total balance in ascending order.
SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid = T2.custid ORDER BY T1.balance + T2.balance
[{'T1.balance + T2.balance': 317.0}, {'T1.balance + T2.balance': 7060.0}, {'T1.balance + T2.balance': 90000.0}, {'T1.balance + T2.balance': 210000.0}, {'T1.balance + T2.balance': 233000.0}, {'T1.balance + T2.balance': 1000001999.0}]
Medium
false
false
false
true
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]
[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]
sports_competition
CREATE TABLE club ( "Club_ID" INTEGER, name TEXT, "Region" TEXT, "Start_year" TEXT, PRIMARY KEY ("Club_ID") ) CREATE TABLE club_rank ( "Rank" REAL, "Club_ID" INTEGER, "Gold" REAL, "Silver" REAL, "Bronze" REAL, "Total" REAL, PRIMARY KEY ("Rank", "Club_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) CREATE TABLE competition ( "Competition_ID" INTEGER, "Year" REAL, "Competition_type" TEXT, "Country" TEXT, PRIMARY KEY ("Competition_ID") ) CREATE TABLE competition_result ( "Competition_ID" INTEGER, "Club_ID_1" INTEGER, "Club_ID_2" INTEGER, "Score" TEXT, PRIMARY KEY ("Competition_ID", "Club_ID_1", "Club_ID_2"), FOREIGN KEY("Competition_ID") REFERENCES competition ("Competition_ID"), FOREIGN KEY("Club_ID_2") REFERENCES club ("Club_ID"), FOREIGN KEY("Club_ID_1") REFERENCES club ("Club_ID") ) CREATE TABLE player ( "Player_ID" INTEGER, name TEXT, "Position" TEXT, "Club_ID" INTEGER, "Apps" REAL, "Tries" REAL, "Goals" TEXT, "Points" REAL, PRIMARY KEY ("Player_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") )
CREATE TABLE club ( "Club_ID" INTEGER, name TEXT, "Region" TEXT, "Start_year" TEXT, PRIMARY KEY ("Club_ID") ) /* 2 rows from club table: Club_ID name Region Start_year 1 AIB USA 2009 2 BK Slide UK 1998 */ CREATE TABLE club_rank ( "Rank" REAL, "Club_ID" INTEGER, "Gold" REAL, "Silver" REAL, "Bronze" REAL, "Total" REAL, PRIMARY KEY ("Rank", "Club_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) /* 2 rows from club_rank table: Rank Club_ID Gold Silver Bronze Total 1.0 2 11.0 11.0 9.0 31.0 2.0 3 8.0 7.0 6.0 21.0 */ CREATE TABLE competition ( "Competition_ID" INTEGER, "Year" REAL, "Competition_type" TEXT, "Country" TEXT, PRIMARY KEY ("Competition_ID") ) /* 2 rows from competition table: Competition_ID Year Competition_type Country 1 2006.0 Friendly Italy 2 2006.0 Friendly Spain */ CREATE TABLE competition_result ( "Competition_ID" INTEGER, "Club_ID_1" INTEGER, "Club_ID_2" INTEGER, "Score" TEXT, PRIMARY KEY ("Competition_ID", "Club_ID_1", "Club_ID_2"), FOREIGN KEY("Competition_ID") REFERENCES competition ("Competition_ID"), FOREIGN KEY("Club_ID_2") REFERENCES club ("Club_ID"), FOREIGN KEY("Club_ID_1") REFERENCES club ("Club_ID") ) /* 2 rows from competition_result table: Competition_ID Club_ID_1 Club_ID_2 Score 1 1 2 11:10 2 3 2 25:2 */ CREATE TABLE player ( "Player_ID" INTEGER, name TEXT, "Position" TEXT, "Club_ID" INTEGER, "Apps" REAL, "Tries" REAL, "Goals" TEXT, "Points" REAL, PRIMARY KEY ("Player_ID"), FOREIGN KEY("Club_ID") REFERENCES club ("Club_ID") ) /* 2 rows from player table: Player_ID name Position Club_ID Apps Tries Goals Points 1 Michael Platt Full Back 1 20.0 5.0 0 20.0 2 Dave Halley Right Wing 2 23.0 9.0 0 36.0 */
What are the names of all the clubs starting with the oldest?
SELECT name FROM club ORDER BY Start_year ASC
[{'name': 'BK Slide'}, {'name': 'HGS2'}, {'name': 'ASC'}, {'name': 'IFG'}, {'name': 'AIB'}, {'name': 'HSBIF'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION] [SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL]
[QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION] [SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL]
[QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION] [SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL]
[QUESTION]What are the full names of all players, sorted by birth date?[/QUESTION] [SQL]SELECT first_name , last_name FROM players ORDER BY birth_date[/SQL]
cre_Theme_park
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") )
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) /* 2 rows from Features table: Feature_ID Feature_Details 523 cafe 528 park */ CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) /* 2 rows from Hotels table: hotel_id star_rating_code pets_allowed_yn price_range other_hotel_details 123 5 1 2914989.571 None 144 4 None */ CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) /* 2 rows from Locations table: Location_ID Location_Name Address Other_Details 333 Astro Orbiter 660 Shea Crescent None 368 African Animals 254 Ottilie Junction None */ CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Museums table: Museum_ID Museum_Details 2113 Yale Center for British Art 2701 The Metropolitan Museum of Art */ CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Photos table: Photo_ID Tourist_Attraction_ID Name Description Filename Other_Details 211 8449 game1 None 702 None 280 7067 game2 None 762 None */ CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) /* 2 rows from Ref_Attraction_Types table: Attraction_Type_Code Attraction_Type_Description 2 park 3 garden */ CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) /* 2 rows from Ref_Hotel_Star_Ratings table: star_rating_code star_rating_description 1 star 2 star */ CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Royal_Family table: Royal_Family_ID Royal_Family_Details 9561 None 9919 None */ CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Shops table: Shop_ID Shop_Details 8429 soup 8449 coffee */ CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Staff table: Staff_ID Tourist_Attraction_ID Name Other_Details 170 6476 Whitney None 219 6476 Kaela None */ CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Street_Markets table: Market_ID Market_Details 6852 Broadway 7067 Fish Farm Market */ CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Theme_Parks table: Theme_Park_ID Theme_Park_Details 5265 Disney 6476 Sea World */ CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) /* 2 rows from Tourist_Attraction_Features table: Tourist_Attraction_ID Feature_ID 5076 528 5076 681 */ CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) /* 2 rows from Tourist_Attractions table: Tourist_Attraction_ID Attraction_Type_Code Location_ID How_to_Get_There Name Description Opening_Hours Other_Details 2113 2 579 bus art museum None None None 2701 6 417 walk UK gallery None None None */ CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) /* 2 rows from Visitors table: Tourist_ID Tourist_Details 164 Toney 189 Graciela */ CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") ) /* 2 rows from Visits table: Visit_ID Tourist_Attraction_ID Tourist_ID Visit_Date Visit_Details 183 6653 377 2004-08-21 03:06:14 268 5076 204 2013-08-06 05:35:51 */
Show the id and star rating of each hotel, ordered by its price from low to high.
SELECT hotel_id , star_rating_code FROM HOTELS ORDER BY price_range ASC
[{'hotel_id': 431, 'star_rating_code': '2'}, {'hotel_id': 426, 'star_rating_code': '5'}, {'hotel_id': 473, 'star_rating_code': '1'}, {'hotel_id': 555, 'star_rating_code': '5'}, {'hotel_id': 420, 'star_rating_code': '5'}, {'hotel_id': 172, 'star_rating_code': '5'}, {'hotel_id': 264, 'star_rating_code': '1'}, {'hotel_id': 442, 'star_rating_code': '2'}, {'hotel_id': 514, 'star_rating_code': '5'}, {'hotel_id': 123, 'star_rating_code': '5'}, {'hotel_id': 421, 'star_rating_code': '3'}, {'hotel_id': 379, 'star_rating_code': '4'}, {'hotel_id': 373, 'star_rating_code': '5'}, {'hotel_id': 314, 'star_rating_code': '5'}, {'hotel_id': 144, 'star_rating_code': '4'}, {'hotel_id': 222, 'star_rating_code': '5'}, {'hotel_id': 239, 'star_rating_code': '3'}, {'hotel_id': 331, 'star_rating_code': '1'}, {'hotel_id': 350, 'star_rating_code': '1'}, {'hotel_id': 376, 'star_rating_code': '2'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
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 types of vocals that the musician with the first name "Solveig" played in the song "A Bar in Amsterdam"?
SELECT TYPE FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid JOIN band AS T3 ON T1.bandmate = T3.id WHERE T3.firstname = "Solveig" AND T2.title = "A Bar In Amsterdam"
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
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 */
What are the details of the student who registered for the most number of courses?
SELECT T1.student_details FROM students AS T1 JOIN student_course_registrations AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
[{'student_details': 'Martin'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What is the name of the course with the most students enrolled?[/QUESTION] [SQL]SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the course with the most students enrolled?[/QUESTION] [SQL]SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the course with the most students enrolled?[/QUESTION] [SQL]SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]What is the name of the course with the most students enrolled?[/QUESTION] [SQL]SELECT T1.course_name FROM Courses AS T1 JOIN Student_Enrolment_Courses AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY count(*) DESC LIMIT 1[/SQL]
voter_2
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 "Voting_record" ( "StuID" INTEGER, "Registration_Date" VARCHAR(12), "Election_Cycle" VARCHAR(12), "President_Vote" INTEGER, "Vice_President_Vote" INTEGER, "Secretary_Vote" INTEGER, "Treasurer_Vote" INTEGER, "Class_President_Vote" INTEGER, "Class_Senator_Vote" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Vice_President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Secretary_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Treasurer_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Class_President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Class_Senator_Vote") 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") ) /* 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 "Voting_record" ( "StuID" INTEGER, "Registration_Date" VARCHAR(12), "Election_Cycle" VARCHAR(12), "President_Vote" INTEGER, "Vice_President_Vote" INTEGER, "Secretary_Vote" INTEGER, "Treasurer_Vote" INTEGER, "Class_President_Vote" INTEGER, "Class_Senator_Vote" INTEGER, FOREIGN KEY("StuID") REFERENCES "Student" ("StuID"), FOREIGN KEY("President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Vice_President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Secretary_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Treasurer_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Class_President_Vote") REFERENCES "Student" ("StuID"), FOREIGN KEY("Class_Senator_Vote") REFERENCES "Student" ("StuID") ) /* 2 rows from Voting_record table: StuID Registration_Date Election_Cycle President_Vote Vice_President_Vote Secretary_Vote Treasurer_Vote Class_President_Vote Class_Senator_Vote 1001 08/30/2015 Spring 1004 1007 1010 1035 1001 1028 1002 08/30/2014 Spring 1014 1007 1020 1025 1021 1028 */
For each election cycle, report the number of voting records.
SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle
[{'Election_Cycle': 'Fall', 'count(*)': 5}, {'Election_Cycle': 'Spring', 'count(*)': 5}]
Easy
false
false
false
false
false
true
false
false
false
false
false
false
false
[QUESTION]List the vote ids, phone numbers and states of all votes.[/QUESTION] [SQL]SELECT vote_id , phone_number , state FROM votes[/SQL]
[QUESTION]List the vote ids, phone numbers and states of all votes.[/QUESTION] [SQL]SELECT vote_id , phone_number , state FROM votes[/SQL]
[QUESTION]List the vote ids, phone numbers and states of all votes.[/QUESTION] [SQL]SELECT vote_id , phone_number , state FROM votes[/SQL]
[QUESTION]List the vote ids, phone numbers and states of all votes.[/QUESTION] [SQL]SELECT vote_id , phone_number , state FROM votes[/SQL]
scientist_1
CREATE TABLE "AssignedTo" ( "Scientist" INTEGER NOT NULL, "Project" CHAR(4) NOT NULL, PRIMARY KEY ("Scientist", "Project"), FOREIGN KEY("Scientist") REFERENCES "Scientists" ("SSN"), FOREIGN KEY("Project") REFERENCES "Projects" ("Code") ) CREATE TABLE "Projects" ( "Code" CHAR(4), "Name" CHAR(50) NOT NULL, "Hours" INTEGER, PRIMARY KEY ("Code") ) CREATE TABLE "Scientists" ( "SSN" INTEGER, "Name" CHAR(30) NOT NULL, PRIMARY KEY ("SSN") )
CREATE TABLE "AssignedTo" ( "Scientist" INTEGER NOT NULL, "Project" CHAR(4) NOT NULL, PRIMARY KEY ("Scientist", "Project"), FOREIGN KEY("Scientist") REFERENCES "Scientists" ("SSN"), FOREIGN KEY("Project") REFERENCES "Projects" ("Code") ) /* 2 rows from AssignedTo table: Scientist Project 123234877 AeH1 152934485 AeH3 */ CREATE TABLE "Projects" ( "Code" CHAR(4), "Name" CHAR(50) NOT NULL, "Hours" INTEGER, PRIMARY KEY ("Code") ) /* 2 rows from Projects table: Code Name Hours AeH1 Winds: Studying Bernoullis Principle 156 AeH2 Aerodynamics and Bridge Design 189 */ CREATE TABLE "Scientists" ( "SSN" INTEGER, "Name" CHAR(30) NOT NULL, PRIMARY KEY ("SSN") ) /* 2 rows from Scientists table: SSN Name 123234877 Michael Rogers 152934485 Anand Manikutty */
Find the name of project that continues for the longest time.
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
[{'Name': 'A Magnetic Primer Designer'}]
Easy
false
false
false
true
true
false
false
false
false
false
false
false
false
cre_Doc_Tracking_DB
CREATE TABLE "All_Documents" ( "Document_ID" INTEGER NOT NULL, "Date_Stored" DATETIME, "Document_Type_Code" CHAR(15) NOT NULL, "Document_Name" CHAR(255), "Document_Description" CHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Date_Stored") REFERENCES "Ref_Calendar" ("Calendar_Date") ) CREATE TABLE "Document_Locations" ( "Document_ID" INTEGER NOT NULL, "Location_Code" CHAR(15) NOT NULL, "Date_in_Location_From" DATETIME NOT NULL, "Date_in_Locaton_To" DATETIME, PRIMARY KEY ("Document_ID", "Location_Code", "Date_in_Location_From"), FOREIGN KEY("Location_Code") REFERENCES "Ref_Locations" ("Location_Code"), FOREIGN KEY("Date_in_Location_From") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Date_in_Locaton_To") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) CREATE TABLE "Documents_to_be_Destroyed" ( "Document_ID" INTEGER NOT NULL, "Destruction_Authorised_by_Employee_ID" INTEGER, "Destroyed_by_Employee_ID" INTEGER, "Planned_Destruction_Date" DATETIME, "Actual_Destruction_Date" DATETIME, "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Destroyed_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Destruction_Authorised_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Planned_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Actual_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) CREATE TABLE "Employees" ( "Employee_ID" INTEGER NOT NULL, "Role_Code" CHAR(15) NOT NULL, "Employee_Name" VARCHAR(255), "Gender_MFU" CHAR(1) NOT NULL, "Date_of_Birth" DATETIME NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Employee_ID"), FOREIGN KEY("Role_Code") REFERENCES "Roles" ("Role_Code") ) CREATE TABLE "Ref_Calendar" ( "Calendar_Date" DATETIME NOT NULL, "Day_Number" INTEGER, PRIMARY KEY ("Calendar_Date") ) 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 "Ref_Locations" ( "Location_Code" CHAR(15) NOT NULL, "Location_Name" VARCHAR(255) NOT NULL, "Location_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Location_Code") ) CREATE TABLE "Roles" ( "Role_Code" CHAR(15) NOT NULL, "Role_Name" VARCHAR(255), "Role_Description" VARCHAR(255), PRIMARY KEY ("Role_Code") )
CREATE TABLE "All_Documents" ( "Document_ID" INTEGER NOT NULL, "Date_Stored" DATETIME, "Document_Type_Code" CHAR(15) NOT NULL, "Document_Name" CHAR(255), "Document_Description" CHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Document_Type_Code") REFERENCES "Ref_Document_Types" ("Document_Type_Code"), FOREIGN KEY("Date_Stored") REFERENCES "Ref_Calendar" ("Calendar_Date") ) /* 2 rows from All_Documents table: Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details 7 1976-06-15 03:40:06 CV Robin CV None None 11 1986-10-14 17:53:39 CV Marry CV None None */ CREATE TABLE "Document_Locations" ( "Document_ID" INTEGER NOT NULL, "Location_Code" CHAR(15) NOT NULL, "Date_in_Location_From" DATETIME NOT NULL, "Date_in_Locaton_To" DATETIME, PRIMARY KEY ("Document_ID", "Location_Code", "Date_in_Location_From"), FOREIGN KEY("Location_Code") REFERENCES "Ref_Locations" ("Location_Code"), FOREIGN KEY("Date_in_Location_From") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Date_in_Locaton_To") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) /* 2 rows from Document_Locations table: Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To 7 e 2017-01-06 23:17:22 2008-06-08 12:45:38 11 x 2017-01-06 23:17:22 2012-07-03 09:48:46 */ CREATE TABLE "Documents_to_be_Destroyed" ( "Document_ID" INTEGER NOT NULL, "Destruction_Authorised_by_Employee_ID" INTEGER, "Destroyed_by_Employee_ID" INTEGER, "Planned_Destruction_Date" DATETIME, "Actual_Destruction_Date" DATETIME, "Other_Details" VARCHAR(255), PRIMARY KEY ("Document_ID"), FOREIGN KEY("Destroyed_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Destruction_Authorised_by_Employee_ID") REFERENCES "Employees" ("Employee_ID"), FOREIGN KEY("Planned_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Actual_Destruction_Date") REFERENCES "Ref_Calendar" ("Calendar_Date"), FOREIGN KEY("Document_ID") REFERENCES "All_Documents" ("Document_ID") ) /* 2 rows from Documents_to_be_Destroyed table: Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details 7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None 11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None */ CREATE TABLE "Employees" ( "Employee_ID" INTEGER NOT NULL, "Role_Code" CHAR(15) NOT NULL, "Employee_Name" VARCHAR(255), "Gender_MFU" CHAR(1) NOT NULL, "Date_of_Birth" DATETIME NOT NULL, "Other_Details" VARCHAR(255), PRIMARY KEY ("Employee_ID"), FOREIGN KEY("Role_Code") REFERENCES "Roles" ("Role_Code") ) /* 2 rows from Employees table: Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details 25 HR Leo 1973-02-15 17:16:00 None 30 MG Ebba 1979-09-20 12:50:15 None */ CREATE TABLE "Ref_Calendar" ( "Calendar_Date" DATETIME NOT NULL, "Day_Number" INTEGER, PRIMARY KEY ("Calendar_Date") ) /* 2 rows from Ref_Calendar table: Calendar_Date Day_Number 1972-03-31 09:47:22 5 1976-06-15 03:40:06 7 */ 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 CV CV BK Book */ CREATE TABLE "Ref_Locations" ( "Location_Code" CHAR(15) NOT NULL, "Location_Name" VARCHAR(255) NOT NULL, "Location_Description" VARCHAR(255) NOT NULL, PRIMARY KEY ("Location_Code") ) /* 2 rows from Ref_Locations table: Location_Code Location_Name Location_Description b Brazil c Canada */ CREATE TABLE "Roles" ( "Role_Code" CHAR(15) NOT NULL, "Role_Name" VARCHAR(255), "Role_Description" VARCHAR(255), PRIMARY KEY ("Role_Code") ) /* 2 rows from Roles table: Role_Code Role_Name Role_Description MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur f ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos. */
Find the starting date and ending data in location for the document named "Robin CV".
SELECT T1.date_in_location_from , T1.date_in_locaton_to FROM Document_locations AS T1 JOIN All_documents AS T2 ON T1.document_id = T2.document_id WHERE T2.document_name = "Robin CV"
[{'Date_in_Location_From': '2017-01-06 23:17:22', 'Date_in_Locaton_To': '2008-06-08 12:45:38'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
book_2
CREATE TABLE book ( "Book_ID" INTEGER, "Title" TEXT, "Issues" REAL, "Writer" TEXT, PRIMARY KEY ("Book_ID") ) CREATE TABLE publication ( "Publication_ID" INTEGER, "Book_ID" INTEGER, "Publisher" TEXT, "Publication_Date" TEXT, "Price" REAL, PRIMARY KEY ("Publication_ID"), FOREIGN KEY("Book_ID") REFERENCES book ("Book_ID") )
CREATE TABLE book ( "Book_ID" INTEGER, "Title" TEXT, "Issues" REAL, "Writer" TEXT, PRIMARY KEY ("Book_ID") ) /* 2 rows from book table: Book_ID Title Issues Writer 1 The Black Lamb 6.0 Timothy Truman 2 Bloody Mary 4.0 Garth Ennis */ CREATE TABLE publication ( "Publication_ID" INTEGER, "Book_ID" INTEGER, "Publisher" TEXT, "Publication_Date" TEXT, "Price" REAL, PRIMARY KEY ("Publication_ID"), FOREIGN KEY("Book_ID") REFERENCES book ("Book_ID") ) /* 2 rows from publication table: Publication_ID Book_ID Publisher Publication_Date Price 1 1 Pearson August 2008 15000000.0 2 3 Thomson Reuters March 2008 6000000.0 */
Show the title and publication dates of books.
SELECT T1.Title , T2.Publication_Date FROM book AS T1 JOIN publication AS T2 ON T1.Book_ID = T2.Book_ID
[{'Title': 'The Black Lamb', 'Publication_Date': 'August 2008'}, {'Title': 'Bloody Mary : Lady Liberty', 'Publication_Date': 'March 2008'}, {'Title': 'BrainBanx', 'Publication_Date': 'June 2006'}, {'Title': 'Cyberella', 'Publication_Date': 'October 2005'}, {'Title': 'The Dome: Ground Zero', 'Publication_Date': 'August 2008'}, {'Title': "Michael Moorcock's Multiverse", 'Publication_Date': 'March 2007'}, {'Title': "Sheva's War", 'Publication_Date': 'April 2007'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
yelp
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) )
CREATE TABLE business ( bid INTEGER, business_id TEXT, name TEXT, full_address TEXT, city TEXT, latitude TEXT, longitude TEXT, review_count INTEGER, is_open INTEGER, rating REAL, state TEXT, PRIMARY KEY (bid) ) /* 2 rows from business table: bid business_id name full_address city latitude longitude review_count is_open rating state */ CREATE TABLE category ( id INTEGER, business_id TEXT, category_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from category table: id business_id category_name */ CREATE TABLE checkin ( cid INTEGER, business_id TEXT, count INTEGER, day TEXT, PRIMARY KEY (cid), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from checkin table: cid business_id count day */ CREATE TABLE neighbourhood ( id INTEGER, business_id TEXT, neighbourhood_name TEXT, PRIMARY KEY (id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from neighbourhood table: id business_id neighbourhood_name */ CREATE TABLE review ( rid INTEGER, business_id TEXT, user_id TEXT, rating REAL, text TEXT, year INTEGER, month TEXT, PRIMARY KEY (rid), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from review table: rid business_id user_id rating text year month */ CREATE TABLE tip ( tip_id INTEGER, business_id TEXT, text TEXT, user_id TEXT, likes INTEGER, year INTEGER, month TEXT, PRIMARY KEY (tip_id), FOREIGN KEY(user_id) REFERENCES user (user_id), FOREIGN KEY(business_id) REFERENCES business (business_id) ) /* 2 rows from tip table: tip_id business_id text user_id likes year month */ CREATE TABLE user ( uid INTEGER, user_id TEXT, name TEXT, PRIMARY KEY (uid) ) /* 2 rows from user table: uid user_id name */
Which restaurant in Dallas were reviewed by user Patrick ?
SELECT t1.name FROM category AS t2 JOIN business AS t1 ON t2.business_id = t1.business_id JOIN review AS t3 ON t3.business_id = t1.business_id JOIN USER AS t4 ON t4.user_id = t3.user_id WHERE t1.city = "Dallas" AND t2.category_name = "restaurant" AND t4.name = "Patrick";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
[QUESTION]what is the best american restaurant in the bay area ?[/QUESTION] [SQL]SELECT t3.house_number , t1.name FROM restaurant AS t1 JOIN geographic AS t2 ON t1.city_name = t2.city_name JOIN LOCATION AS t3 ON t1.id = t3.restaurant_id WHERE t2.region = "bay area" AND t1.food_type = "american" AND t1.rating = ( SELECT MAX ( t1.rating ) FROM restaurant AS t1 JOIN geographic AS t2 ON t1.city_name = t2.city_name WHERE t2.region = "bay area" AND t1.food_type = "american" );[/SQL]
[QUESTION]what is the best american restaurant in the bay area ?[/QUESTION] [SQL]SELECT t3.house_number , t1.name FROM restaurant AS t1 JOIN geographic AS t2 ON t1.city_name = t2.city_name JOIN LOCATION AS t3 ON t1.id = t3.restaurant_id WHERE t2.region = "bay area" AND t1.food_type = "american" AND t1.rating = ( SELECT MAX ( t1.rating ) FROM restaurant AS t1 JOIN geographic AS t2 ON t1.city_name = t2.city_name WHERE t2.region = "bay area" AND t1.food_type = "american" );[/SQL]
flight_2
CREATE TABLE airlines ( uid INTEGER, "Airline" TEXT, "Abbreviation" TEXT, "Country" TEXT, PRIMARY KEY (uid) ) CREATE TABLE airports ( "City" TEXT, "AirportCode" TEXT, "AirportName" TEXT, "Country" TEXT, "CountryAbbrev" TEXT, PRIMARY KEY ("AirportCode") ) CREATE TABLE flights ( "Airline" INTEGER, "FlightNo" INTEGER, "SourceAirport" TEXT, "DestAirport" TEXT, PRIMARY KEY ("Airline", "FlightNo"), FOREIGN KEY("SourceAirport") REFERENCES airports ("AirportCode"), FOREIGN KEY("DestAirport") REFERENCES airports ("AirportCode") )
CREATE TABLE airlines ( uid INTEGER, "Airline" TEXT, "Abbreviation" TEXT, "Country" TEXT, PRIMARY KEY (uid) ) /* 2 rows from airlines table: uid Airline Abbreviation Country 1 United Airlines UAL USA 2 US Airways USAir USA */ CREATE TABLE airports ( "City" TEXT, "AirportCode" TEXT, "AirportName" TEXT, "Country" TEXT, "CountryAbbrev" TEXT, PRIMARY KEY ("AirportCode") ) /* 2 rows from airports table: City AirportCode AirportName Country CountryAbbrev Aberdeen APG Phillips AAF United States US Aberdeen ABR Municipal United States US */ CREATE TABLE flights ( "Airline" INTEGER, "FlightNo" INTEGER, "SourceAirport" TEXT, "DestAirport" TEXT, PRIMARY KEY ("Airline", "FlightNo"), FOREIGN KEY("SourceAirport") REFERENCES airports ("AirportCode"), FOREIGN KEY("DestAirport") REFERENCES airports ("AirportCode") ) /* 2 rows from flights table: Airline FlightNo SourceAirport DestAirport 1 28 APG ASY 1 29 ASY APG */
What is the code of airport that has the highest number of flights?
SELECT T1.AirportCode FROM AIRPORTS AS T1 JOIN FLIGHTS AS T2 ON T1.AirportCode = T2.DestAirport OR T1.AirportCode = T2.SourceAirport GROUP BY T1.AirportCode ORDER BY count(*) DESC LIMIT 1
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What is the number of flights?[/QUESTION] [SQL]SELECT count(*) FROM Flight[/SQL]
[QUESTION]What is the number of flights?[/QUESTION] [SQL]SELECT count(*) FROM Flight[/SQL]
[QUESTION]What is the number of flights?[/QUESTION] [SQL]SELECT count(*) FROM Flight[/SQL]
[QUESTION]What is the number of flights?[/QUESTION] [SQL]SELECT count(*) FROM Flight[/SQL]
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 */
Show member names without any registered branch.
SELECT name FROM member WHERE member_id NOT IN (SELECT member_id FROM membership_register_branch)
[{'Name': 'David Jones'}, {'Name': 'Matt Lentz'}]
Easy
false
false
false
false
false
false
false
false
false
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 */
Show all ministers and parties they belong to in descending order of the time they took office.
SELECT minister , party_name FROM party ORDER BY took_office DESC
[{'Minister': 'Ebenezer Ako-Adjei (MP)', 'Party_name': 'Sinefine Party'}, {'Minister': 'Imoru Egala (MP)', 'Party_name': 'Convention Union Party'}, {'Minister': 'Ebenezer Ako-Adjei (MP)', 'Party_name': '3'}, {'Minister': 'Kojo Botsio (MP)', 'Party_name': 'Progress Party'}, {'Minister': 'Dr. Kwame Nkrumah (MP)', 'Party_name': 'Convention Peoples Party'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
scientist_1
CREATE TABLE "AssignedTo" ( "Scientist" INTEGER NOT NULL, "Project" CHAR(4) NOT NULL, PRIMARY KEY ("Scientist", "Project"), FOREIGN KEY("Scientist") REFERENCES "Scientists" ("SSN"), FOREIGN KEY("Project") REFERENCES "Projects" ("Code") ) CREATE TABLE "Projects" ( "Code" CHAR(4), "Name" CHAR(50) NOT NULL, "Hours" INTEGER, PRIMARY KEY ("Code") ) CREATE TABLE "Scientists" ( "SSN" INTEGER, "Name" CHAR(30) NOT NULL, PRIMARY KEY ("SSN") )
CREATE TABLE "AssignedTo" ( "Scientist" INTEGER NOT NULL, "Project" CHAR(4) NOT NULL, PRIMARY KEY ("Scientist", "Project"), FOREIGN KEY("Scientist") REFERENCES "Scientists" ("SSN"), FOREIGN KEY("Project") REFERENCES "Projects" ("Code") ) /* 2 rows from AssignedTo table: Scientist Project 123234877 AeH1 152934485 AeH3 */ CREATE TABLE "Projects" ( "Code" CHAR(4), "Name" CHAR(50) NOT NULL, "Hours" INTEGER, PRIMARY KEY ("Code") ) /* 2 rows from Projects table: Code Name Hours AeH1 Winds: Studying Bernoullis Principle 156 AeH2 Aerodynamics and Bridge Design 189 */ CREATE TABLE "Scientists" ( "SSN" INTEGER, "Name" CHAR(30) NOT NULL, PRIMARY KEY ("SSN") ) /* 2 rows from Scientists table: SSN Name 123234877 Michael Rogers 152934485 Anand Manikutty */
Find the total hours of the projects that scientists named Michael Rogers or Carol Smith are assigned to.
SELECT sum(T2.hours) FROM assignedto AS T1 JOIN projects AS T2 ON T1.project = T2.code JOIN scientists AS T3 ON T1.scientist = T3.SSN WHERE T3.name = 'Michael Rogers' OR T3.name = 'Carol Smith'
[{'sum(T2.hours)': 6702}]
Hard
false
false
false
false
false
false
false
false
true
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 longitude of stations that never had bike availability more than 10?
SELECT avg(long) FROM station WHERE id NOT IN (SELECT station_id FROM status GROUP BY station_id HAVING max(bikes_available) > 10)
[{'avg(long)': -122.16748623913045}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
customers_and_products_contacts
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 "Contacts" ( contact_id INTEGER, customer_id INTEGER NOT NULL, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(50), contact_phone VARCHAR(80), PRIMARY KEY (contact_id) ) CREATE TABLE "Customer_Address_History" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME NOT NULL, date_to DATETIME, FOREIGN KEY(address_id) REFERENCES "Addresses" (address_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80), PRIMARY KEY (customer_id) ) CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, order_quantity VARCHAR(80), FOREIGN KEY(order_id) REFERENCES "Customer_Orders" (order_id), FOREIGN KEY(product_id) REFERENCES "Products" (product_id) ) CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_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 4315 Kerluke Canyon Apt. 800 Hertafurt 740 Nevada USA 2 319 Kozey Highway Suite 973 Edgardoberg 282 Colorado USA */ CREATE TABLE "Contacts" ( contact_id INTEGER, customer_id INTEGER NOT NULL, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(50), contact_phone VARCHAR(80), PRIMARY KEY (contact_id) ) /* 2 rows from Contacts table: contact_id customer_id gender first_name last_name contact_phone 1 4 male Cierra Collins +73(2)0854391820 2 6 male Jennifer Doyle 482-949-1364x17500 */ CREATE TABLE "Customer_Address_History" ( customer_id INTEGER NOT NULL, address_id INTEGER NOT NULL, date_from DATETIME 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_Address_History table: customer_id address_id date_from date_to 12 7 2015-07-23 14:37:18 2018-03-07 12:04:20 12 2 2016-11-06 14:33:12 2018-03-14 21:36:28 */ CREATE TABLE "Customer_Orders" ( order_id INTEGER, customer_id INTEGER NOT NULL, order_date DATETIME NOT NULL, order_status_code VARCHAR(15), PRIMARY KEY (order_id), FOREIGN KEY(customer_id) REFERENCES "Customers" (customer_id) ) /* 2 rows from Customer_Orders table: order_id customer_id order_date order_status_code 1 2 2009-07-19 13:40:49 Completed 2 2 1976-05-28 15:02:44 Part */ CREATE TABLE "Customers" ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number 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_number customer_name customer_address customer_phone customer_email 1 Credit Card 456 Kayley 636 Chanelle Isle Apt. 846 +87(9)5279161988 [email protected] 2 Credit Card 553 Sterling 12174 Boyer Crossroad 896.685.8228x2786 [email protected] */ CREATE TABLE "Order_Items" ( order_item_id INTEGER NOT NULL, order_id INTEGER NOT NULL, product_id INTEGER NOT NULL, 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: order_item_id order_id product_id order_quantity 1 9 15 3 2 8 12 7 */ CREATE TABLE "Products" ( product_id INTEGER, product_type_code VARCHAR(15), product_name VARCHAR(80), product_price DOUBLE, PRIMARY KEY (product_id) ) /* 2 rows from Products table: product_id product_type_code product_name product_price 1 Hardware Apple 54753982.574522 2 Clothes jcrew 30590929.528306 */
Show the product type codes which have at least two products.
SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2
[{'product_type_code': 'Clothes'}, {'product_type_code': 'Hardware'}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
[QUESTION]Show all template type codes with less than three templates.[/QUESTION] [SQL]SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING count(*) < 3[/SQL]
[QUESTION]Show all template type codes with less than three templates.[/QUESTION] [SQL]SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING count(*) < 3[/SQL]
[QUESTION]Show all template type codes with less than three templates.[/QUESTION] [SQL]SELECT template_type_code FROM Templates GROUP BY template_type_code HAVING count(*) < 3[/SQL]
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 */
List all information about courses sorted by credits in the ascending order.
SELECT * FROM COURSE ORDER BY Credits
[{'CID': '600.103', 'CName': 'INTRODUCTION TO COMPUTER SCIENCE', 'Credits': 1, 'Instructor': 4230, 'Days': 'Th', 'Hours': '4', 'DNO': 600}, {'CID': '600.303', 'CName': 'SUPERCOMPUTING', 'Credits': 1, 'Instructor': 9826, 'Days': 'W', 'Hours': '4-6:20', 'DNO': 600}, {'CID': '600.601', 'CName': 'COMPUTER SCIENCE SEMINAR', 'Credits': 1, 'Instructor': 6191, 'Days': 'ThF', 'Hours': '10:30-12', 'DNO': 600}, {'CID': '050.802', 'CName': 'RESEARCH SEMINAR IN COGNITIVE PROCESSES', 'Credits': 1, 'Instructor': 9011, 'Days': 'W', 'Hours': '1-3', 'DNO': 50}, {'CID': '550.790', 'CName': 'TOPICS IN APPLIED MATH', 'Credits': 2, 'Instructor': 2881, 'Days': 'MT', 'Hours': '4:30-6', 'DNO': 550}, {'CID': '600.101', 'CName': 'COMPUTER LITERACY', 'Credits': 3, 'Instructor': 6112, 'Days': 'MTW', 'Hours': '3', 'DNO': 600}, {'CID': '600.107', 'CName': 'INTRO TO PROGRAMMING IN JAVA', 'Credits': 3, 'Instructor': 1193, 'Days': 'MTW', 'Hours': '3', 'DNO': 600}, {'CID': '600.109', 'CName': 'INTRO TO PROGRAMMING IN C/C++', 'Credits': 3, 'Instructor': 4230, 'Days': 'MTW', 'Hours': '12', 'DNO': 600}, {'CID': '600.113', 'CName': 'EXPLORING THE INTERNET', 'Credits': 3, 'Instructor': 6112, 'Days': 'MTW', 'Hours': '4', 'DNO': 600}, {'CID': '600.121', 'CName': 'JAVA PROGRAMMING', 'Credits': 3, 'Instructor': 6112, 'Days': 'ThF', 'Hours': '10:30-12', 'DNO': 600}, {'CID': '600.211', 'CName': 'UNIX SYSTEMS PROGRAMMING', 'Credits': 3, 'Instructor': 6112, 'Days': 'ThF', 'Hours': '1-2:15', 'DNO': 600}, {'CID': '600.227', 'CName': 'DATA STRUCTURES in JAVA', 'Credits': 3, 'Instructor': 1121, 'Days': 'MTW', 'Hours': '9', 'DNO': 600}, {'CID': '600.232', 'CName': 'MULTIMEDIA COMPUTING', 'Credits': 3, 'Instructor': 9826, 'Days': 'MW', 'Hours': '1-2:30', 'DNO': 600}, {'CID': '600.271', 'CName': 'COMPUTATIONAL MODELS', 'Credits': 3, 'Instructor': 9172, 'Days': 'MTW', 'Hours': '1', 'DNO': 600}, {'CID': '600.315', 'CName': 'DATABASE SYSTEMS', 'Credits': 3, 'Instructor': 2192, 'Days': 'ThF', 'Hours': '2:30-4', 'DNO': 600}, {'CID': '600.333', 'CName': 'COMPUTER SYSTEM FUNDAMENTALS', 'Credits': 3, 'Instructor': 1148, 'Days': 'MTW', 'Hours': '8', 'DNO': 600}, {'CID': '600.337', 'CName': 'DISTRIBUTED SYSTEMS', 'Credits': 3, 'Instructor': 8918, 'Days': 'M', 'Hours': '3', 'DNO': 600}, {'CID': '600.363', 'CName': 'INTRODUCTION TO ALGORITHMS', 'Credits': 3, 'Instructor': 7712, 'Days': 'MTW', 'Hours': '9', 'DNO': 600}, {'CID': '600.415', 'CName': 'DATABASE SYSTEMS', 'Credits': 3, 'Instructor': 2192, 'Days': 'ThF', 'Hours': '2:30-4', 'DNO': 600}, {'CID': '600.433', 'CName': 'COMPUTER SYSTEMS', 'Credits': 3, 'Instructor': 1148, 'Days': 'MTW', 'Hours': '8', 'DNO': 600}, {'CID': '600.437', 'CName': 'DISTRIBUTED SYSTEMS', 'Credits': 3, 'Instructor': 8918, 'Days': 'M', 'Hours': '3', 'DNO': 600}, {'CID': '600.445', 'CName': 'QUANTITATIVE MEDICAL COMPUTING', 'Credits': 3, 'Instructor': 7723, 'Days': 'ThF', 'Hours': '1-2:15', 'DNO': 600}, {'CID': '600.461', 'CName': 'COMPUTER VISION', 'Credits': 3, 'Instructor': 8114, 'Days': 'MTW', 'Hours': '1', 'DNO': 600}, {'CID': '600.463', 'CName': 'ALGORITHMS I', 'Credits': 3, 'Instructor': 7712, 'Days': 'MTW', 'Hours': '9', 'DNO': 600}, {'CID': '600.465', 'CName': 'INTRO TO NATURAL LANGUAGE PROCESSING', 'Credits': 3, 'Instructor': 7792, 'Days': 'MTW', 'Hours': '2', 'DNO': 600}, {'CID': '600.509', 'CName': 'COMPUTER SCIENCE INTERNSHIP', 'Credits': 3, 'Instructor': 1121, 'Days': 'M', 'Hours': '1', 'DNO': 600}, {'CID': '600.657', 'CName': 'HIGH PERFORMANCE GRAPHICS AND MODELING', 'Credits': 3, 'Instructor': 8423, 'Days': 'M', 'Hours': '4-5:30', 'DNO': 600}, {'CID': '600.787', 'CName': 'SEMINAR ON COMPUTATIONAL GEOMETRY', 'Credits': 3, 'Instructor': 1121, 'Days': 'Th', 'Hours': '2', 'DNO': 600}, {'CID': '500.203', 'CName': 'ACCOUNTING I', 'Credits': 3, 'Instructor': 9823, 'Days': 'T', 'Hours': '6:15-8:45', 'DNO': 550}, {'CID': '500.204', 'CName': 'ACCOUNTING II', 'Credits': 3, 'Instructor': 9823, 'Days': 'Th', 'Hours': '6:15-8:45', 'DNO': 550}, {'CID': '500.205', 'CName': 'BUSINESS LAW I', 'Credits': 3, 'Instructor': 8791, 'Days': 'W', 'Hours': '6:15-8:45', 'DNO': 550}, {'CID': '500.206', 'CName': 'BUSINESS LAW II', 'Credits': 3, 'Instructor': 8791, 'Days': 'M', 'Hours': '6:15-8:45', 'DNO': 550}, {'CID': '550.620', 'CName': 'PROBABILITY THEORY I', 'Credits': 3, 'Instructor': 2738, 'Days': 'MTW', 'Hours': '2', 'DNO': 550}, {'CID': '550.626', 'CName': 'STOCHASTIC PROCESSES II', 'Credits': 3, 'Instructor': 8102, 'Days': 'MTW', 'Hours': '1', 'DNO': 550}, {'CID': '550.631', 'CName': 'STATISTICAL INFERENCE', 'Credits': 3, 'Instructor': 6182, 'Days': 'MTW', 'Hours': '3', 'DNO': 550}, {'CID': '550.661', 'CName': 'FOUNDATIONS OF OPTIMIZATION', 'Credits': 3, 'Instructor': 9823, 'Days': 'MTW', 'Hours': '10', 'DNO': 550}, {'CID': '550.671', 'CName': 'COMBINATORIAL ANALYSIS', 'Credits': 3, 'Instructor': 8772, 'Days': 'MTW', 'Hours': '12', 'DNO': 550}, {'CID': '550.681', 'CName': 'NUMERICAL ANALYSIS', 'Credits': 3, 'Instructor': 6541, 'Days': 'MTW', 'Hours': '11', 'DNO': 550}, {'CID': '550.721', 'CName': 'PERCOLATION THEORY', 'Credits': 3, 'Instructor': 8122, 'Days': 'MTW', 'Hours': '9', 'DNO': 550}, {'CID': '550.750', 'CName': 'TOPICS IN OPERATIONS RESEARCH', 'Credits': 3, 'Instructor': 9922, 'Days': 'MW', 'Hours': '3-4:30', 'DNO': 550}, {'CID': '520.137', 'CName': 'INTRODUCTION TO ECE', 'Credits': 3, 'Instructor': 8723, 'Days': 'MTW', 'Hours': '11', 'DNO': 520}, {'CID': '520.219', 'CName': 'FIELDS, MATTER AND WAVES', 'Credits': 3, 'Instructor': 9210, 'Days': 'MTW', 'Hours': '3', 'DNO': 520}, {'CID': '520.325', 'CName': 'INTEGRATED ELECTRONICS', 'Credits': 3, 'Instructor': 6191, 'Days': 'MTW', 'Hours': '3', 'DNO': 520}, {'CID': '520.345', 'CName': 'ECE LABORATORY', 'Credits': 3, 'Instructor': 1823, 'Days': 'W', 'Hours': '2', 'DNO': 520}, {'CID': '520.349', 'CName': 'MICROPROCESSOR LAB I', 'Credits': 3, 'Instructor': 9824, 'Days': 'Th', 'Hours': '8', 'DNO': 520}, {'CID': '520.353', 'CName': 'CONTROL SYSTEMS', 'Credits': 3, 'Instructor': 6925, 'Days': 'MTW', 'Hours': '10', 'DNO': 520}, {'CID': '520.401', 'CName': 'BASIC COMMUNICATIONS', 'Credits': 3, 'Instructor': 6191, 'Days': 'MTW', 'Hours': '1', 'DNO': 520}, {'CID': '520.410', 'CName': 'FIBER OPTICS AND PHOTONICS', 'Credits': 3, 'Instructor': 6191, 'Days': 'MTW', 'Hours': '1', 'DNO': 520}, {'CID': '520.419', 'CName': 'ITERATIVE ALGORITHMS', 'Credits': 3, 'Instructor': 2119, 'Days': 'MT', 'Hours': '4-5:15', 'DNO': 520}, {'CID': '520.421', 'CName': 'INTRODUCTION TO NON-LINEAR SYSTEMS', 'Credits': 3, 'Instructor': 7231, 'Days': 'MTW', 'Hours': '9', 'DNO': 520}, {'CID': '520.432', 'CName': 'TOPICS IN MEDICAL IMAGING SYSTEMS', 'Credits': 3, 'Instructor': 9514, 'Days': 'TTh', 'Hours': '8:30-10', 'DNO': 520}, {'CID': '520.475', 'CName': 'PROCESSING AND RECOGNITION OF SPEECH', 'Credits': 3, 'Instructor': 6330, 'Days': 'TW', 'Hours': '2-3:30', 'DNO': 520}, {'CID': '520.490', 'CName': 'ANALOG AND DIGITAL VLSI SYSTEMS', 'Credits': 3, 'Instructor': 8722, 'Days': 'ThF', 'Hours': '10:30-12', 'DNO': 520}, {'CID': '520.605', 'CName': 'SOLID STATE PHYSICS', 'Credits': 3, 'Instructor': 9379, 'Days': 'Tu', 'Hours': '1-4', 'DNO': 520}, {'CID': '520.609', 'CName': 'NONLINEAR TECHNICAL IMAGE PROCESSING', 'Credits': 3, 'Instructor': 7134, 'Days': 'Th', 'Hours': '1-4', 'DNO': 520}, {'CID': '520.651', 'CName': 'RANDOM SIGNAL ANALYSIS', 'Credits': 3, 'Instructor': 9514, 'Days': 'ThF', 'Hours': '10:30-12', 'DNO': 520}, {'CID': '050.102', 'CName': 'LANGUAGE AND MIND', 'Credits': 3, 'Instructor': 4432, 'Days': 'MTW', 'Hours': '10', 'DNO': 50}, {'CID': '050.109', 'CName': 'MIND, BRAIN, COMPUTERS', 'Credits': 3, 'Instructor': 6910, 'Days': 'MW', 'Hours': '2-3:15', 'DNO': 50}, {'CID': '050.325', 'CName': 'SOUND STRUCTURES IN NATURAL LANGUAGE', 'Credits': 3, 'Instructor': 4432, 'Days': 'T', 'Hours': '10-12', 'DNO': 50}, {'CID': '050.370', 'CName': 'FORMAL METHODS IN COGNITIVE SCIENCE', 'Credits': 3, 'Instructor': 6910, 'Days': 'MW', 'Hours': '11:30', 'DNO': 50}, {'CID': '050.381', 'CName': 'LANGUAGE DEVELOPMENT', 'Credits': 3, 'Instructor': 8989, 'Days': 'T', 'Hours': '1-3', 'DNO': 50}, {'CID': '050.427', 'CName': 'THE HISTORY OF ROMANCE LANGUAGES', 'Credits': 3, 'Instructor': 4432, 'Days': 'W', 'Hours': '1-3', 'DNO': 50}, {'CID': '050.670', 'CName': 'FORMAL METHODS IN COGNITIVE SCIENCE', 'Credits': 3, 'Instructor': 4432, 'Days': 'MW', 'Hours': '11:30-12:45', 'DNO': 50}, {'CID': '050.821', 'CName': 'COMP. MODELS OF SENTENCE PROCESSING', 'Credits': 3, 'Instructor': 5718, 'Days': 'M', 'Hours': '1-4', 'DNO': 50}, {'CID': '550.111', 'CName': 'STATISTICAL ANALYSIS', 'Credits': 4, 'Instructor': 2311, 'Days': 'MTW', 'Hours': '12', 'DNO': 550}, {'CID': '550.171', 'CName': 'DISCRETE MATHEMATICS', 'Credits': 4, 'Instructor': 8772, 'Days': 'MTW', 'Hours': '11', 'DNO': 550}, {'CID': '550.291', 'CName': 'LINEAR ALGEBRA AND DIFFERENTIAL EQNS', 'Credits': 4, 'Instructor': 6541, 'Days': 'MTW', 'Hours': '9', 'DNO': 550}, {'CID': '550.310', 'CName': 'PROBABILITY AND STATISTICS', 'Credits': 4, 'Instructor': 8102, 'Days': 'MTW', 'Hours': '10', 'DNO': 550}, {'CID': '550.361', 'CName': 'INTRODUCTION TO OPTIMIZATION', 'Credits': 4, 'Instructor': 2881, 'Days': 'MTW', 'Hours': '2', 'DNO': 550}, {'CID': '550.413', 'CName': 'APPLIED STATISTICS AND DATA ANALYSIS', 'Credits': 4, 'Instructor': 1177, 'Days': 'MTW', 'Hours': '11', 'DNO': 550}, {'CID': '550.420', 'CName': 'INTRODUCTION TO PROBABILITY', 'Credits': 4, 'Instructor': 2738, 'Days': 'MTW', 'Hours': '1', 'DNO': 550}, {'CID': '550.471', 'CName': 'COMBINATORIAL ANALYSIS', 'Credits': 4, 'Instructor': 8772, 'Days': 'MTW', 'Hours': '12', 'DNO': 550}, {'CID': '520.213', 'CName': 'CIRCUITS', 'Credits': 4, 'Instructor': 9210, 'Days': 'MTW', 'Hours': '2', 'DNO': 520}, {'CID': '520.435', 'CName': 'DIGITAL SIGNAL PROCESSING', 'Credits': 4, 'Instructor': 8118, 'Days': 'MTW', 'Hours': '11', 'DNO': 520}, {'CID': '520.603', 'CName': 'ELECTROMAGNETIC WAVES', 'Credits': 4, 'Instructor': 9210, 'Days': 'Th', 'Hours': '1-4:30', 'DNO': 520}, {'CID': '050.203', 'CName': 'COGNITIVE NEUROSCIENCE', 'Credits': 4, 'Instructor': 9011, 'Days': 'MT', 'Hours': '3:30-4:45', 'DNO': 50}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]Find the name of the department that offers the largest number of credits of all classes.[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
[QUESTION]Find the name of the department that offers the largest number of credits of all classes.[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
[QUESTION]Find the name of the department that offers the largest number of credits of all classes.[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/SQL]
[QUESTION]Find the name of the department that offers the largest number of credits of all classes.[/QUESTION] [SQL]SELECT T3.dept_name FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T1.dept_code = T3.dept_code GROUP BY T1.dept_code ORDER BY sum(T1.crs_credit) DESC LIMIT 1[/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 */
What are the unique types of player positions in the tryout?
SELECT count(DISTINCT pPos) FROM tryout
[{'count(DISTINCT pPos)': 3}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many players are there for each hand type?[/QUESTION] [SQL]SELECT count(*) , hand FROM players GROUP BY hand[/SQL]
[QUESTION]How many players are there for each hand type?[/QUESTION] [SQL]SELECT count(*) , hand FROM players GROUP BY hand[/SQL]
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 number of products for each manufacturer, showing the name of each company.
SELECT count(*) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name
[{'count(*)': 3, 'Name': 'Creative Labs'}, {'count(*)': 1, 'Name': 'Fujitsu'}, {'count(*)': 3, 'Name': 'Hewlett-Packard'}, {'count(*)': 1, 'Name': 'Iomega'}, {'count(*)': 1, 'Name': 'Sony'}, {'count(*)': 2, 'Name': 'Winchester'}]
Medium
false
false
false
false
false
true
false
true
false
false
false
false
false
[QUESTION]Find the number of employees hired in each shop; show the shop name as well.[/QUESTION] [SQL]SELECT count(*) , t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name[/SQL]
[QUESTION]Find the number of employees hired in each shop; show the shop name as well.[/QUESTION] [SQL]SELECT count(*) , t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name[/SQL]
[QUESTION]Find the number of employees hired in each shop; show the shop name as well.[/QUESTION] [SQL]SELECT count(*) , t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name[/SQL]
[QUESTION]Find the number of employees hired in each shop; show the shop name as well.[/QUESTION] [SQL]SELECT count(*) , t2.name FROM hiring AS t1 JOIN shop AS t2 ON t1.shop_id = t2.shop_id GROUP BY t2.name[/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 first and last name of the student who played the most sports?
SELECT T2.Fname , T2.Lname FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1
[{'Fname': 'David', 'LName': 'Shieber'}]
Medium
false
false
false
true
true
true
false
true
false
false
false
false
false
[QUESTION]What are the first names and birth dates of players from the USA?[/QUESTION] [SQL]SELECT first_name , birth_date FROM players WHERE country_code = 'USA'[/SQL]
[QUESTION]What are the first names and birth dates of players from the USA?[/QUESTION] [SQL]SELECT first_name , birth_date FROM players WHERE country_code = 'USA'[/SQL]
[QUESTION]What are the first names and birth dates of players from the USA?[/QUESTION] [SQL]SELECT first_name , birth_date FROM players WHERE country_code = 'USA'[/SQL]
[QUESTION]What are the first names and birth dates of players from the USA?[/QUESTION] [SQL]SELECT first_name , birth_date FROM players WHERE country_code = 'USA'[/SQL]
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 */
What is the maximum total amount paid by a customer? List the customer id and amount.
SELECT customer_id , sum(amount_paid) FROM Payments GROUP BY customer_id ORDER BY sum(amount_paid) DESC LIMIT 1
[{'customer_id': 12, 'sum(amount_paid)': 1000.6500000000001}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]Show the id and name of the employee with maximum salary.[/QUESTION] [SQL]SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1[/SQL]
[QUESTION]Show the id and name of the employee with maximum salary.[/QUESTION] [SQL]SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1[/SQL]
[QUESTION]Show the id and name of the employee with maximum salary.[/QUESTION] [SQL]SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1[/SQL]
[QUESTION]Show the id and name of the employee with maximum salary.[/QUESTION] [SQL]SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1[/SQL]
tracking_software_problems
CREATE TABLE "Problem_Category_Codes" ( problem_category_code VARCHAR(20), problem_category_description VARCHAR(80), PRIMARY KEY (problem_category_code) ) CREATE TABLE "Problem_Log" ( problem_log_id INTEGER, assigned_to_staff_id INTEGER NOT NULL, problem_id INTEGER NOT NULL, problem_category_code VARCHAR(20) NOT NULL, problem_status_code VARCHAR(20) NOT NULL, log_entry_date DATETIME, log_entry_description VARCHAR(255), log_entry_fix VARCHAR(255), other_log_details VARCHAR(255), PRIMARY KEY (problem_log_id), FOREIGN KEY(problem_status_code) REFERENCES "Problem_Status_Codes" (problem_status_code), FOREIGN KEY(problem_id) REFERENCES "Problems" (problem_id), FOREIGN KEY(assigned_to_staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(problem_category_code) REFERENCES "Problem_Category_Codes" (problem_category_code) ) CREATE TABLE "Problem_Status_Codes" ( problem_status_code VARCHAR(20), problem_status_description VARCHAR(80), PRIMARY KEY (problem_status_code) ) CREATE TABLE "Problems" ( problem_id INTEGER, product_id INTEGER NOT NULL, closure_authorised_by_staff_id INTEGER NOT NULL, reported_by_staff_id INTEGER NOT NULL, date_problem_reported DATETIME NOT NULL, date_problem_closed DATETIME, problem_description VARCHAR(255), other_problem_details VARCHAR(255), PRIMARY KEY (problem_id), FOREIGN KEY(reported_by_staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(product_id) REFERENCES "Product" (product_id), FOREIGN KEY(closure_authorised_by_staff_id) REFERENCES "Staff" (staff_id) ) CREATE TABLE "Product" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) CREATE TABLE "Staff" ( staff_id INTEGER, staff_first_name VARCHAR(80), staff_last_name VARCHAR(80), other_staff_details VARCHAR(255), PRIMARY KEY (staff_id) )
CREATE TABLE "Problem_Category_Codes" ( problem_category_code VARCHAR(20), problem_category_description VARCHAR(80), PRIMARY KEY (problem_category_code) ) /* 2 rows from Problem_Category_Codes table: problem_category_code problem_category_description Datatabase Database design or contents. GUI User Interface. */ CREATE TABLE "Problem_Log" ( problem_log_id INTEGER, assigned_to_staff_id INTEGER NOT NULL, problem_id INTEGER NOT NULL, problem_category_code VARCHAR(20) NOT NULL, problem_status_code VARCHAR(20) NOT NULL, log_entry_date DATETIME, log_entry_description VARCHAR(255), log_entry_fix VARCHAR(255), other_log_details VARCHAR(255), PRIMARY KEY (problem_log_id), FOREIGN KEY(problem_status_code) REFERENCES "Problem_Status_Codes" (problem_status_code), FOREIGN KEY(problem_id) REFERENCES "Problems" (problem_id), FOREIGN KEY(assigned_to_staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(problem_category_code) REFERENCES "Problem_Category_Codes" (problem_category_code) ) /* 2 rows from Problem_Log table: problem_log_id assigned_to_staff_id problem_id problem_category_code problem_status_code log_entry_date log_entry_description log_entry_fix other_log_details 1 11 11 Middleware Solved 2011-03-13 13:11:57 t k p 2 11 8 GUI Solved 1976-03-31 14:03:02 a k s */ CREATE TABLE "Problem_Status_Codes" ( problem_status_code VARCHAR(20), problem_status_description VARCHAR(80), PRIMARY KEY (problem_status_code) ) /* 2 rows from Problem_Status_Codes table: problem_status_code problem_status_description Reported Reported Solved Solved */ CREATE TABLE "Problems" ( problem_id INTEGER, product_id INTEGER NOT NULL, closure_authorised_by_staff_id INTEGER NOT NULL, reported_by_staff_id INTEGER NOT NULL, date_problem_reported DATETIME NOT NULL, date_problem_closed DATETIME, problem_description VARCHAR(255), other_problem_details VARCHAR(255), PRIMARY KEY (problem_id), FOREIGN KEY(reported_by_staff_id) REFERENCES "Staff" (staff_id), FOREIGN KEY(product_id) REFERENCES "Product" (product_id), FOREIGN KEY(closure_authorised_by_staff_id) REFERENCES "Staff" (staff_id) ) /* 2 rows from Problems table: problem_id product_id closure_authorised_by_staff_id reported_by_staff_id date_problem_reported date_problem_closed problem_description other_problem_details 1 4 4 2 1978-06-26 19:10:17 2012-07-22 19:24:26 x p 2 8 3 10 1988-11-07 16:09:31 1973-06-07 04:13:51 w p */ CREATE TABLE "Product" ( product_id INTEGER, product_name VARCHAR(80), product_details VARCHAR(255), PRIMARY KEY (product_id) ) /* 2 rows from Product table: product_id product_name product_details 1 rose k 2 yellow q */ CREATE TABLE "Staff" ( staff_id INTEGER, staff_first_name VARCHAR(80), staff_last_name VARCHAR(80), other_staff_details VARCHAR(255), PRIMARY KEY (staff_id) ) /* 2 rows from Staff table: staff_id staff_first_name staff_last_name other_staff_details 1 Lacey Bosco m 2 Dameon Frami x */
Which staff members are assigned to the problem with id 1? Give me their first and last names.
SELECT DISTINCT staff_first_name , staff_last_name FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T2.problem_id = 1
[{'staff_first_name': 'Stevie', 'staff_last_name': 'Mante'}, {'staff_first_name': 'Lysanne', 'staff_last_name': 'Turcotte'}, {'staff_first_name': 'Kristian', 'staff_last_name': 'Lynch'}]
Medium
true
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]Find the id and name of the museum that has the most staff members?[/QUESTION] [SQL]SELECT museum_id , name FROM museum ORDER BY num_of_staff DESC LIMIT 1[/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 */
Return the ids of all products that were ordered more than three times or supplied more than 80000.
SELECT product_id FROM Order_Items GROUP BY product_id HAVING count(*) > 3 UNION SELECT product_id FROM Product_Suppliers GROUP BY product_id HAVING sum(total_amount_purchased) > 80000
[{'product_id': 4}, {'product_id': 5}, {'product_id': 8}]
Hard
false
false
false
false
false
true
true
false
false
false
false
false
true
[QUESTION]Return the name, location and district of all shops in descending order of number of products.[/QUESTION] [SQL]SELECT name , LOCATION , district FROM shop ORDER BY number_products DESC[/SQL]
cre_Theme_park
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") )
CREATE TABLE "Features" ( "Feature_ID" INTEGER NOT NULL, "Feature_Details" VARCHAR(255), PRIMARY KEY ("Feature_ID") ) /* 2 rows from Features table: Feature_ID Feature_Details 523 cafe 528 park */ CREATE TABLE "Hotels" ( hotel_id INTEGER NOT NULL, star_rating_code CHAR(15) NOT NULL, pets_allowed_yn CHAR(1), price_range REAL, other_hotel_details VARCHAR(255), PRIMARY KEY (hotel_id), FOREIGN KEY(star_rating_code) REFERENCES "Ref_Hotel_Star_Ratings" (star_rating_code) ) /* 2 rows from Hotels table: hotel_id star_rating_code pets_allowed_yn price_range other_hotel_details 123 5 1 2914989.571 None 144 4 None */ CREATE TABLE "Locations" ( "Location_ID" INTEGER NOT NULL, "Location_Name" VARCHAR(255), "Address" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Location_ID") ) /* 2 rows from Locations table: Location_ID Location_Name Address Other_Details 333 Astro Orbiter 660 Shea Crescent None 368 African Animals 254 Ottilie Junction None */ CREATE TABLE "Museums" ( "Museum_ID" INTEGER NOT NULL, "Museum_Details" VARCHAR(255), PRIMARY KEY ("Museum_ID"), FOREIGN KEY("Museum_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Museums table: Museum_ID Museum_Details 2113 Yale Center for British Art 2701 The Metropolitan Museum of Art */ CREATE TABLE "Photos" ( "Photo_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(255), "Description" VARCHAR(255), "Filename" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Photo_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Photos table: Photo_ID Tourist_Attraction_ID Name Description Filename Other_Details 211 8449 game1 None 702 None 280 7067 game2 None 762 None */ CREATE TABLE "Ref_Attraction_Types" ( "Attraction_Type_Code" CHAR(15) NOT NULL, "Attraction_Type_Description" VARCHAR(255), PRIMARY KEY ("Attraction_Type_Code"), UNIQUE ("Attraction_Type_Code") ) /* 2 rows from Ref_Attraction_Types table: Attraction_Type_Code Attraction_Type_Description 2 park 3 garden */ CREATE TABLE "Ref_Hotel_Star_Ratings" ( star_rating_code CHAR(15) NOT NULL, star_rating_description VARCHAR(80), PRIMARY KEY (star_rating_code), UNIQUE (star_rating_code) ) /* 2 rows from Ref_Hotel_Star_Ratings table: star_rating_code star_rating_description 1 star 2 star */ CREATE TABLE "Royal_Family" ( "Royal_Family_ID" INTEGER NOT NULL, "Royal_Family_Details" VARCHAR(255), PRIMARY KEY ("Royal_Family_ID"), FOREIGN KEY("Royal_Family_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Royal_Family table: Royal_Family_ID Royal_Family_Details 9561 None 9919 None */ CREATE TABLE "Shops" ( "Shop_ID" INTEGER NOT NULL, "Shop_Details" VARCHAR(255), PRIMARY KEY ("Shop_ID"), FOREIGN KEY("Shop_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Shops table: Shop_ID Shop_Details 8429 soup 8449 coffee */ CREATE TABLE "Staff" ( "Staff_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Name" VARCHAR(40), "Other_Details" VARCHAR(255), PRIMARY KEY ("Staff_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Staff table: Staff_ID Tourist_Attraction_ID Name Other_Details 170 6476 Whitney None 219 6476 Kaela None */ CREATE TABLE "Street_Markets" ( "Market_ID" INTEGER NOT NULL, "Market_Details" VARCHAR(255), PRIMARY KEY ("Market_ID"), FOREIGN KEY("Market_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Street_Markets table: Market_ID Market_Details 6852 Broadway 7067 Fish Farm Market */ CREATE TABLE "Theme_Parks" ( "Theme_Park_ID" INTEGER NOT NULL, "Theme_Park_Details" VARCHAR(255), PRIMARY KEY ("Theme_Park_ID"), FOREIGN KEY("Theme_Park_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID") ) /* 2 rows from Theme_Parks table: Theme_Park_ID Theme_Park_Details 5265 Disney 6476 Sea World */ CREATE TABLE "Tourist_Attraction_Features" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Feature_ID" INTEGER NOT NULL, PRIMARY KEY ("Tourist_Attraction_ID", "Feature_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Feature_ID") REFERENCES "Features" ("Feature_ID") ) /* 2 rows from Tourist_Attraction_Features table: Tourist_Attraction_ID Feature_ID 5076 528 5076 681 */ CREATE TABLE "Tourist_Attractions" ( "Tourist_Attraction_ID" INTEGER NOT NULL, "Attraction_Type_Code" CHAR(15) NOT NULL, "Location_ID" INTEGER NOT NULL, "How_to_Get_There" VARCHAR(255), "Name" VARCHAR(255), "Description" VARCHAR(255), "Opening_Hours" VARCHAR(255), "Other_Details" VARCHAR(255), PRIMARY KEY ("Tourist_Attraction_ID"), FOREIGN KEY("Location_ID") REFERENCES "Locations" ("Location_ID"), FOREIGN KEY("Attraction_Type_Code") REFERENCES "Ref_Attraction_Types" ("Attraction_Type_Code") ) /* 2 rows from Tourist_Attractions table: Tourist_Attraction_ID Attraction_Type_Code Location_ID How_to_Get_There Name Description Opening_Hours Other_Details 2113 2 579 bus art museum None None None 2701 6 417 walk UK gallery None None None */ CREATE TABLE "Visitors" ( "Tourist_ID" INTEGER NOT NULL, "Tourist_Details" VARCHAR(255), PRIMARY KEY ("Tourist_ID"), UNIQUE ("Tourist_ID") ) /* 2 rows from Visitors table: Tourist_ID Tourist_Details 164 Toney 189 Graciela */ CREATE TABLE "Visits" ( "Visit_ID" INTEGER NOT NULL, "Tourist_Attraction_ID" INTEGER NOT NULL, "Tourist_ID" INTEGER NOT NULL, "Visit_Date" DATETIME NOT NULL, "Visit_Details" VARCHAR(40) NOT NULL, PRIMARY KEY ("Visit_ID"), FOREIGN KEY("Tourist_Attraction_ID") REFERENCES "Tourist_Attractions" ("Tourist_Attraction_ID"), FOREIGN KEY("Tourist_ID") REFERENCES "Visitors" ("Tourist_ID") ) /* 2 rows from Visits table: Visit_ID Tourist_Attraction_ID Tourist_ID Visit_Date Visit_Details 183 6653 377 2004-08-21 03:06:14 268 5076 204 2013-08-06 05:35:51 */
What are the distinct visit dates?
SELECT DISTINCT Visit_Date FROM VISITS
[{'Visit_Date': '2004-08-21 03:06:14'}, {'Visit_Date': '2013-08-06 05:35:51'}, {'Visit_Date': '2013-10-27 09:56:08'}, {'Visit_Date': '1990-08-15 14:24:10'}, {'Visit_Date': '1980-11-26 02:08:00'}, {'Visit_Date': '2017-03-19 08:48:19'}, {'Visit_Date': '2008-11-09 01:28:01'}, {'Visit_Date': '1989-08-24 20:26:37'}, {'Visit_Date': '1993-02-01 15:27:20'}, {'Visit_Date': '2007-09-17 10:12:45'}, {'Visit_Date': '1998-05-12 00:50:20'}, {'Visit_Date': '2010-10-04 01:34:12'}, {'Visit_Date': '2018-01-09 20:39:52'}, {'Visit_Date': '1971-12-16 06:41:26'}, {'Visit_Date': '1998-12-10 02:46:43'}, {'Visit_Date': '1996-01-08 13:23:41'}, {'Visit_Date': '2007-09-03 04:30:01'}, {'Visit_Date': '1974-12-31 23:18:24'}, {'Visit_Date': '2001-11-13 10:08:28'}, {'Visit_Date': '1990-11-12 00:54:50'}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many total tours were there for each ranking date?[/QUESTION] [SQL]SELECT sum(tours) , ranking_date FROM rankings GROUP BY ranking_date[/SQL]
[QUESTION]How many total tours were there for each ranking date?[/QUESTION] [SQL]SELECT sum(tours) , ranking_date FROM rankings GROUP BY ranking_date[/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 */
List the companies of entrepreneurs in descending order of money requested.
SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC
[{'Company': 'Umbrolly'}, {'Company': 'Grails Ltd'}, {'Company': 'Elizabeth Galton Ltd'}, {'Company': 'Mycorrhizal Systems'}, {'Company': 'Le Beanock'}, {'Company': 'IV Cam'}]
Easy
false
false
false
true
false
false
false
false
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]
aircraft
CREATE TABLE "match" ( "Round" REAL, "Location" TEXT, "Country" TEXT, "Date" TEXT, "Fastest_Qualifying" TEXT, "Winning_Pilot" TEXT, "Winning_Aircraft" TEXT, PRIMARY KEY ("Round"), FOREIGN KEY("Winning_Pilot") REFERENCES pilot ("Pilot_Id"), FOREIGN KEY("Winning_Aircraft") REFERENCES aircraft ("Aircraft_ID") ) CREATE TABLE aircraft ( "Aircraft_ID" INTEGER NOT NULL, "Aircraft" VARCHAR(50) NOT NULL, "Description" VARCHAR(50) NOT NULL, "Max_Gross_Weight" VARCHAR(50) NOT NULL, "Total_disk_area" VARCHAR(50) NOT NULL, "Max_disk_Loading" VARCHAR(50) NOT NULL, PRIMARY KEY ("Aircraft_ID") ) CREATE TABLE airport ( "Airport_ID" INTEGER, "Airport_Name" TEXT, "Total_Passengers" REAL, "%_Change_2007" TEXT, "International_Passengers" REAL, "Domestic_Passengers" REAL, "Transit_Passengers" REAL, "Aircraft_Movements" REAL, "Freight_Metric_Tonnes" REAL, PRIMARY KEY ("Airport_ID") ) CREATE TABLE airport_aircraft ( "ID" INTEGER, "Airport_ID" INTEGER, "Aircraft_ID" INTEGER, PRIMARY KEY ("Airport_ID", "Aircraft_ID"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Airport_ID") REFERENCES airport ("Airport_ID") ) CREATE TABLE pilot ( "Pilot_Id" INTEGER NOT NULL, "Name" VARCHAR(50) NOT NULL, "Age" INTEGER NOT NULL, PRIMARY KEY ("Pilot_Id") )
CREATE TABLE "match" ( "Round" REAL, "Location" TEXT, "Country" TEXT, "Date" TEXT, "Fastest_Qualifying" TEXT, "Winning_Pilot" TEXT, "Winning_Aircraft" TEXT, PRIMARY KEY ("Round"), FOREIGN KEY("Winning_Pilot") REFERENCES pilot ("Pilot_Id"), FOREIGN KEY("Winning_Aircraft") REFERENCES aircraft ("Aircraft_ID") ) /* 2 rows from match table: Round Location Country Date Fastest_Qualifying Winning_Pilot Winning_Aircraft 1.0 Mina' Zayid , Abu Dhabi United Arab Emirates March 26–27 Hannes Arch 1 1 2.0 Swan River , Perth Australia April 17–18 Paul Bonhomme 4 1 */ CREATE TABLE aircraft ( "Aircraft_ID" INTEGER NOT NULL, "Aircraft" VARCHAR(50) NOT NULL, "Description" VARCHAR(50) NOT NULL, "Max_Gross_Weight" VARCHAR(50) NOT NULL, "Total_disk_area" VARCHAR(50) NOT NULL, "Max_disk_Loading" VARCHAR(50) NOT NULL, PRIMARY KEY ("Aircraft_ID") ) /* 2 rows from aircraft table: Aircraft_ID Aircraft Description Max_Gross_Weight Total_disk_area Max_disk_Loading 1 Robinson R-22 Light utility helicopter 1,370 lb (635 kg) 497 ft² (46.2 m²) 2.6 lb/ft² (14 kg/m²) 2 Bell 206B3 JetRanger Turboshaft utility helicopter 3,200 lb (1,451 kg) 872 ft² (81.1 m²) 3.7 lb/ft² (18 kg/m²) */ CREATE TABLE airport ( "Airport_ID" INTEGER, "Airport_Name" TEXT, "Total_Passengers" REAL, "%_Change_2007" TEXT, "International_Passengers" REAL, "Domestic_Passengers" REAL, "Transit_Passengers" REAL, "Aircraft_Movements" REAL, "Freight_Metric_Tonnes" REAL, PRIMARY KEY ("Airport_ID") ) /* 2 rows from airport table: Airport_ID Airport_Name Total_Passengers %_Change_2007 International_Passengers Domestic_Passengers Transit_Passengers Aircraft_Movements Freight_Metric_Tonnes 1 London Heathrow 67054745.0 1.5% 61344438.0 5562516.0 147791.0 478693.0 1397054.0 2 London Gatwick 34205887.0 2.9% 30431051.0 3730963.0 43873.0 263653.0 107702.0 */ CREATE TABLE airport_aircraft ( "ID" INTEGER, "Airport_ID" INTEGER, "Aircraft_ID" INTEGER, PRIMARY KEY ("Airport_ID", "Aircraft_ID"), FOREIGN KEY("Aircraft_ID") REFERENCES aircraft ("Aircraft_ID"), FOREIGN KEY("Airport_ID") REFERENCES airport ("Airport_ID") ) /* 2 rows from airport_aircraft table: ID Airport_ID Aircraft_ID 1 6 5 2 2 1 */ CREATE TABLE pilot ( "Pilot_Id" INTEGER NOT NULL, "Name" VARCHAR(50) NOT NULL, "Age" INTEGER NOT NULL, PRIMARY KEY ("Pilot_Id") ) /* 2 rows from pilot table: Pilot_Id Name Age 1 Prof. Zackery Collins 23 2 Katheryn Gorczany IV 20 */
What is the number of aircraft?
SELECT count(*) FROM aircraft
[{'count(*)': 5}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]How many aircrafts do we have?[/QUESTION] [SQL]SELECT count(*) FROM Aircraft[/SQL]
[QUESTION]How many aircrafts do we have?[/QUESTION] [SQL]SELECT count(*) FROM Aircraft[/SQL]
[QUESTION]How many aircrafts do we have?[/QUESTION] [SQL]SELECT count(*) FROM Aircraft[/SQL]
[QUESTION]How many aircrafts do we have?[/QUESTION] [SQL]SELECT count(*) FROM Aircraft[/SQL]
machine_repair
CREATE TABLE machine ( "Machine_ID" INTEGER, "Making_Year" INTEGER, "Class" TEXT, "Team" TEXT, "Machine_series" TEXT, value_points REAL, quality_rank INTEGER, PRIMARY KEY ("Machine_ID") ) CREATE TABLE repair ( "repair_ID" INTEGER, name TEXT, "Launch_Date" TEXT, "Notes" TEXT, PRIMARY KEY ("repair_ID") ) CREATE TABLE repair_assignment ( technician_id INTEGER, "repair_ID" INTEGER, "Machine_ID" INTEGER, PRIMARY KEY (technician_id, "repair_ID", "Machine_ID"), FOREIGN KEY("Machine_ID") REFERENCES machine ("Machine_ID"), FOREIGN KEY("repair_ID") REFERENCES repair ("repair_ID"), FOREIGN KEY(technician_id) REFERENCES technician (technician_id) ) CREATE TABLE technician ( technician_id REAL, "Name" TEXT, "Team" TEXT, "Starting_Year" REAL, "Age" INTEGER, PRIMARY KEY (technician_id) )
CREATE TABLE machine ( "Machine_ID" INTEGER, "Making_Year" INTEGER, "Class" TEXT, "Team" TEXT, "Machine_series" TEXT, value_points REAL, quality_rank INTEGER, PRIMARY KEY ("Machine_ID") ) /* 2 rows from machine table: Machine_ID Making_Year Class Team Machine_series value_points quality_rank 1 1991 125cc Hero Sports TS- Honda RS125 105.0 2 2 1992 125cc Marlboro Pileri - Honda RS125 57.0 1 */ CREATE TABLE repair ( "repair_ID" INTEGER, name TEXT, "Launch_Date" TEXT, "Notes" TEXT, PRIMARY KEY ("repair_ID") ) /* 2 rows from repair table: repair_ID name Launch_Date Notes 1 Discoverer 21 Jan 2009 repair Failed. Failed to achieve orbit 2 Discoverer 1 28 Feb 2009 First object in polar orbit */ CREATE TABLE repair_assignment ( technician_id INTEGER, "repair_ID" INTEGER, "Machine_ID" INTEGER, PRIMARY KEY (technician_id, "repair_ID", "Machine_ID"), FOREIGN KEY("Machine_ID") REFERENCES machine ("Machine_ID"), FOREIGN KEY("repair_ID") REFERENCES repair ("repair_ID"), FOREIGN KEY(technician_id) REFERENCES technician (technician_id) ) /* 2 rows from repair_assignment table: technician_id repair_ID Machine_ID 1 1 1 2 2 2 */ CREATE TABLE technician ( technician_id REAL, "Name" TEXT, "Team" TEXT, "Starting_Year" REAL, "Age" INTEGER, PRIMARY KEY (technician_id) ) /* 2 rows from technician table: technician_id Name Team Starting_Year Age 1.0 Joe Sewell NYY 2012.0 37 2.0 John Brown NYY 2013.0 36 */
Show the team that have at least two technicians.
SELECT Team FROM technician GROUP BY Team HAVING COUNT(*) >= 2
[{'Team': 'CLE'}, {'Team': 'CWS'}, {'Team': 'NYY'}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
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 */
List the locations that are shared by more than two wrestlers.
SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2
[{'Location': 'Tijuana , Mexico'}, {'Location': 'Tokyo , Japan'}]
Easy
false
false
false
false
false
true
true
false
false
false
false
false
false
insurance_policies
CREATE TABLE "Claims" ( "Claim_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Date_Claim_Made" DATE, "Date_Claim_Settled" DATE, "Amount_Claimed" INTEGER, "Amount_Settled" INTEGER, PRIMARY KEY ("Claim_ID"), FOREIGN KEY("Policy_ID") REFERENCES "Customer_Policies" ("Policy_ID") ) CREATE TABLE "Customer_Policies" ( "Policy_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Policy_Type_Code" CHAR(15) NOT NULL, "Start_Date" DATE, "End_Date" DATE, PRIMARY KEY ("Policy_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) CREATE TABLE "Payments" ( "Payment_ID" INTEGER NOT NULL, "Settlement_ID" INTEGER NOT NULL, "Payment_Method_Code" VARCHAR(255), "Date_Payment_Made" DATE, "Amount_Payment" INTEGER, PRIMARY KEY ("Payment_ID"), FOREIGN KEY("Settlement_ID") REFERENCES "Settlements" ("Settlement_ID") ) CREATE TABLE "Settlements" ( "Settlement_ID" INTEGER NOT NULL, "Claim_ID" INTEGER NOT NULL, "Date_Claim_Made" DATE, "Date_Claim_Settled" DATE, "Amount_Claimed" INTEGER, "Amount_Settled" INTEGER, "Customer_Policy_ID" INTEGER NOT NULL, PRIMARY KEY ("Settlement_ID"), FOREIGN KEY("Claim_ID") REFERENCES "Claims" ("Claim_ID") )
CREATE TABLE "Claims" ( "Claim_ID" INTEGER NOT NULL, "Policy_ID" INTEGER NOT NULL, "Date_Claim_Made" DATE, "Date_Claim_Settled" DATE, "Amount_Claimed" INTEGER, "Amount_Settled" INTEGER, PRIMARY KEY ("Claim_ID"), FOREIGN KEY("Policy_ID") REFERENCES "Customer_Policies" ("Policy_ID") ) /* 2 rows from Claims table: Claim_ID Policy_ID Date_Claim_Made Date_Claim_Settled Amount_Claimed Amount_Settled 143 744 2017-03-11 2017-11-03 43884 1085 423 552 2016-08-12 2018-01-27 79134 1724 */ CREATE TABLE "Customer_Policies" ( "Policy_ID" INTEGER NOT NULL, "Customer_ID" INTEGER NOT NULL, "Policy_Type_Code" CHAR(15) NOT NULL, "Start_Date" DATE, "End_Date" DATE, PRIMARY KEY ("Policy_ID"), FOREIGN KEY("Customer_ID") REFERENCES "Customers" ("Customer_ID") ) /* 2 rows from Customer_Policies table: Policy_ID Customer_ID Policy_Type_Code Start_Date End_Date 119 1 Car 2018-01-21 2017-12-15 141 2 Life 2017-08-21 2017-09-29 */ CREATE TABLE "Customers" ( "Customer_ID" INTEGER NOT NULL, "Customer_Details" VARCHAR(255) NOT NULL, PRIMARY KEY ("Customer_ID") ) /* 2 rows from Customers table: Customer_ID Customer_Details 1 America Jaskolski 2 Ellsworth Paucek */ CREATE TABLE "Payments" ( "Payment_ID" INTEGER NOT NULL, "Settlement_ID" INTEGER NOT NULL, "Payment_Method_Code" VARCHAR(255), "Date_Payment_Made" DATE, "Amount_Payment" INTEGER, PRIMARY KEY ("Payment_ID"), FOREIGN KEY("Settlement_ID") REFERENCES "Settlements" ("Settlement_ID") ) /* 2 rows from Payments table: Payment_ID Settlement_ID Payment_Method_Code Date_Payment_Made Amount_Payment 384 516 MasterCard 2018-02-16 241730 435 476 MasterCard 2017-05-28 448613 */ CREATE TABLE "Settlements" ( "Settlement_ID" INTEGER NOT NULL, "Claim_ID" INTEGER NOT NULL, "Date_Claim_Made" DATE, "Date_Claim_Settled" DATE, "Amount_Claimed" INTEGER, "Amount_Settled" INTEGER, "Customer_Policy_ID" INTEGER NOT NULL, PRIMARY KEY ("Settlement_ID"), FOREIGN KEY("Claim_ID") REFERENCES "Claims" ("Claim_ID") ) /* 2 rows from Settlements table: Settlement_ID Claim_ID Date_Claim_Made Date_Claim_Settled Amount_Claimed Amount_Settled Customer_Policy_ID 357 486 2018-08-07 2018-01-16 38543 1181 515 412 621 2017-08-27 2018-02-04 57669 1427 617 */
List the details of the customers who do not have any policies.
SELECT customer_details FROM Customers EXCEPT SELECT T1.customer_details FROM Customers AS T1 JOIN Customer_Policies AS T2 ON T1.customer_id = T2.customer_id
[{'Customer_Details': 'Augustine Kerluke'}, {'Customer_Details': 'Buddy Marquardt'}, {'Customer_Details': 'Miss Felicita Reichel'}, {'Customer_Details': 'Mrs. Lilly Graham III'}]
Hard
false
false
false
false
false
false
false
true
false
false
false
true
false
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
document_management
CREATE TABLE "Document_Functional_Areas" ( document_code VARCHAR(15) NOT NULL, functional_area_code VARCHAR(15) NOT NULL, FOREIGN KEY(functional_area_code) REFERENCES "Functional_Areas" (functional_area_code), FOREIGN KEY(document_code) REFERENCES "Documents" (document_code) ) CREATE TABLE "Document_Sections" ( section_id INTEGER, document_code VARCHAR(15) NOT NULL, section_sequence INTEGER, section_code VARCHAR(20), section_title VARCHAR(80), PRIMARY KEY (section_id), FOREIGN KEY(document_code) REFERENCES "Documents" (document_code) ) CREATE TABLE "Document_Sections_Images" ( section_id INTEGER NOT NULL, image_id INTEGER NOT NULL, PRIMARY KEY (section_id, image_id), FOREIGN KEY(image_id) REFERENCES "Images" (image_id), FOREIGN KEY(section_id) REFERENCES "Document_Sections" (section_id) ) CREATE TABLE "Document_Structures" ( document_structure_code VARCHAR(15), parent_document_structure_code VARCHAR(15), document_structure_description VARCHAR(80), PRIMARY KEY (document_structure_code) ) CREATE TABLE "Documents" ( document_code VARCHAR(15), document_structure_code VARCHAR(15) NOT NULL, document_type_code VARCHAR(15) NOT NULL, access_count INTEGER, document_name VARCHAR(80), PRIMARY KEY (document_code), FOREIGN KEY(document_structure_code) REFERENCES "Document_Structures" (document_structure_code) ) CREATE TABLE "Functional_Areas" ( functional_area_code VARCHAR(15), parent_functional_area_code VARCHAR(15), functional_area_description VARCHAR(80) NOT NULL, PRIMARY KEY (functional_area_code) ) CREATE TABLE "Images" ( image_id INTEGER, image_alt_text VARCHAR(80), image_name VARCHAR(40), image_url VARCHAR(255), PRIMARY KEY (image_id) ) CREATE TABLE "Roles" ( role_code VARCHAR(15), role_description VARCHAR(80), PRIMARY KEY (role_code) ) CREATE TABLE "Users" ( user_id INTEGER, role_code VARCHAR(15) NOT NULL, user_name VARCHAR(40), user_login VARCHAR(40), password VARCHAR(40), PRIMARY KEY (user_id), FOREIGN KEY(role_code) REFERENCES "Roles" (role_code) )
CREATE TABLE "Document_Functional_Areas" ( document_code VARCHAR(15) NOT NULL, functional_area_code VARCHAR(15) NOT NULL, FOREIGN KEY(functional_area_code) REFERENCES "Functional_Areas" (functional_area_code), FOREIGN KEY(document_code) REFERENCES "Documents" (document_code) ) /* 2 rows from Document_Functional_Areas table: document_code functional_area_code 675 9 930 1 */ CREATE TABLE "Document_Sections" ( section_id INTEGER, document_code VARCHAR(15) NOT NULL, section_sequence INTEGER, section_code VARCHAR(20), section_title VARCHAR(80), PRIMARY KEY (section_id), FOREIGN KEY(document_code) REFERENCES "Documents" (document_code) ) /* 2 rows from Document_Sections table: section_id document_code section_sequence section_code section_title 12 714 6072 70 after 15 217 4510 14 after */ CREATE TABLE "Document_Sections_Images" ( section_id INTEGER NOT NULL, image_id INTEGER NOT NULL, PRIMARY KEY (section_id, image_id), FOREIGN KEY(image_id) REFERENCES "Images" (image_id), FOREIGN KEY(section_id) REFERENCES "Document_Sections" (section_id) ) /* 2 rows from Document_Sections_Images table: section_id image_id 93 6 86 2 */ CREATE TABLE "Document_Structures" ( document_structure_code VARCHAR(15), parent_document_structure_code VARCHAR(15), document_structure_description VARCHAR(80), PRIMARY KEY (document_structure_code) ) /* 2 rows from Document_Structures table: document_structure_code parent_document_structure_code document_structure_description 1 1 Header 6 1 Main section */ CREATE TABLE "Documents" ( document_code VARCHAR(15), document_structure_code VARCHAR(15) NOT NULL, document_type_code VARCHAR(15) NOT NULL, access_count INTEGER, document_name VARCHAR(80), PRIMARY KEY (document_code), FOREIGN KEY(document_structure_code) REFERENCES "Document_Structures" (document_structure_code) ) /* 2 rows from Documents table: document_code document_structure_code document_type_code access_count document_name 217 8 Book 1864 Learning English 621 1 Paper 8208 Research about Art history */ CREATE TABLE "Functional_Areas" ( functional_area_code VARCHAR(15), parent_functional_area_code VARCHAR(15), functional_area_description VARCHAR(80) NOT NULL, PRIMARY KEY (functional_area_code) ) /* 2 rows from Functional_Areas table: functional_area_code parent_functional_area_code functional_area_description 8 8 Signature 1 8 Acknowledgement */ CREATE TABLE "Images" ( image_id INTEGER, image_alt_text VARCHAR(80), image_name VARCHAR(40), image_url VARCHAR(255), PRIMARY KEY (image_id) ) /* 2 rows from Images table: image_id image_alt_text image_name image_url 1 Lea top1 http://www.rempelnader.com/1.jpg 2 Arden top2 http://connellykertzmann.org/1.jpg */ CREATE TABLE "Roles" ( role_code VARCHAR(15), role_description VARCHAR(80), PRIMARY KEY (role_code) ) /* 2 rows from Roles table: role_code role_description DBA Database Administrator PROJ-MGR Project Manager */ CREATE TABLE "Users" ( user_id INTEGER, role_code VARCHAR(15) NOT NULL, user_name VARCHAR(40), user_login VARCHAR(40), password VARCHAR(40), PRIMARY KEY (user_id), FOREIGN KEY(role_code) REFERENCES "Roles" (role_code) ) /* 2 rows from Users table: user_id role_code user_name user_login password 1 PROJ-MGR dickens.elta 0 e72b5a2d50b39a8760764a5f7a9d68ca2f076877 2 DBA tremblay.raheem 1 9bc25a040d5647ced5ec32e1a455e90fafc10bcb */
What is the average access count of documents that have the least common structure?
SELECT avg(access_count) FROM documents GROUP BY document_structure_code ORDER BY count(*) ASC LIMIT 1
[{'avg(access_count)': 7858.5}]
Easy
false
false
false
true
true
true
false
false
false
false
false
false
false
[QUESTION]How many documents do we have?[/QUESTION] [SQL]SELECT count(*) FROM Documents[/SQL]
[QUESTION]How many documents do we have?[/QUESTION] [SQL]SELECT count(*) FROM Documents[/SQL]
[QUESTION]How many documents do we have?[/QUESTION] [SQL]SELECT count(*) FROM Documents[/SQL]
[QUESTION]How many documents do we have?[/QUESTION] [SQL]SELECT count(*) FROM Documents[/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 */
What are the names of people in ascending alphabetical order?
SELECT Name FROM People ORDER BY Name ASC
[{'Name': 'Ashley Pérez Cabrera'}, {'Name': 'Clary Sermina Delgado Cid'}, {'Name': 'Elizabeth Quiñónez Aroyo'}, {'Name': 'Endis de los Santos Álvarez'}, {'Name': 'Eve Tatiana Cruz Oviedo'}, {'Name': 'Lorraine Súarez Carmona'}, {'Name': 'Marina Castro Medina'}, {'Name': 'Nadia Caba Rodríguez'}, {'Name': 'Paul Hamm'}, {'Name': 'Rosa Clarissa Ortíz Melo'}]
Easy
false
false
false
true
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
[QUESTION]What are the names and birth dates of people, ordered by their names in alphabetical order?[/QUESTION] [SQL]SELECT Name , Birth_Date FROM people ORDER BY Name ASC[/SQL]
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 */
What is the payment method code and party phone of the party with the email '[email protected]'?
SELECT payment_method_code , party_phone FROM parties WHERE party_email = "[email protected]"
[{'payment_method_code': 'Cheque', 'party_phone': '05374656172'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
products_gen_characteristics
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) )
CREATE TABLE "Characteristics" ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15) NOT NULL, characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255), PRIMARY KEY (characteristic_id), FOREIGN KEY(characteristic_type_code) REFERENCES "Ref_Characteristic_Types" (characteristic_type_code) ) /* 2 rows from Characteristics table: characteristic_id characteristic_type_code characteristic_data_type characteristic_name other_characteristic_details 1 Grade numquam slow None 2 Grade doloribus fast None */ CREATE TABLE "Product_Characteristics" ( product_id INTEGER NOT NULL, characteristic_id INTEGER NOT NULL, product_characteristic_value VARCHAR(50), FOREIGN KEY(product_id) REFERENCES "Products" (product_id), FOREIGN KEY(characteristic_id) REFERENCES "Characteristics" (characteristic_id) ) /* 2 rows from Product_Characteristics table: product_id characteristic_id product_characteristic_value 13 13 low 11 2 low */ CREATE TABLE "Products" ( product_id INTEGER, color_code VARCHAR(15) NOT NULL, product_category_code VARCHAR(15) NOT NULL, product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255), PRIMARY KEY (product_id), FOREIGN KEY(color_code) REFERENCES "Ref_Colors" (color_code), FOREIGN KEY(product_category_code) REFERENCES "Ref_Product_Categories" (product_category_code) ) /* 2 rows from Products table: product_id color_code product_category_code product_name typical_buying_price typical_selling_price product_description other_product_details 1 4 Spices cumin 2878.3 et None 2 2 Spices peper 352447.2874677 1892070.2803543 rerum None */ CREATE TABLE "Ref_Characteristic_Types" ( characteristic_type_code VARCHAR(15), characteristic_type_description VARCHAR(80), PRIMARY KEY (characteristic_type_code) ) /* 2 rows from Ref_Characteristic_Types table: characteristic_type_code characteristic_type_description Grade Grade Purity Purity */ CREATE TABLE "Ref_Colors" ( color_code VARCHAR(15), color_description VARCHAR(80), PRIMARY KEY (color_code) ) /* 2 rows from Ref_Colors table: color_code color_description 9 red 5 green */ CREATE TABLE "Ref_Product_Categories" ( product_category_code VARCHAR(15), product_category_description VARCHAR(80), unit_of_measure VARCHAR(20), PRIMARY KEY (product_category_code) ) /* 2 rows from Ref_Product_Categories table: product_category_code product_category_description unit_of_measure Herbs Herbs Handful Seeds Seeds Weight - pound,kilo. */
What are the descriptions for each color?
SELECT color_description FROM ref_colors
[{'color_description': 'red'}, {'color_description': 'green'}, {'color_description': 'yellow'}, {'color_description': 'blue'}, {'color_description': 'black'}, {'color_description': 'white'}, {'color_description': 'purple'}, {'color_description': 'gray'}]
Easy
false
false
false
false
false
false
false
false
false
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 */
Which city does has most number of customers?
SELECT T2.city FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id GROUP BY T2.city ORDER BY count(*) DESC LIMIT 1;
[{'city': 'South Richieport'}]
Medium
false
false
false
true
true
true
false
true
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]
[QUESTION]How many customers are there?[/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 */
datasets mentioned at ACL
SELECT DISTINCT t1.datasetid FROM paperdataset AS t2 JOIN dataset AS t1 ON t2.datasetid = t1.datasetid JOIN paper AS t3 ON t3.paperid = t2.paperid JOIN venue AS t4 ON t4.venueid = t3.venueid WHERE t4.venuename = "ACL";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
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 */
Parsing papers using Jeopardy! Questions published at ACL 2014
SELECT DISTINCT t2.paperid FROM paperdataset AS t3 JOIN dataset AS t5 ON t3.datasetid = t5.datasetid JOIN paperkeyphrase AS t4 ON t4.paperid = t3.paperid JOIN paper AS t2 ON t2.paperid = t3.paperid JOIN venue AS t6 ON t6.venueid = t2.venueid JOIN keyphrase AS t1 ON t4.keyphraseid = t1.keyphraseid WHERE t5.datasetname = "Jeopardy! Questions" AND t1.keyphrasename = "Parsing" AND t2.year = 2014 AND t6.venuename = "ACL";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
false
false
false
true
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 */
List the dates of enrollment and completion of the student with family name "Zieme" and personal name "Bernie".
SELECT T1.date_of_enrolment , T1.date_of_completion FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id WHERE T2.family_name = "Zieme" AND T2.personal_name = "Bernie"
[{'date_of_enrolment': '2017-10-10 10:05:03', 'date_of_completion': '2018-03-19 07:34:05'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]Which student has enrolled for the most times in any program? List the id, first name, middle name, last name, the number of enrollments and student id.[/QUESTION] [SQL]SELECT T1.student_id , T1.first_name , T1.middle_name , T1.last_name , count(*) , T1.student_id FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Which student has enrolled for the most times in any program? List the id, first name, middle name, last name, the number of enrollments and student id.[/QUESTION] [SQL]SELECT T1.student_id , T1.first_name , T1.middle_name , T1.last_name , count(*) , T1.student_id FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Which student has enrolled for the most times in any program? List the id, first name, middle name, last name, the number of enrollments and student id.[/QUESTION] [SQL]SELECT T1.student_id , T1.first_name , T1.middle_name , T1.last_name , count(*) , T1.student_id FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/SQL]
[QUESTION]Which student has enrolled for the most times in any program? List the id, first name, middle name, last name, the number of enrollments and student id.[/QUESTION] [SQL]SELECT T1.student_id , T1.first_name , T1.middle_name , T1.last_name , count(*) , T1.student_id FROM Students AS T1 JOIN Student_Enrolment AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1[/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 buildings which have rooms with capacity more than 50.
SELECT DISTINCT building FROM classroom WHERE capacity > 50
[{'building': 'Garfield'}, {'building': 'Gates'}, {'building': 'Lambeau'}, {'building': 'Nassau'}, {'building': 'Painter'}, {'building': 'Rathbone'}, {'building': 'Saucon'}, {'building': 'Stabler'}, {'building': 'Taylor'}, {'building': 'Whitman'}]
Easy
true
false
false
false
false
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]
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 */
Which apartments have bookings with both status codes "Provisional" and "Confirmed"? Give me the apartment numbers.
SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Confirmed" INTERSECT SELECT T2.apt_number FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T1.booking_status_code = "Provisional"
[{'apt_number': 'Apt. 859'}, {'apt_number': 'Suite 693'}, {'apt_number': 'Suite 749'}]
Hard
false
false
false
false
false
false
false
false
true
false
true
false
false
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 */
Who are the members of the club named "Bootup Baltimore"? Give me their last names.
SELECT t3.lname 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"
[{'LName': 'Smith'}, {'LName': 'Lee'}]
Hard
false
false
false
false
false
false
false
false
true
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 average population of the us by state
SELECT AVG ( population ) FROM state;
[{'AVG ( population )': None}]
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]
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 */
ACL papers with less than 5 citations
SELECT DISTINCT t3.citingpaperid FROM paper AS t1 JOIN cite AS t3 ON t1.paperid = t3.citedpaperid JOIN venue AS t2 ON t2.venueid = t1.venueid WHERE t2.venuename = "ACL" GROUP BY t3.citingpaperid HAVING COUNT ( DISTINCT t3.citedpaperid ) < 5;
[{'Nenhum': 'Nenhum resultado encontrado'}]
Hard
true
false
false
false
false
true
true
false
true
false
false
false
false
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 */
Find the distinct years when the governor was named "Eliot Spitzer".
SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer"
[{'Year': 2006.0}]
Easy
true
false
false
false
false
false
false
false
false
false
false
false
false
flight_company
CREATE TABLE airport ( id INTEGER, "City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, name TEXT, PRIMARY KEY (id) ) CREATE TABLE flight ( id INTEGER, "Vehicle_Flight_number" TEXT, "Date" TEXT, "Pilot" TEXT, "Velocity" REAL, "Altitude" REAL, airport_id INTEGER, company_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(company_id) REFERENCES operate_company (id), FOREIGN KEY(airport_id) REFERENCES airport (id) ) CREATE TABLE operate_company ( id INTEGER, name TEXT, "Type" TEXT, "Principal_activities" TEXT, "Incorporated_in" TEXT, "Group_Equity_Shareholding" REAL, PRIMARY KEY (id) )
CREATE TABLE airport ( id INTEGER, "City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, name TEXT, PRIMARY KEY (id) ) /* 2 rows from airport table: id City Country IATA ICAO name 1 Akureyri Iceland AEY BIAR Akureyri Airport 2 Amsterdam Netherlands AMS EHAM Schiphol Airport */ CREATE TABLE flight ( id INTEGER, "Vehicle_Flight_number" TEXT, "Date" TEXT, "Pilot" TEXT, "Velocity" REAL, "Altitude" REAL, airport_id INTEGER, company_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(company_id) REFERENCES operate_company (id), FOREIGN KEY(airport_id) REFERENCES airport (id) ) /* 2 rows from flight table: id Vehicle_Flight_number Date Pilot Velocity Altitude airport_id company_id 1 M2-F1 #0 March 1, 1963 Thompson 135.0 0.0 1 2 2 M2-F1 #1 August 16, 1963 Thompson 240.0 3650.0 2 3 */ CREATE TABLE operate_company ( id INTEGER, name TEXT, "Type" TEXT, "Principal_activities" TEXT, "Incorporated_in" TEXT, "Group_Equity_Shareholding" REAL, PRIMARY KEY (id) ) /* 2 rows from operate_company table: id name Type Principal_activities Incorporated_in Group_Equity_Shareholding 1 Air China Corporate Airline China 18.77 2 Air China Cargo Joint Venture Cargo airline China 49.0 */
What are the names and types of the companies that have ever operated a flight?
SELECT T1.name , T1.type FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id
[{'name': 'Air China Cargo', 'Type': 'Joint Venture'}, {'name': 'Air Hong Kong', 'Type': 'Joint Venture'}, {'name': 'Dragonair', 'Type': 'Subsidiary'}, {'name': 'Dragonair', 'Type': 'Subsidiary'}, {'name': 'Cathay Pacific Cargo', 'Type': 'Subsidiary'}, {'name': 'Cathay Pacific Catering Services (HK) Limited', 'Type': 'Subsidiary'}, {'name': 'Vogue Laundry Service Limited', 'Type': 'Subsidiary'}, {'name': 'VN/CX Catering Services Limited', 'Type': 'Joint Venture'}, {'name': 'Vogue Laundry Service Limited', 'Type': 'Subsidiary'}, {'name': 'Air China', 'Type': 'Corporate'}, {'name': 'Cathay Pacific Cargo', 'Type': 'Subsidiary'}, {'name': 'Cathay Pacific Services Limited', 'Type': 'Subsidiary'}, {'name': 'Dragonair Holidays', 'Type': 'Subsidiary'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
[QUESTION]What are the names for all aircrafts with at least 2 flights?[/QUESTION] [SQL]SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2[/SQL]
customers_card_transactions
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) )
CREATE TABLE "Accounts" ( account_id INTEGER, customer_id INTEGER NOT NULL, account_name VARCHAR(50), other_account_details VARCHAR(255), PRIMARY KEY (account_id) ) /* 2 rows from Accounts table: account_id customer_id account_name other_account_details 1 6 338 Regular 2 14 562 VIP */ CREATE TABLE "Customers" ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255), PRIMARY KEY (customer_id) ) /* 2 rows from Customers table: customer_id customer_first_name customer_last_name customer_address customer_phone customer_email other_customer_details 1 Aniyah Feest 55975 Theodore Estates Lake Brody, VT 57078 (673)872-5338 [email protected] None 2 Susie Wiza 6478 Moen Isle Suite 910 Schimmelmouth, VT 96364-4898 679-845-8645x94312 [email protected] None */ CREATE TABLE "Customers_Cards" ( card_id INTEGER, customer_id INTEGER NOT NULL, card_type_code VARCHAR(15) NOT NULL, card_number VARCHAR(80), date_valid_from DATETIME, date_valid_to DATETIME, other_card_details VARCHAR(255), PRIMARY KEY (card_id) ) /* 2 rows from Customers_Cards table: card_id customer_id card_type_code card_number date_valid_from date_valid_to other_card_details 1 14 Credit 4560596484842 2011-04-17 09:05:28 2018-03-07 17:06:19 5567915676420343 2 9 Credit 4859448397570735 2012-05-22 02:05:41 2018-02-25 15:43:32 4539333582760 */ CREATE TABLE "Financial_Transactions" ( transaction_id INTEGER NOT NULL, previous_transaction_id INTEGER, account_id INTEGER NOT NULL, card_id INTEGER NOT NULL, transaction_type VARCHAR(15) NOT NULL, transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255), FOREIGN KEY(account_id) REFERENCES "Accounts" (account_id), FOREIGN KEY(card_id) REFERENCES "Customers_Cards" (card_id) ) /* 2 rows from Financial_Transactions table: transaction_id previous_transaction_id account_id card_id transaction_type transaction_date transaction_amount transaction_comment other_transaction_details 1 925 15 1 Payment 2018-03-24 06:41:41 1701.23 None None 2 494 3 2 Refund 2018-03-24 12:08:55 1931.76 None None */
What are the full names of customers who do not have any accounts?
SELECT customer_first_name , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
[{'customer_first_name': 'Aniyah', 'customer_last_name': 'Feest'}, {'customer_first_name': 'Armani', 'customer_last_name': 'Farrell'}, {'customer_first_name': 'Frederic', 'customer_last_name': 'Swift'}, {'customer_first_name': 'Izabella', 'customer_last_name': 'Erdman'}, {'customer_first_name': 'Marcel', 'customer_last_name': 'Brekke'}, {'customer_first_name': 'Nat', 'customer_last_name': 'Davis'}]
Hard
false
false
false
false
false
false
false
true
false
false
false
true
false
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
[QUESTION]What are the names of customers who do not have saving accounts?[/QUESTION] [SQL]SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'[/SQL]
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 */
Find the average order quantity per order.
SELECT avg(order_quantity) FROM order_items
[{'avg(order_quantity)': 6.333333333333333}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]Find the names of stores whose number products is more than the average number of products.[/QUESTION] [SQL]SELECT name FROM shop WHERE number_products > (SELECT avg(number_products) FROM shop)[/SQL]
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 */
How many different industries are the companies in?
SELECT count(DISTINCT Industry) FROM Companies
[{'count(DISTINCT Industry)': 5}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names of all European countries with at least 3 manufacturers?[/QUESTION] [SQL]SELECT T1.CountryName FROM COUNTRIES AS T1 JOIN CONTINENTS AS T2 ON T1.Continent = T2.ContId JOIN CAR_MAKERS AS T3 ON T1.CountryId = T3.Country WHERE T2.Continent = 'europe' GROUP BY T1.CountryName HAVING count(*) >= 3;[/SQL]
[QUESTION]What are the names of all European countries with at least 3 manufacturers?[/QUESTION] [SQL]SELECT T1.CountryName FROM COUNTRIES AS T1 JOIN CONTINENTS AS T2 ON T1.Continent = T2.ContId JOIN CAR_MAKERS AS T3 ON T1.CountryId = T3.Country WHERE T2.Continent = 'europe' GROUP BY T1.CountryName HAVING count(*) >= 3;[/SQL]
[QUESTION]What are the names of all European countries with at least 3 manufacturers?[/QUESTION] [SQL]SELECT T1.CountryName FROM COUNTRIES AS T1 JOIN CONTINENTS AS T2 ON T1.Continent = T2.ContId JOIN CAR_MAKERS AS T3 ON T1.CountryId = T3.Country WHERE T2.Continent = 'europe' GROUP BY T1.CountryName HAVING count(*) >= 3;[/SQL]
[QUESTION]What are the names of all European countries with at least 3 manufacturers?[/QUESTION] [SQL]SELECT T1.CountryName FROM COUNTRIES AS T1 JOIN CONTINENTS AS T2 ON T1.Continent = T2.ContId JOIN CAR_MAKERS AS T3 ON T1.CountryId = T3.Country WHERE T2.Continent = 'europe' GROUP BY T1.CountryName HAVING count(*) >= 3;[/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 names of all video games that are collectible cards?
SELECT gname FROM Video_games WHERE gtype = "Collectible card game"
[{'GName': 'RNG Stone'}]
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 female friends of Alice.
SELECT T2.friend FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T2.name = 'Alice' AND T1.gender = 'female'
[{'Nenhum': 'Nenhum resultado encontrado'}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false
flight_company
CREATE TABLE airport ( id INTEGER, "City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, name TEXT, PRIMARY KEY (id) ) CREATE TABLE flight ( id INTEGER, "Vehicle_Flight_number" TEXT, "Date" TEXT, "Pilot" TEXT, "Velocity" REAL, "Altitude" REAL, airport_id INTEGER, company_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(company_id) REFERENCES operate_company (id), FOREIGN KEY(airport_id) REFERENCES airport (id) ) CREATE TABLE operate_company ( id INTEGER, name TEXT, "Type" TEXT, "Principal_activities" TEXT, "Incorporated_in" TEXT, "Group_Equity_Shareholding" REAL, PRIMARY KEY (id) )
CREATE TABLE airport ( id INTEGER, "City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, name TEXT, PRIMARY KEY (id) ) /* 2 rows from airport table: id City Country IATA ICAO name 1 Akureyri Iceland AEY BIAR Akureyri Airport 2 Amsterdam Netherlands AMS EHAM Schiphol Airport */ CREATE TABLE flight ( id INTEGER, "Vehicle_Flight_number" TEXT, "Date" TEXT, "Pilot" TEXT, "Velocity" REAL, "Altitude" REAL, airport_id INTEGER, company_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(company_id) REFERENCES operate_company (id), FOREIGN KEY(airport_id) REFERENCES airport (id) ) /* 2 rows from flight table: id Vehicle_Flight_number Date Pilot Velocity Altitude airport_id company_id 1 M2-F1 #0 March 1, 1963 Thompson 135.0 0.0 1 2 2 M2-F1 #1 August 16, 1963 Thompson 240.0 3650.0 2 3 */ CREATE TABLE operate_company ( id INTEGER, name TEXT, "Type" TEXT, "Principal_activities" TEXT, "Incorporated_in" TEXT, "Group_Equity_Shareholding" REAL, PRIMARY KEY (id) ) /* 2 rows from operate_company table: id name Type Principal_activities Incorporated_in Group_Equity_Shareholding 1 Air China Corporate Airline China 18.77 2 Air China Cargo Joint Venture Cargo airline China 49.0 */
How many companies operates airlines in each airport?
SELECT T3.id , count(*) FROM operate_company AS T1 JOIN flight AS t2 ON T1.id = T2.company_id JOIN airport AS T3 ON T2.airport_id = T3.id GROUP BY T3.id
[{'id': 1, 'count(*)': 1}, {'id': 2, 'count(*)': 3}, {'id': 3, 'count(*)': 1}, {'id': 4, 'count(*)': 3}, {'id': 5, 'count(*)': 1}, {'id': 6, 'count(*)': 2}, {'id': 8, 'count(*)': 1}, {'id': 9, 'count(*)': 1}]
Hard
false
false
false
false
false
true
false
false
true
false
false
false
false
[QUESTION]How many airlines do we have?[/QUESTION] [SQL]SELECT count(*) FROM AIRLINES[/SQL]
[QUESTION]How many airlines do we have?[/QUESTION] [SQL]SELECT count(*) FROM AIRLINES[/SQL]
[QUESTION]How many airlines do we have?[/QUESTION] [SQL]SELECT count(*) FROM AIRLINES[/SQL]
[QUESTION]How many airlines do we have?[/QUESTION] [SQL]SELECT count(*) FROM AIRLINES[/SQL]
journal_committee
CREATE TABLE editor ( "Editor_ID" INTEGER, "Name" TEXT, "Age" REAL, PRIMARY KEY ("Editor_ID") ) CREATE TABLE journal ( "Journal_ID" INTEGER, "Date" TEXT, "Theme" TEXT, "Sales" INTEGER, PRIMARY KEY ("Journal_ID") ) CREATE TABLE journal_committee ( "Editor_ID" INTEGER, "Journal_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("Editor_ID", "Journal_ID"), FOREIGN KEY("Journal_ID") REFERENCES journal ("Journal_ID"), FOREIGN KEY("Editor_ID") REFERENCES editor ("Editor_ID") )
CREATE TABLE editor ( "Editor_ID" INTEGER, "Name" TEXT, "Age" REAL, PRIMARY KEY ("Editor_ID") ) /* 2 rows from editor table: Editor_ID Name Age 1 Kamila Porczyk 34.0 2 Anna Powierza 35.0 */ CREATE TABLE journal ( "Journal_ID" INTEGER, "Date" TEXT, "Theme" TEXT, "Sales" INTEGER, PRIMARY KEY ("Journal_ID") ) /* 2 rows from journal table: Journal_ID Date Theme Sales 1 September 9, 2001 Miami Dolphins 798 2 September 23, 2001 at Jacksonville Jaguars 994 */ CREATE TABLE journal_committee ( "Editor_ID" INTEGER, "Journal_ID" INTEGER, "Work_Type" TEXT, PRIMARY KEY ("Editor_ID", "Journal_ID"), FOREIGN KEY("Journal_ID") REFERENCES journal ("Journal_ID"), FOREIGN KEY("Editor_ID") REFERENCES editor ("Editor_ID") ) /* 2 rows from journal_committee table: Editor_ID Journal_ID Work_Type 1 13 Photo 8 17 Article */
Show the names of editors that are on the committee of journals with sales bigger than 3000.
SELECT T2.Name FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000
[{'Name': 'Kamila Porczyk'}, {'Name': 'Władysław Grzywna'}, {'Name': 'Grażyna Wolszczak'}, {'Name': 'Grażyna Wolszczak'}, {'Name': 'Maria Góralczyk'}]
Hard
false
false
false
false
false
false
false
false
true
false
false
false
false
concert_singer
CREATE TABLE concert ( "concert_ID" INTEGER, "concert_Name" TEXT, "Theme" TEXT, "Stadium_ID" TEXT, "Year" TEXT, PRIMARY KEY ("concert_ID"), FOREIGN KEY("Stadium_ID") REFERENCES stadium ("Stadium_ID") ) CREATE TABLE singer ( "Singer_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Song_Name" TEXT, "Song_release_year" TEXT, "Age" INTEGER, "Is_male" BOOLEAN, PRIMARY KEY ("Singer_ID") ) CREATE TABLE singer_in_concert ( "concert_ID" INTEGER, "Singer_ID" TEXT, PRIMARY KEY ("concert_ID", "Singer_ID"), FOREIGN KEY("concert_ID") REFERENCES concert ("concert_ID"), FOREIGN KEY("Singer_ID") REFERENCES singer ("Singer_ID") ) CREATE TABLE stadium ( "Stadium_ID" INTEGER, "Location" TEXT, "Name" TEXT, "Capacity" INTEGER, "Highest" INTEGER, "Lowest" INTEGER, "Average" INTEGER, PRIMARY KEY ("Stadium_ID") )
CREATE TABLE concert ( "concert_ID" INTEGER, "concert_Name" TEXT, "Theme" TEXT, "Stadium_ID" TEXT, "Year" TEXT, PRIMARY KEY ("concert_ID"), FOREIGN KEY("Stadium_ID") REFERENCES stadium ("Stadium_ID") ) /* 2 rows from concert table: concert_ID concert_Name Theme Stadium_ID Year 1 Auditions Free choice 1 2014 2 Super bootcamp Free choice 2 2 2014 */ CREATE TABLE singer ( "Singer_ID" INTEGER, "Name" TEXT, "Country" TEXT, "Song_Name" TEXT, "Song_release_year" TEXT, "Age" INTEGER, "Is_male" BOOLEAN, PRIMARY KEY ("Singer_ID") ) /* 2 rows from singer table: Singer_ID Name Country Song_Name Song_release_year Age Is_male 1 Joe Sharp Netherlands You 1992 52 True 2 Timbaland United States Dangerous 2008 32 True */ CREATE TABLE singer_in_concert ( "concert_ID" INTEGER, "Singer_ID" TEXT, PRIMARY KEY ("concert_ID", "Singer_ID"), FOREIGN KEY("concert_ID") REFERENCES concert ("concert_ID"), FOREIGN KEY("Singer_ID") REFERENCES singer ("Singer_ID") ) /* 2 rows from singer_in_concert table: concert_ID Singer_ID 1 2 1 3 */ CREATE TABLE stadium ( "Stadium_ID" INTEGER, "Location" TEXT, "Name" TEXT, "Capacity" INTEGER, "Highest" INTEGER, "Lowest" INTEGER, "Average" INTEGER, PRIMARY KEY ("Stadium_ID") ) /* 2 rows from stadium table: Stadium_ID Location Name Capacity Highest Lowest Average 1 Raith Rovers Stark's Park 10104 4812 1294 2106 2 Ayr United Somerset Park 11998 2363 1057 1477 */
What are all the song names by singers who are older than average?
SELECT song_name FROM singer WHERE age > (SELECT avg(age) FROM singer)
[{'Song_Name': 'You'}, {'Song_Name': 'Sun'}, {'Song_Name': 'Gentleman'}]
Easy
false
false
false
false
false
false
false
false
false
false
false
false
false
[QUESTION]What are the names of the singers that have more than one songs?[/QUESTION] [SQL]SELECT T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1[/SQL]
[QUESTION]What are the names of the singers that have more than one songs?[/QUESTION] [SQL]SELECT T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1[/SQL]
[QUESTION]What are the names of the singers that have more than one songs?[/QUESTION] [SQL]SELECT T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1[/SQL]
[QUESTION]What are the names of the singers that have more than one songs?[/QUESTION] [SQL]SELECT T1.Name FROM singer AS T1 JOIN song AS T2 ON T1.Singer_ID = T2.Singer_ID GROUP BY T1.Name HAVING COUNT(*) > 1[/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 wyoming city has the largest population
SELECT city_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "wyoming" ) AND state_name = "wyoming";
[{'Nenhum': 'Nenhum resultado encontrado'}]
Extra Hard
false
false
false
false
false
false
false
false
false
true
false
false
false
[QUESTION]which state is the largest city in montana in[/QUESTION] [SQL]SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "montana" ) AND state_name = "montana";[/SQL]
[QUESTION]which state is the largest city in montana in[/QUESTION] [SQL]SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "montana" ) AND state_name = "montana";[/SQL]
[QUESTION]which state is the largest city in montana in[/QUESTION] [SQL]SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "montana" ) AND state_name = "montana";[/SQL]
[QUESTION]which state is the largest city in montana in[/QUESTION] [SQL]SELECT state_name FROM city WHERE population = ( SELECT MAX ( population ) FROM city WHERE state_name = "montana" ) AND state_name = "montana";[/SQL]
chinook_1
CREATE TABLE "Album" ( "AlbumId" INTEGER NOT NULL, "Title" VARCHAR(160) NOT NULL, "ArtistId" INTEGER NOT NULL, PRIMARY KEY ("AlbumId"), FOREIGN KEY("ArtistId") REFERENCES "Artist" ("ArtistId") ) CREATE TABLE "Artist" ( "ArtistId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("ArtistId") ) CREATE TABLE "Customer" ( "CustomerId" INTEGER NOT NULL, "FirstName" VARCHAR(40) NOT NULL, "LastName" VARCHAR(20) NOT NULL, "Company" VARCHAR(80) DEFAULT NULL, "Address" VARCHAR(70) DEFAULT NULL, "City" VARCHAR(40) DEFAULT NULL, "State" VARCHAR(40) DEFAULT NULL, "Country" VARCHAR(40) DEFAULT NULL, "PostalCode" VARCHAR(10) DEFAULT NULL, "Phone" VARCHAR(24) DEFAULT NULL, "Fax" VARCHAR(24) DEFAULT NULL, "Email" VARCHAR(60) NOT NULL, "SupportRepId" INTEGER DEFAULT NULL, PRIMARY KEY ("CustomerId"), FOREIGN KEY("SupportRepId") REFERENCES "Employee" ("EmployeeId") ) CREATE TABLE "Employee" ( "EmployeeId" INTEGER NOT NULL, "LastName" VARCHAR(20) NOT NULL, "FirstName" VARCHAR(20) NOT NULL, "Title" VARCHAR(30) DEFAULT NULL, "ReportsTo" INTEGER DEFAULT NULL, "BirthDate" DATETIME DEFAULT NULL, "HireDate" DATETIME DEFAULT NULL, "Address" VARCHAR(70) DEFAULT NULL, "City" VARCHAR(40) DEFAULT NULL, "State" VARCHAR(40) DEFAULT NULL, "Country" VARCHAR(40) DEFAULT NULL, "PostalCode" VARCHAR(10) DEFAULT NULL, "Phone" VARCHAR(24) DEFAULT NULL, "Fax" VARCHAR(24) DEFAULT NULL, "Email" VARCHAR(60) DEFAULT NULL, PRIMARY KEY ("EmployeeId"), FOREIGN KEY("ReportsTo") REFERENCES "Employee" ("EmployeeId") ) CREATE TABLE "Genre" ( "GenreId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("GenreId") ) CREATE TABLE "Invoice" ( "InvoiceId" INTEGER NOT NULL, "CustomerId" INTEGER NOT NULL, "InvoiceDate" DATETIME NOT NULL, "BillingAddress" VARCHAR(70) DEFAULT NULL, "BillingCity" VARCHAR(40) DEFAULT NULL, "BillingState" VARCHAR(40) DEFAULT NULL, "BillingCountry" VARCHAR(40) DEFAULT NULL, "BillingPostalCode" VARCHAR(10) DEFAULT NULL, "Total" DECIMAL(10, 2) NOT NULL, PRIMARY KEY ("InvoiceId"), FOREIGN KEY("CustomerId") REFERENCES "Customer" ("CustomerId") ) CREATE TABLE "InvoiceLine" ( "InvoiceLineId" INTEGER NOT NULL, "InvoiceId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, "UnitPrice" DECIMAL(10, 2) NOT NULL, "Quantity" INTEGER NOT NULL, PRIMARY KEY ("InvoiceLineId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("InvoiceId") REFERENCES "Invoice" ("InvoiceId") ) CREATE TABLE "MediaType" ( "MediaTypeId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("MediaTypeId") ) CREATE TABLE "Playlist" ( "PlaylistId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("PlaylistId") ) CREATE TABLE "PlaylistTrack" ( "PlaylistId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, PRIMARY KEY ("PlaylistId", "TrackId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId") ) CREATE TABLE "Track" ( "TrackId" INTEGER NOT NULL, "Name" VARCHAR(200) NOT NULL, "AlbumId" INTEGER DEFAULT NULL, "MediaTypeId" INTEGER NOT NULL, "GenreId" INTEGER DEFAULT NULL, "Composer" VARCHAR(220) DEFAULT NULL, "Milliseconds" INTEGER NOT NULL, "Bytes" INTEGER DEFAULT NULL, "UnitPrice" DECIMAL(10, 2) NOT NULL, PRIMARY KEY ("TrackId"), FOREIGN KEY("MediaTypeId") REFERENCES "MediaType" ("MediaTypeId"), FOREIGN KEY("GenreId") REFERENCES "Genre" ("GenreId"), FOREIGN KEY("AlbumId") REFERENCES "Album" ("AlbumId") )
CREATE TABLE "Album" ( "AlbumId" INTEGER NOT NULL, "Title" VARCHAR(160) NOT NULL, "ArtistId" INTEGER NOT NULL, PRIMARY KEY ("AlbumId"), FOREIGN KEY("ArtistId") REFERENCES "Artist" ("ArtistId") ) /* 2 rows from Album table: AlbumId Title ArtistId 1 For Those About To Rock We Salute You 1 2 Balls to the Wall 2 */ CREATE TABLE "Artist" ( "ArtistId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("ArtistId") ) /* 2 rows from Artist table: ArtistId Name 1 AC/DC 2 Accept */ CREATE TABLE "Customer" ( "CustomerId" INTEGER NOT NULL, "FirstName" VARCHAR(40) NOT NULL, "LastName" VARCHAR(20) NOT NULL, "Company" VARCHAR(80) DEFAULT NULL, "Address" VARCHAR(70) DEFAULT NULL, "City" VARCHAR(40) DEFAULT NULL, "State" VARCHAR(40) DEFAULT NULL, "Country" VARCHAR(40) DEFAULT NULL, "PostalCode" VARCHAR(10) DEFAULT NULL, "Phone" VARCHAR(24) DEFAULT NULL, "Fax" VARCHAR(24) DEFAULT NULL, "Email" VARCHAR(60) NOT NULL, "SupportRepId" INTEGER DEFAULT NULL, PRIMARY KEY ("CustomerId"), FOREIGN KEY("SupportRepId") REFERENCES "Employee" ("EmployeeId") ) /* 2 rows from Customer table: CustomerId FirstName LastName Company Address City State Country PostalCode Phone Fax Email SupportRepId 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 "Employee" ( "EmployeeId" INTEGER NOT NULL, "LastName" VARCHAR(20) NOT NULL, "FirstName" VARCHAR(20) NOT NULL, "Title" VARCHAR(30) DEFAULT NULL, "ReportsTo" INTEGER DEFAULT NULL, "BirthDate" DATETIME DEFAULT NULL, "HireDate" DATETIME DEFAULT NULL, "Address" VARCHAR(70) DEFAULT NULL, "City" VARCHAR(40) DEFAULT NULL, "State" VARCHAR(40) DEFAULT NULL, "Country" VARCHAR(40) DEFAULT NULL, "PostalCode" VARCHAR(10) DEFAULT NULL, "Phone" VARCHAR(24) DEFAULT NULL, "Fax" VARCHAR(24) DEFAULT NULL, "Email" VARCHAR(60) DEFAULT NULL, PRIMARY KEY ("EmployeeId"), FOREIGN KEY("ReportsTo") REFERENCES "Employee" ("EmployeeId") ) /* 2 rows from Employee table: EmployeeId LastName FirstName Title ReportsTo BirthDate HireDate Address City State Country PostalCode 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 "Genre" ( "GenreId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("GenreId") ) /* 2 rows from Genre table: GenreId Name 1 Rock 2 Jazz */ CREATE TABLE "Invoice" ( "InvoiceId" INTEGER NOT NULL, "CustomerId" INTEGER NOT NULL, "InvoiceDate" DATETIME NOT NULL, "BillingAddress" VARCHAR(70) DEFAULT NULL, "BillingCity" VARCHAR(40) DEFAULT NULL, "BillingState" VARCHAR(40) DEFAULT NULL, "BillingCountry" VARCHAR(40) DEFAULT NULL, "BillingPostalCode" VARCHAR(10) DEFAULT NULL, "Total" DECIMAL(10, 2) NOT NULL, PRIMARY KEY ("InvoiceId"), FOREIGN KEY("CustomerId") REFERENCES "Customer" ("CustomerId") ) /* 2 rows from Invoice table: InvoiceId CustomerId InvoiceDate BillingAddress BillingCity BillingState BillingCountry BillingPostalCode Total 1 2 2009-01-01 00:00:00 Theodor-Heuss-Straße 34 Stuttgart None Germany 70174 1.98 2 4 2009-01-02 00:00:00 Ullevålsveien 14 Oslo None Norway 0171 3.96 */ CREATE TABLE "InvoiceLine" ( "InvoiceLineId" INTEGER NOT NULL, "InvoiceId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, "UnitPrice" DECIMAL(10, 2) NOT NULL, "Quantity" INTEGER NOT NULL, PRIMARY KEY ("InvoiceLineId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("InvoiceId") REFERENCES "Invoice" ("InvoiceId") ) /* 2 rows from InvoiceLine table: InvoiceLineId InvoiceId TrackId UnitPrice Quantity 1 1 2 0.99 1 2 1 4 0.99 1 */ CREATE TABLE "MediaType" ( "MediaTypeId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("MediaTypeId") ) /* 2 rows from MediaType table: MediaTypeId Name 1 MPEG audio file 2 Protected AAC audio file */ CREATE TABLE "Playlist" ( "PlaylistId" INTEGER NOT NULL, "Name" VARCHAR(120) DEFAULT NULL, PRIMARY KEY ("PlaylistId") ) /* 2 rows from Playlist table: PlaylistId Name 1 Music 2 Movies */ CREATE TABLE "PlaylistTrack" ( "PlaylistId" INTEGER NOT NULL, "TrackId" INTEGER NOT NULL, PRIMARY KEY ("PlaylistId", "TrackId"), FOREIGN KEY("TrackId") REFERENCES "Track" ("TrackId"), FOREIGN KEY("PlaylistId") REFERENCES "Playlist" ("PlaylistId") ) /* 2 rows from PlaylistTrack table: PlaylistId TrackId 1 1 8 1 */ CREATE TABLE "Track" ( "TrackId" INTEGER NOT NULL, "Name" VARCHAR(200) NOT NULL, "AlbumId" INTEGER DEFAULT NULL, "MediaTypeId" INTEGER NOT NULL, "GenreId" INTEGER DEFAULT NULL, "Composer" VARCHAR(220) DEFAULT NULL, "Milliseconds" INTEGER NOT NULL, "Bytes" INTEGER DEFAULT NULL, "UnitPrice" DECIMAL(10, 2) NOT NULL, PRIMARY KEY ("TrackId"), FOREIGN KEY("MediaTypeId") REFERENCES "MediaType" ("MediaTypeId"), FOREIGN KEY("GenreId") REFERENCES "Genre" ("GenreId"), FOREIGN KEY("AlbumId") REFERENCES "Album" ("AlbumId") ) /* 2 rows from Track table: TrackId Name AlbumId MediaTypeId GenreId Composer Milliseconds Bytes UnitPrice 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 */
Find the average millisecond length of Latin and Pop tracks.
SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = "Latin" OR T1.Name = "Pop"
[{'AVG(Milliseconds)': 232566.4274322169}]
Medium
false
false
false
false
false
false
false
true
false
false
false
false
false