{"qid": "pool_0000", "split": "pool", "db_id": "aircraft", "question": "List names of all pilot aged 30 or younger in descending alphabetical order.", "gold_sql": "SELECT Name FROM pilot WHERE Age <= 30 ORDER BY Name DESC", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0001", "split": "pool", "db_id": "activity_1", "question": "What are the names of the activities Mark Giuliano is involved in", "gold_sql": "SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = \"Mark\" AND T1.lname = \"Giuliano\"", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0002", "split": "pool", "db_id": "match_season", "question": "For each player, what are their name, season, and country that they belong to?", "gold_sql": "SELECT T2.Season , T2.Player , T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0003", "split": "pool", "db_id": "music_1", "question": "What are the names of all songs that are in mp3 format and have a resolution lower than 1000?", "gold_sql": "SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = \"mp3\" INTERSECT SELECT song_name FROM song WHERE resolution < 1000", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0004", "split": "pool", "db_id": "aircraft", "question": "List all pilot names in ascending alphabetical order.", "gold_sql": "SELECT Name FROM pilot ORDER BY Name ASC", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0005", "split": "pool", "db_id": "protein_institute", "question": "Show the protein name and the institution name.", "gold_sql": "SELECT T2.protein_name , T1.institution FROM institution AS T1 JOIN protein AS T2 ON T1.institution_id = T2.institution_id", "db_path": "databases/protein_institute/protein_institute.sqlite", "schema": "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);\nCREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);\nCREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);"} {"qid": "pool_0006", "split": "pool", "db_id": "activity_1", "question": "What are the ids of the students who are not involved in any activity", "gold_sql": "SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0007", "split": "pool", "db_id": "loan_1", "question": "What is the name, account type, and account balance corresponding to the customer with the highest credit score?", "gold_sql": "SELECT cust_name , acc_type , acc_bal FROM customer ORDER BY credit_score DESC LIMIT 1", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0008", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Show all payment method codes and the number of orders for each code.", "gold_sql": "SELECT payment_method_code , count(*) FROM INVOICES GROUP BY payment_method_code", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0009", "split": "pool", "db_id": "csu_1", "question": "Find the count of universities whose campus fee is greater than the average campus fee.", "gold_sql": "SELECT count(*) FROM csu_fees WHERE campusfee > (SELECT avg(campusfee) FROM csu_fees)", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0010", "split": "pool", "db_id": "flight_4", "question": "How many cities are there that have more than 3 airports?", "gold_sql": "SELECT count(*) FROM (SELECT city FROM airports GROUP BY city HAVING count(*) > 3)", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0011", "split": "pool", "db_id": "college_2", "question": "What are the names and salaries for instructors who earn less than the average salary of instructors in the Physics department?", "gold_sql": "SELECT name , salary FROM instructor WHERE salary < (SELECT avg(salary) FROM instructor WHERE dept_name = 'Physics')", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0012", "split": "pool", "db_id": "ship_mission", "question": "What are the names of the ships that are from either the US or the UK?", "gold_sql": "SELECT Name FROM ship WHERE Nationality = \"United States\" OR Nationality = \"United Kingdom\"", "db_path": "databases/ship_mission/ship_mission.sqlite", "schema": "CREATE TABLE \"mission\" (\n\"Mission_ID\" int,\n\"Ship_ID\" int,\n\"Code\" text,\n\"Launched_Year\" int,\n\"Location\" text,\n\"Speed_knots\" int,\n\"Fate\" text,\nPRIMARY KEY (\"Mission_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES `ship`(\"Ship_ID\")\n);\nCREATE TABLE \"ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Nationality\" text,\n\"Tonnage\" int,\nPRIMARY KEY (\"Ship_ID\")\n);"} {"qid": "pool_0013", "split": "pool", "db_id": "company_1", "question": "Return the first names and last names of employees who earn more than 30000 in salary.", "gold_sql": "SELECT fname , lname FROM employee WHERE salary > 30000", "db_path": "databases/company_1/company_1.sqlite", "schema": "CREATE TABLE department(\nDname TEXT,\nDnumber INTEGER PRIMARY KEY,\nMgr_ssn INTEGER,\nMgr_start_date TEXT);\nCREATE TABLE dependent(\nEssn INTEGER,\nDependent_name TEXT,\nSex TEXT,\nBdate TEXT,\nRelationship TEXT,\nPRIMARY KEY(Essn, Dependent_name));\nCREATE TABLE dept_locations(\nDnumber INTEGER,\nDlocation TEXT,\nPRIMARY KEY(Dnumber, Dlocation));\nCREATE TABLE employee(\nFname TEXT,\nMinit TEXT,\nLname TEXT,\nSsn INTEGER PRIMARY KEY,\nBdate TEXT,\nAddress TEXT,\nSex TEXT,\nSalary INTEGER,\nSuper_ssn INTEGER, \nDno INTEGER);\nCREATE TABLE project(\nPname Text,\nPnumber INTEGER PRIMARY KEY,\nPlocation TEXT,\nDnum INTEGER);\nCREATE TABLE works_on(\nEssn INTEGER,\nPno INTEGER,\nHours REAL,\nPRIMARY KEY(Essn, Pno));"} {"qid": "pool_0014", "split": "pool", "db_id": "flight_1", "question": "How many employees do we have?", "gold_sql": "SELECT count(*) FROM Employee", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0015", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What are the account details with the largest value or with value having char '5' in it?", "gold_sql": "SELECT max(Account_details) FROM Accounts UNION SELECT Account_details FROM Accounts WHERE Account_details LIKE \"%5%\"", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0016", "split": "pool", "db_id": "gymnast", "question": "What are the names of people in ascending alphabetical order?", "gold_sql": "SELECT Name FROM People ORDER BY Name ASC", "db_path": "databases/gymnast/gymnast.sqlite", "schema": "CREATE TABLE \"gymnast\" (\n\"Gymnast_ID\" int,\n\"Floor_Exercise_Points\" real,\n\"Pommel_Horse_Points\" real,\n\"Rings_Points\" real,\n\"Vault_Points\" real,\n\"Parallel_Bars_Points\" real,\n\"Horizontal_Bar_Points\" real,\n\"Total_Points\" real,\nPRIMARY KEY (\"Gymnast_ID\"),\nFOREIGN KEY (\"Gymnast_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Age\" real,\n\"Height\" real,\n\"Hometown\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0017", "split": "pool", "db_id": "college_2", "question": "Count the number of distinct instructors who have taught a course.", "gold_sql": "SELECT COUNT (DISTINCT id) FROM teaches", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0018", "split": "pool", "db_id": "baseball_1", "question": "Find the average height of the players who belong to the college called 'Yale University'.", "gold_sql": "SELECT avg(T1.height) FROM player AS T1 JOIN player_college AS T2 ON T1.player_id = T2.player_id JOIN college AS T3 ON T3.college_id = T2.college_id WHERE T3.name_full = 'Yale University';", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0019", "split": "pool", "db_id": "music_1", "question": "What are the song names for every song whose rating is less than the minimum rating for English songs?", "gold_sql": "SELECT song_name FROM song WHERE rating < (SELECT min(rating) FROM song WHERE languages = 'english')", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0020", "split": "pool", "db_id": "chinook_1", "question": "What are all the album titles, in alphabetical order?", "gold_sql": "SELECT Title FROM ALBUM ORDER BY Title", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0021", "split": "pool", "db_id": "dorm_1", "question": "Find the capacity and gender type of the dorm whose name has substring ‘Donor’.", "gold_sql": "SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%'", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0022", "split": "pool", "db_id": "cre_Theme_park", "question": "What are the names of tourist attractions that can be reached by bus or is at address 254 Ottilie Junction?", "gold_sql": "SELECT T2.Name FROM Locations AS T1 JOIN Tourist_Attractions AS T2 ON T1.Location_ID = T2.Location_ID WHERE T1.Address = \"254 Ottilie Junction\" OR T2.How_to_Get_There = \"bus\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0023", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "Find the document type name of the document named \"How to read a book\".", "gold_sql": "SELECT T2.document_type_name FROM All_documents AS T1 JOIN Ref_document_types AS T2 ON T1.document_type_code = T2.document_type_code WHERE T1.document_name = \"How to read a book\"", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0024", "split": "pool", "db_id": "baseball_1", "question": "Find the players' first name and last name who won award both in 1960 and in 1961.", "gold_sql": "SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1960 INTERSECT SELECT T1.name_first , T1.name_last FROM player AS T1 JOIN player_award AS T2 WHERE T2.year = 1961", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0025", "split": "pool", "db_id": "hospital_1", "question": "Which physicians are affiliated with either Surgery or Psychiatry department? Give me their names.", "gold_sql": "SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry'", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0026", "split": "pool", "db_id": "apartment_rentals", "question": "What are the start date and end date of the apartment bookings made by female guests (gender code \"Female\")?", "gold_sql": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = \"Female\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0027", "split": "pool", "db_id": "game_injury", "question": "Find the id and name of the stadium where the largest number of injury accidents occurred.", "gold_sql": "SELECT T1.id , T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/game_injury/game_injury.sqlite", "schema": "CREATE TABLE \"game\" (\n\"stadium_id\" int,\n\"id\" int,\n\"Season\" int,\n\"Date\" text,\n\"Home_team\" text,\n\"Away_team\" text,\n\"Score\" text,\n\"Competition\" text,\nprimary key (\"id\"),\nforeign key (\"stadium_id\") references `stadium`(\"id\")\n);\nCREATE TABLE \"injury_accident\" (\n\"game_id\" int,\n\"id\" int,\n\"Player\" text,\n\"Injury\" text,\n\"Number_of_matches\" text,\n\"Source\" text,\nprimary key (\"id\"),\nforeign key (\"game_id\") references `game`(\"id\")\n);\nCREATE TABLE \"stadium\" (\n\"id\" int,\n\"name\" text,\n\"Home_Games\" int,\n\"Average_Attendance\" real,\n\"Total_Attendance\" real,\n\"Capacity_Percentage\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0028", "split": "pool", "db_id": "soccer_2", "question": "What are the different states that have students trying out?", "gold_sql": "SELECT DISTINCT state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0029", "split": "pool", "db_id": "hospital_1", "question": "Find all procedures which cost more than 1000 or which physician John Wen was trained in.", "gold_sql": "SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = \"John Wen\"", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0030", "split": "pool", "db_id": "college_2", "question": "Count the number of rooms in Lamberton with capacity lower than 50.", "gold_sql": "SELECT count(*) FROM classroom WHERE building = 'Lamberton' AND capacity < 50", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0031", "split": "pool", "db_id": "restaurant_1", "question": "Which major has least number of students? List the major and the number of students.", "gold_sql": "SELECT Major , count(*) FROM Student GROUP BY Major ORDER BY count(Major) ASC LIMIT 1;", "db_path": "databases/restaurant_1/restaurant_1.sqlite", "schema": "CREATE TABLE Restaurant (\n ResID INTEGER PRIMARY KEY,\n ResName VARCHAR(100),\n Address VARCHAR(100),\n Rating INTEGER\n);\nCREATE TABLE Restaurant_Type (\n ResTypeID INTEGER PRIMARY KEY,\n ResTypeName VARCHAR(40),\n ResTypeDescription VARCHAR(100)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Type_Of_Restaurant (\n ResID INTEGER,\n ResTypeID INTEGER,\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),\n FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)\n);\nCREATE TABLE Visits_Restaurant (\n StuID INTEGER,\n ResID INTEGER,\n Time TIMESTAMP,\n Spent FLOAT,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)\n);"} {"qid": "pool_0032", "split": "pool", "db_id": "loan_1", "question": "Find the total amount of loans offered by each bank branch.", "gold_sql": "SELECT sum(amount) , T1.bname FROM bank AS T1 JOIN loan AS T2 ON T1.branch_id = T2.branch_id GROUP BY T1.bname", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0033", "split": "pool", "db_id": "chinook_1", "question": "What are the names and ids of the different albums, and how many tracks are on each?", "gold_sql": "SELECT T1.Title , T2.AlbumID , COUNT(*) FROM ALBUM AS T1 JOIN TRACK AS T2 ON T1.AlbumId = T2.AlbumId GROUP BY T2.AlbumID", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0034", "split": "pool", "db_id": "customers_and_invoices", "question": "What is the invoice number and invoice date corresponding to the invoice with the greatest number of transactions?", "gold_sql": "SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0035", "split": "pool", "db_id": "college_2", "question": "Find the title of course that is provided by Statistics but not Psychology departments.", "gold_sql": "SELECT title FROM course WHERE dept_name = 'Statistics' EXCEPT SELECT title FROM course WHERE dept_name = 'Psychology'", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0036", "split": "pool", "db_id": "network_2", "question": "What are the names, ages, and jobs of all people who are friends with Alice for the longest amount of time?", "gold_sql": "SELECT T1.name , T1.age , T1.job FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice' AND T2.year = (SELECT max(YEAR) FROM PersonFriend WHERE friend = 'Alice')", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0037", "split": "pool", "db_id": "theme_gallery", "question": "What are the names of artist whose exhibitions draw over 200 attendees on average?", "gold_sql": "SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance) > 200", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0038", "split": "pool", "db_id": "e_learning", "question": "Find the student ID and personal name of the student with at least two enrollments.", "gold_sql": "SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0039", "split": "pool", "db_id": "architecture", "question": "What are the distinct names and nationalities of the architects who have ever built a mill?", "gold_sql": "SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id", "db_path": "databases/architecture/architecture.sqlite", "schema": "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);\nCREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);"} {"qid": "pool_0040", "split": "pool", "db_id": "mountain_photos", "question": "What are the average prominence of the mountains in country 'Morocco'?", "gold_sql": "SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'", "db_path": "databases/mountain_photos/mountain_photos.sqlite", "schema": "CREATE TABLE \"camera_lens\" (\n\"id\" int,\n\"brand\" text,\n\"name\" text,\n\"focal_length_mm\" real,\n\"max_aperture\" real,\nprimary key(\"id\")\n);\nCREATE TABLE \"mountain\" (\n\"id\" int,\n\"name\" text,\n\"Height\" real,\n\"Prominence\" real,\n\"Range\" text,\n\"Country\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"photos\" (\n\"id\" int, \n\"camera_lens_id\" int,\n\"mountain_id\" int,\n\"color\" text, \n\"name\" text,\nprimary key(\"id\"),\nforeign key(\"camera_lens_id\") references `camera_lens`(\"id\"),\nforeign key(\"mountain_id\") references `mountain`(\"id\")\n);"} {"qid": "pool_0041", "split": "pool", "db_id": "college_2", "question": "What are the names of students who took a course in the Fall of 2003?", "gold_sql": "SELECT name FROM student WHERE id IN (SELECT id FROM takes WHERE semester = 'Fall' AND YEAR = 2003)", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0042", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Find the payment method that is used the most often in all the invoices. Give me its code.", "gold_sql": "SELECT payment_method_code FROM INVOICES GROUP BY payment_method_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0043", "split": "pool", "db_id": "protein_institute", "question": "What are the average, maximum, and minimum number of floors for all buildings?", "gold_sql": "SELECT avg(floors) , max(floors) , min(floors) FROM building", "db_path": "databases/protein_institute/protein_institute.sqlite", "schema": "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);\nCREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);\nCREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);"} {"qid": "pool_0044", "split": "pool", "db_id": "apartment_rentals", "question": "Give me a list of all the distinct building descriptions.", "gold_sql": "SELECT DISTINCT building_description FROM Apartment_Buildings", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0045", "split": "pool", "db_id": "climbing", "question": "List the distinct ranges of the mountains with the top 3 prominence.", "gold_sql": "SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3", "db_path": "databases/climbing/climbing.sqlite", "schema": "CREATE TABLE \"climber\" (\n\"Climber_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Time\" text,\n\"Points\" real,\n\"Mountain_ID\" int,\nPRIMARY KEY (\"Climber_ID\"),\nFOREIGN KEY (\"Mountain_ID\") REFERENCES \"mountain\"(\"Mountain_ID\")\n);\nCREATE TABLE \"mountain\" (\n\"Mountain_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Prominence\" real,\n\"Range\" text,\n\"Country\" text,\nPRIMARY KEY (\"Mountain_ID\")\n);"} {"qid": "pool_0046", "split": "pool", "db_id": "e_learning", "question": "List the addresses of all the course authors or tutors.", "gold_sql": "SELECT address_line_1 FROM Course_Authors_and_Tutors", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0047", "split": "pool", "db_id": "college_1", "question": "Find the first name and office of the professor who is in the history department and has a Ph.D. degree.", "gold_sql": "SELECT T1.emp_fname , T2.prof_office FROM employee AS T1 JOIN professor AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T3.dept_code = T2.dept_code WHERE T3.dept_name = 'History' AND T2.prof_high_degree = 'Ph.D.'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0048", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Which city is the address of the store named \"FJA Filming\" located in?", "gold_sql": "SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = \"FJA Filming\"", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0049", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "List all location codes and location names.", "gold_sql": "SELECT location_code , location_name FROM Ref_locations", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0050", "split": "pool", "db_id": "aircraft", "question": "Please list the location and the winning aircraft name.", "gold_sql": "SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0051", "split": "pool", "db_id": "college_2", "question": "What are the ids of courses without prerequisites?", "gold_sql": "SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0052", "split": "pool", "db_id": "match_season", "question": "Show the country name and capital of all countries.", "gold_sql": "SELECT Country_name , Capital FROM country", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0053", "split": "pool", "db_id": "soccer_2", "question": "What are the different states that had students successfully try out?", "gold_sql": "SELECT DISTINCT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0054", "split": "pool", "db_id": "election", "question": "Sort the names of all counties in ascending order of population.", "gold_sql": "SELECT County_name FROM county ORDER BY Population ASC", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0055", "split": "pool", "db_id": "election", "question": "Show the county name and population of all counties.", "gold_sql": "SELECT County_name , Population FROM county", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0056", "split": "pool", "db_id": "voter_2", "question": "How many distinct president votes are recorded?", "gold_sql": "SELECT count(DISTINCT President_Vote) FROM VOTING_RECORD", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0057", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "What is the most frequent status of bookings?", "gold_sql": "SELECT Status_Code FROM BOOKINGS GROUP BY Status_Code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0058", "split": "pool", "db_id": "match_season", "question": "Return the names of teams that have no match season record.", "gold_sql": "SELECT Name FROM team WHERE Team_id NOT IN (SELECT Team FROM match_season)", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0059", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "How many locations are listed in the database?", "gold_sql": "SELECT count(*) FROM Ref_locations", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0060", "split": "pool", "db_id": "bike_1", "question": "Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.", "gold_sql": "SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0061", "split": "pool", "db_id": "apartment_rentals", "question": "Show each apartment type code, and the maximum and minimum number of rooms for each type.", "gold_sql": "SELECT apt_type_code , max(room_count) , min(room_count) FROM Apartments GROUP BY apt_type_code", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0062", "split": "pool", "db_id": "driving_school", "question": "What are the first and last names of all customers who lived in Lockmanfurt?", "gold_sql": "SELECT T1.first_name , T1.last_name FROM Customers AS T1 JOIN Addresses AS T2 ON T1.customer_address_id = T2.address_id WHERE T2.city = \"Lockmanfurt\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0063", "split": "pool", "db_id": "aircraft", "question": "find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.", "gold_sql": "SELECT t1.name , t1.age FROM pilot AS t1 JOIN MATCH AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0064", "split": "pool", "db_id": "network_2", "question": "How old is each gender, on average?", "gold_sql": "SELECT avg(age) , gender FROM Person GROUP BY gender", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0065", "split": "pool", "db_id": "program_share", "question": "Find the names of channels that are not owned by CCTV.", "gold_sql": "SELECT name FROM channel WHERE OWNER != 'CCTV'", "db_path": "databases/program_share/program_share.sqlite", "schema": "CREATE TABLE \"broadcast\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Time_of_day\" text,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"broadcast_share\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Date\" text,\n\"Share_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"channel\" (\n\"Channel_ID\" int,\n\"Name\" text,\n\"Owner\" text,\n\"Share_in_percent\" real,\n\"Rating_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\")\n);\nCREATE TABLE \"program\" (\n\"Program_ID\" int,\n\"Name\" text,\n\"Origin\" text,\n\"Launch\" real,\n\"Owner\" text,\nPRIMARY KEY (\"Program_ID\")\n);"} {"qid": "pool_0066", "split": "pool", "db_id": "protein_institute", "question": "What is the name of the tallest building?", "gold_sql": "SELECT name FROM building ORDER BY height_feet DESC LIMIT 1", "db_path": "databases/protein_institute/protein_institute.sqlite", "schema": "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);\nCREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);\nCREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);"} {"qid": "pool_0067", "split": "pool", "db_id": "soccer_2", "question": "What is the number of states that has some college whose enrollment is larger than the average enrollment?", "gold_sql": "SELECT count(DISTINCT state) FROM college WHERE enr > (SELECT avg(enr) FROM college)", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0068", "split": "pool", "db_id": "apartment_rentals", "question": "Return the apartment number with the largest number of bedrooms.", "gold_sql": "SELECT apt_number FROM Apartments ORDER BY bedroom_count DESC LIMIT 1", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0069", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Show all the planned delivery dates and actual delivery dates of bookings.", "gold_sql": "SELECT Planned_Delivery_Date , Actual_Delivery_Date FROM BOOKINGS", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0070", "split": "pool", "db_id": "music_1", "question": "Find the country of origin for the artist who made the least number of songs?", "gold_sql": "SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY count(*) LIMIT 1", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0071", "split": "pool", "db_id": "hospital_1", "question": "Find the physician who was trained in the most expensive procedure?", "gold_sql": "SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0072", "split": "pool", "db_id": "scientist_1", "question": "List all the scientists' names, their projects' names, and the hours worked by that scientist on each project, in alphabetical order of project name, and then scientist name.", "gold_sql": "SELECT T1.Name , T3.Name , T3.Hours FROM Scientists AS T1 JOIN AssignedTo AS T2 ON T1.SSN = T2.Scientist JOIN Projects AS T3 ON T2.Project = T3.Code ORDER BY T3.Name , T1.Name", "db_path": "databases/scientist_1/scientist_1.sqlite", "schema": "CREATE TABLE AssignedTo (\n Scientist int not null,\n Project char(4) not null,\n Primary Key (Scientist, Project),\n Foreign Key (Scientist) references Scientists (SSN),\n Foreign Key (Project) references Projects (Code)\n);\nCREATE TABLE Projects (\n Code Char(4),\n Name Char(50) not null,\n Hours int,\n Primary Key (Code)\n);\nCREATE TABLE Scientists (\n SSN int,\n Name Char(30) not null,\n Primary Key (SSN)\n);"} {"qid": "pool_0073", "split": "pool", "db_id": "icfp_1", "question": "What are the last names of the author of the paper titled \"Binders Unbound\"?", "gold_sql": "SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = \"Binders Unbound\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0074", "split": "pool", "db_id": "tracking_grants_for_research", "question": "Which role is most common for the staff?", "gold_sql": "SELECT role_code FROM Project_Staff GROUP BY role_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0075", "split": "pool", "db_id": "match_season", "question": "Which players are from Indonesia?", "gold_sql": "SELECT T2.Player FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T1.Country_name = \"Indonesia\"", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0076", "split": "pool", "db_id": "sports_competition", "question": "What is the total number of clubs that have less than 10 medals in total?", "gold_sql": "SELECT count(*) FROM club_rank WHERE Total < 10", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0077", "split": "pool", "db_id": "assets_maintenance", "question": "Which engineer has visited the most times? Show the engineer id, first name and last name.", "gold_sql": "SELECT T1.engineer_id , T1.first_name , T1.last_name FROM Maintenance_Engineers AS T1 JOIN Engineer_Visits AS T2 GROUP BY T1.engineer_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/assets_maintenance/assets_maintenance.sqlite", "schema": "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);\nCREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);\nCREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);\nCREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);\nCREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);\nCREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);\nCREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);"} {"qid": "pool_0078", "split": "pool", "db_id": "shop_membership", "question": "What is the number of branches that have more than the average number of memberships?", "gold_sql": "SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch)", "db_path": "databases/shop_membership/shop_membership.sqlite", "schema": "CREATE TABLE \"branch\" (\n\"Branch_ID\" int,\n\"Name\" text,\n\"Open_year\" text,\n\"Address_road\" text,\n\"City\" text,\n\"membership_amount\" text,\nPRIMARY KEY (\"Branch_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Card_Number\" text,\n\"Name\" text,\n\"Hometown\" text,\n\"Level\" int,\nPRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"membership_register_branch\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Register_Year\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);\nCREATE TABLE \"purchase\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Year\" text,\n\"Total_pounds\" real,\nPRIMARY KEY (\"Member_ID\",\"Branch_ID\",\"Year\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);"} {"qid": "pool_0079", "split": "pool", "db_id": "csu_1", "question": "How many faculty is there in total in the year of 2002?", "gold_sql": "SELECT sum(faculty) FROM faculty WHERE YEAR = 2002", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0080", "split": "pool", "db_id": "cinema", "question": "Show the cinema name and location for cinemas with capacity above average.", "gold_sql": "SELECT name , LOCATION FROM cinema WHERE capacity > (SELECT avg(capacity) FROM cinema)", "db_path": "databases/cinema/cinema.sqlite", "schema": "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));\nCREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);"} {"qid": "pool_0081", "split": "pool", "db_id": "csu_1", "question": "How many faculty members did the university that conferred the most degrees in 2002 have?", "gold_sql": "SELECT T2.faculty FROM campuses AS T1 JOIN faculty AS T2 ON T1.id = t2.campus JOIN degrees AS T3 ON T1.id = t3.campus AND t2.year = t3.year WHERE t2.year = 2002 ORDER BY t3.degrees DESC LIMIT 1", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0082", "split": "pool", "db_id": "movie_1", "question": "Find the titles of all movies directed by steven spielberg.", "gold_sql": "SELECT title FROM Movie WHERE director = 'Steven Spielberg'", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0083", "split": "pool", "db_id": "theme_gallery", "question": "Count the number of artists who are older than 46 and joined after 1990.", "gold_sql": "SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0084", "split": "pool", "db_id": "flight_4", "question": "What is the name, city, and country of the airport with the highest elevation?", "gold_sql": "SELECT name , city , country FROM airports ORDER BY elevation DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0085", "split": "pool", "db_id": "store_1", "question": "What are the names of the countries and average invoice size of the top countries by size?", "gold_sql": "SELECT billing_country , AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0086", "split": "pool", "db_id": "movie_1", "question": "What is the title of the newest movie?", "gold_sql": "SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie)", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0087", "split": "pool", "db_id": "entrepreneur", "question": "Return the investors who have invested in two or more entrepreneurs.", "gold_sql": "SELECT Investor FROM entrepreneur GROUP BY Investor HAVING COUNT(*) >= 2", "db_path": "databases/entrepreneur/entrepreneur.sqlite", "schema": "CREATE TABLE \"entrepreneur\" (\n\"Entrepreneur_ID\" int,\n\"People_ID\" int,\n\"Company\" text,\n\"Money_Requested\" real,\n\"Investor\" text,\nPRIMARY KEY (\"Entrepreneur_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Date_of_Birth\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0088", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "Return the ids and details corresponding to projects for which there are more than two documents.", "gold_sql": "SELECT T1.project_id , T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id HAVING count(*) > 2", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0089", "split": "pool", "db_id": "election", "question": "Return the names of all counties sorted by county name in descending alphabetical order.", "gold_sql": "SELECT County_name FROM county ORDER BY County_name DESC", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0090", "split": "pool", "db_id": "assets_maintenance", "question": "List all every engineer's first name, last name, details and coresponding skill description.", "gold_sql": "SELECT T1.first_name , T1.last_name , T1.other_details , T3.skill_description FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id", "db_path": "databases/assets_maintenance/assets_maintenance.sqlite", "schema": "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);\nCREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);\nCREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);\nCREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);\nCREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);\nCREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);\nCREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);"} {"qid": "pool_0091", "split": "pool", "db_id": "music_1", "question": "What is the average rating of songs produced by female artists?", "gold_sql": "SELECT avg(T2.rating) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = \"Female\"", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0092", "split": "pool", "db_id": "theme_gallery", "question": "Show all artist names and the year joined who are not from United States.", "gold_sql": "SELECT name , year_join FROM artist WHERE country != 'United States'", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0093", "split": "pool", "db_id": "ship_mission", "question": "Please show the most common type of ships.", "gold_sql": "SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/ship_mission/ship_mission.sqlite", "schema": "CREATE TABLE \"mission\" (\n\"Mission_ID\" int,\n\"Ship_ID\" int,\n\"Code\" text,\n\"Launched_Year\" int,\n\"Location\" text,\n\"Speed_knots\" int,\n\"Fate\" text,\nPRIMARY KEY (\"Mission_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES `ship`(\"Ship_ID\")\n);\nCREATE TABLE \"ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Nationality\" text,\n\"Tonnage\" int,\nPRIMARY KEY (\"Ship_ID\")\n);"} {"qid": "pool_0094", "split": "pool", "db_id": "music_2", "question": "How many bands are there?", "gold_sql": "SELECT count(*) FROM Band", "db_path": "databases/music_2/music_2.sqlite", "schema": "CREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Label\" TEXT, \n\t\"Type\" TEXT );\nCREATE TABLE \"Band\" ( \n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Firstname\" TEXT, \n\t\"Lastname\" TEXT );\nCREATE TABLE \"Instruments\" ( \n\t\"SongId\" INTEGER, \n\t\"BandmateId\" INTEGER, \n\t\"Instrument\" TEXT ,\n\tPRIMARY KEY(SongId, BandmateId, Instrument),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (BandmateId) REFERENCES Band(Id)\n);\nCREATE TABLE \"Performance\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"StagePosition\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);\nCREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT \n);\nCREATE TABLE \"Tracklists\" ( \n\t\"AlbumId\" INTEGER, \n\t\"Position\" INTEGER, \n\t\"SongId\" INTEGER ,\n\tPRIMARY KEY(AlbumId, Position),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (AlbumId) REFERENCES Albums(AId)\n);\nCREATE TABLE \"Vocals\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"Type\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);"} {"qid": "pool_0095", "split": "pool", "db_id": "baseball_1", "question": "List all the salary values players received in 2010 and 2001.", "gold_sql": "SELECT salary FROM salary WHERE YEAR = 2010 UNION SELECT salary FROM salary WHERE YEAR = 2001", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0096", "split": "pool", "db_id": "tracking_grants_for_research", "question": "List the project details of the project both producing patent and paper as outcomes.", "gold_sql": "SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Paper' INTERSECT SELECT T1.project_details FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id WHERE T2.outcome_code = 'Patent'", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0097", "split": "pool", "db_id": "game_injury", "question": "What are the maximum, minimum and average home games each stadium held?", "gold_sql": "SELECT max(home_games) , min(home_games) , avg(home_games) FROM stadium", "db_path": "databases/game_injury/game_injury.sqlite", "schema": "CREATE TABLE \"game\" (\n\"stadium_id\" int,\n\"id\" int,\n\"Season\" int,\n\"Date\" text,\n\"Home_team\" text,\n\"Away_team\" text,\n\"Score\" text,\n\"Competition\" text,\nprimary key (\"id\"),\nforeign key (\"stadium_id\") references `stadium`(\"id\")\n);\nCREATE TABLE \"injury_accident\" (\n\"game_id\" int,\n\"id\" int,\n\"Player\" text,\n\"Injury\" text,\n\"Number_of_matches\" text,\n\"Source\" text,\nprimary key (\"id\"),\nforeign key (\"game_id\") references `game`(\"id\")\n);\nCREATE TABLE \"stadium\" (\n\"id\" int,\n\"name\" text,\n\"Home_Games\" int,\n\"Average_Attendance\" real,\n\"Total_Attendance\" real,\n\"Capacity_Percentage\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0098", "split": "pool", "db_id": "department_store", "question": "Return the id of the staff whose Staff Department Assignment was earlier than that of any Clerical Staff.", "gold_sql": "SELECT staff_id FROM Staff_Department_Assignments WHERE date_assigned_to < (SELECT max(date_assigned_to) FROM Staff_Department_Assignments WHERE job_title_code = 'Clerical Staff')", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0099", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Return the the names of the drama workshop groups that are located in Feliciaberg city.", "gold_sql": "SELECT T2.Store_Name FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.City_Town = \"Feliciaberg\"", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0100", "split": "pool", "db_id": "allergy_1", "question": "Find the number of students who are older than 18 and do not have allergy to either food or animal.", "gold_sql": "SELECT count(*) FROM Student WHERE age > 18 AND StuID NOT IN ( SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" OR T2.allergytype = \"animal\")", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0101", "split": "pool", "db_id": "hospital_1", "question": "What is the names of the physicians who prescribe medication Thesisin?", "gold_sql": "SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = \"Thesisin\"", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0102", "split": "pool", "db_id": "college_1", "question": "What are the first names of all students taking accoutning and Computer Information Systems classes?", "gold_sql": "SELECT T1.stu_fname 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 JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Accounting' INTERSECT SELECT T1.stu_fname 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 JOIN department AS T5 ON T5.dept_code = T4.dept_code WHERE T5.dept_name = 'Computer Info. Systems'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0103", "split": "pool", "db_id": "icfp_1", "question": "What is the last name of the author that has published the most papers?", "gold_sql": "SELECT t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.fname , t1.lname ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0104", "split": "pool", "db_id": "dorm_1", "question": "Find the name of amenities of the dorm where the student with last name Smith is living in.", "gold_sql": "SELECT T3.amenity_name FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid JOIN lives_in AS T4 ON T4.dormid = T1.dormid JOIN student AS T5 ON T5.stuid = T4.stuid WHERE T5.lname = 'Smith'", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0105", "split": "pool", "db_id": "browser_web", "question": "Which accelerator name contains substring \"Opera\"?", "gold_sql": "SELECT name FROM web_client_accelerator WHERE name LIKE \"%Opera%\"", "db_path": "databases/browser_web/browser_web.sqlite", "schema": "CREATE TABLE \"Web_client_accelerator\" (\n\"id\" int,\n\"name\" text,\n\"Operating_system\" text,\n\"Client\" text,\n\"Connection\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"accelerator_compatible_browser\" (\n\"accelerator_id\" int,\n\"browser_id\" int,\n\"compatible_since_year\" int,\nprimary key(\"accelerator_id\", \"browser_id\"),\nforeign key (\"accelerator_id\") references `Web_client_accelerator`(\"id\"),\nforeign key (\"browser_id\") references `browser`(\"id\")\n);\nCREATE TABLE \"browser\" (\n\"id\" int,\n\"name\" text,\n\"market_share\" real,\nprimary key(\"id\")\n);"} {"qid": "pool_0106", "split": "pool", "db_id": "wine_1", "question": "List the grape, appelation and name of wines whose score is higher than 93 ordered by Name.", "gold_sql": "SELECT Grape , Appelation , Name FROM WINE WHERE Score > 93 ORDER BY Name", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0107", "split": "pool", "db_id": "chinook_1", "question": "What is the average unit price of tracks that belong to Jazz genre?", "gold_sql": "SELECT AVG(UnitPrice) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = \"Jazz\"", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0108", "split": "pool", "db_id": "flight_1", "question": "What is the aircraft name for the flight with number 99", "gold_sql": "SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0109", "split": "pool", "db_id": "e_learning", "question": "Return the login names of the students whose family name is \"Ward\".", "gold_sql": "SELECT login_name FROM Students WHERE family_name = \"Ward\"", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0110", "split": "pool", "db_id": "activity_1", "question": "What is the total number of faculty members?", "gold_sql": "SELECT count(*) FROM Faculty", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0111", "split": "pool", "db_id": "store_1", "question": "What are the names of all playlists that have more than 100 tracks?", "gold_sql": "SELECT T2.name FROM playlist_tracks AS T1 JOIN playlists AS T2 ON T2.id = T1.playlist_id GROUP BY T1.playlist_id HAVING count(T1.track_id) > 100;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0112", "split": "pool", "db_id": "insurance_and_eClaims", "question": "List the names of all the customers in alphabetical order.", "gold_sql": "SELECT customer_details FROM customers ORDER BY customer_details", "db_path": "databases/insurance_and_eClaims/insurance_and_eClaims.sqlite", "schema": "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);\nCREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);"} {"qid": "pool_0113", "split": "pool", "db_id": "aircraft", "question": "What are the total number of Domestic Passengers of airports that contain the word \"London\".", "gold_sql": "SELECT sum(Domestic_Passengers) FROM airport WHERE Airport_Name LIKE \"%London%\"", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0114", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Check the invoices record and compute the average quantities ordered with the payment method \"MasterCard\".", "gold_sql": "SELECT avg(Order_Quantity) FROM Invoices WHERE payment_method_code = \"MasterCard\"", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0115", "split": "pool", "db_id": "bike_1", "question": "What is the average bike availablility for stations not in Palo Alto?", "gold_sql": "SELECT avg(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = \"Palo Alto\")", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0116", "split": "pool", "db_id": "tracking_software_problems", "question": "Which staff members are assigned to the problem with id 1? Give me their first and last names.", "gold_sql": "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", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0117", "split": "pool", "db_id": "activity_1", "question": "What is the name of the activity that has the most faculty members involved in?", "gold_sql": "SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0118", "split": "pool", "db_id": "aircraft", "question": "What is the location and name of the winning aircraft?", "gold_sql": "SELECT T2.Location , T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0119", "split": "pool", "db_id": "college_3", "question": "List all names of courses with 1 credit?", "gold_sql": "SELECT CName FROM COURSE WHERE Credits = 1", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0120", "split": "pool", "db_id": "match_season", "question": "What are the different positions for match season?", "gold_sql": "SELECT DISTINCT POSITION FROM match_season", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0121", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "List the actual delivery date for all the orders with quantity 1", "gold_sql": "SELECT T1.Actual_Delivery_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID WHERE T2.Order_Quantity = 1", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0122", "split": "pool", "db_id": "hospital_1", "question": "What are the names of patients who are staying in room 111 and have an undergoing treatment?", "gold_sql": "SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0123", "split": "pool", "db_id": "loan_1", "question": "Find the name and credit score of the customers who have some loans.", "gold_sql": "SELECT DISTINCT T1.cust_name , T1.credit_score FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id = T2.cust_id", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0124", "split": "pool", "db_id": "decoration_competition", "question": "Which countries have more than two members?", "gold_sql": "SELECT Country FROM member GROUP BY Country HAVING COUNT(*) > 2", "db_path": "databases/decoration_competition/decoration_competition.sqlite", "schema": "CREATE TABLE \"college\" (\n\"College_ID\" int,\n\"Name\" text,\n\"Leader_Name\" text,\n\"College_Location\" text,\nPRIMARY KEY (\"College_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"College_ID\" int,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"College_ID\") REFERENCES `college`(\"College_ID\")\n);\nCREATE TABLE \"round\" (\n\"Round_ID\" int,\n\"Member_ID\" int,\n\"Decoration_Theme\" text,\n\"Rank_in_Round\" int,\nPRIMARY KEY (\"Member_ID\",\"Round_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\")\n);"} {"qid": "pool_0125", "split": "pool", "db_id": "e_learning", "question": "Find the names and descriptions of courses that belong to the subject named \"Computer Science\".", "gold_sql": "SELECT T1.course_name , T1.course_description FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id WHERE T2.subject_name = \"Computer Science\"", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0126", "split": "pool", "db_id": "products_gen_characteristics", "question": "Count the products that have the color description \"white\" or have the characteristic name \"hot\".", "gold_sql": "SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = \"white\" OR t3.characteristic_name = \"hot\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0127", "split": "pool", "db_id": "e_government", "question": "Find the name of the most popular party form.", "gold_sql": "SELECT t1.form_name FROM forms AS t1 JOIN party_forms AS t2 ON t1.form_id = t2.form_id GROUP BY t2.form_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0128", "split": "pool", "db_id": "customers_campaigns_ecommerce", "question": "Show all distinct product categories along with the number of mailshots in each category.", "gold_sql": "SELECT product_category , count(*) FROM mailshot_campaigns GROUP BY product_category", "db_path": "databases/customers_campaigns_ecommerce/customers_campaigns_ecommerce.sqlite", "schema": "CREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`premise_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`premise_id` ) REFERENCES `Premises`(`premise_id` )\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(15) NOT NULL,\n`shipping_method_code` VARCHAR(15) NOT NULL,\n`order_placed_datetime` DATETIME NOT NULL,\n`order_delivered_datetime` DATETIME,\n`order_shipping_charges` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method` VARCHAR(15) NOT NULL,\n`customer_name` VARCHAR(80),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_login` VARCHAR(80),\n`customer_password` VARCHAR(10)\n);\nCREATE TABLE `Mailshot_Campaigns` (\n`mailshot_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15),\n`mailshot_name` VARCHAR(80),\n`mailshot_start_date` DATETIME,\n`mailshot_end_date` DATETIME\n);\nCREATE TABLE `Mailshot_Customers` (\n`mailshot_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(15) NOT NULL,\n`mailshot_customer_date` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`mailshot_id` ) REFERENCES `Mailshot_Campaigns`(`mailshot_id` )\n);\nCREATE TABLE `Order_Items` (\n`item_id` INTEGER NOT NULL ,\n`order_item_status_code` VARCHAR(15) NOT NULL,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`item_status_code` VARCHAR(15),\n`item_delivered_datetime` DATETIME,\n`item_order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);\nCREATE TABLE `Premises` (\n`premise_id` INTEGER PRIMARY KEY,\n`premises_type` VARCHAR(15) NOT NULL,\n`premise_details` VARCHAR(255)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80)\n);"} {"qid": "pool_0129", "split": "pool", "db_id": "gas_company", "question": "What are the locations of all the gas stations ordered by opening year?", "gold_sql": "SELECT LOCATION FROM gas_station ORDER BY open_year", "db_path": "databases/gas_company/gas_company.sqlite", "schema": "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);"} {"qid": "pool_0130", "split": "pool", "db_id": "bike_1", "question": "For each end station id, what is its name, latitude, and minimum duration for trips ended there?", "gold_sql": "SELECT T1.name , T1.lat , min(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0131", "split": "pool", "db_id": "local_govt_and_lot", "question": "List the customer event id and the corresponding move in date and property id.", "gold_sql": "SELECT customer_event_id , date_moved_in , property_id FROM customer_events", "db_path": "databases/local_govt_and_lot/local_govt_and_lot.sqlite", "schema": "CREATE TABLE Customer_Event_Notes (\nCustomer_Event_Note_ID INTEGER NOT NULL,\nCustomer_Event_ID INTEGER NOT NULL,\nservice_type_code CHAR(15) NOT NULL,\nresident_id INTEGER NOT NULL,\nproperty_id INTEGER NOT NULL,\ndate_moved_in DATETIME NOT NULL,\nPRIMARY KEY (Customer_Event_Note_ID),\nFOREIGN KEY (Customer_Event_ID) REFERENCES Customer_Events (Customer_Event_ID)\n);\nCREATE TABLE Customer_Events (\nCustomer_Event_ID INTEGER NOT NULL,\ncustomer_id INTEGER,\ndate_moved_in DATETIME,\nproperty_id INTEGER,\nresident_id INTEGER,\nthing_id INTEGER NOT NULL,\nPRIMARY KEY (Customer_Event_ID),\nFOREIGN KEY (thing_id) REFERENCES Things (thing_id),\nFOREIGN KEY (customer_id) REFERENCES Customers (customer_id),\nFOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)\n);\nCREATE TABLE Customers (\ncustomer_id INTEGER NOT NULL,\ncustomer_details VARCHAR(255),\nPRIMARY KEY (customer_id)\n);\nCREATE TABLE Organizations (\norganization_id INTEGER NOT NULL,\nparent_organization_id INTEGER,\norganization_details VARCHAR(255),\nPRIMARY KEY (organization_id)\n);\nCREATE TABLE Properties (\nproperty_id INTEGER NOT NULL,\nproperty_type_code CHAR(15) NOT NULL,\nproperty_address VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (property_id)\n);\nCREATE TABLE Residents (\nresident_id INTEGER NOT NULL,\nproperty_id INTEGER NOT NULL,\ndate_moved_in DATETIME NOT NULL,\ndate_moved_out DATETIME NOT NULL,\nother_details VARCHAR(255),\nPRIMARY KEY (resident_id, property_id, date_moved_in),\nFOREIGN KEY (property_id) REFERENCES Properties (property_id)\n);\nCREATE TABLE Residents_Services (\nresident_id INTEGER NOT NULL,\nservice_id INTEGER NOT NULL,\ndate_moved_in DATETIME,\nproperty_id INTEGER,\ndate_requested DATETIME,\ndate_provided DATETIME,\nother_details VARCHAR(255),\nPRIMARY KEY (resident_id, service_id),\nFOREIGN KEY (service_id) REFERENCES Services (service_id),\nFOREIGN KEY (resident_id, property_id, date_moved_in) REFERENCES Residents (resident_id,property_id,date_moved_in)\n);\nCREATE TABLE Services (\nservice_id INTEGER NOT NULL,\norganization_id INTEGER NOT NULL,\nservice_type_code CHAR(15) NOT NULL,\nservice_details VARCHAR(255),\nPRIMARY KEY (service_id),\nFOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)\n);\nCREATE TABLE Things (\nthing_id INTEGER NOT NULL,\norganization_id INTEGER NOT NULL,\nType_of_Thing_Code CHAR(15) NOT NULL,\nservice_type_code CHAR(10) NOT NULL,\nservice_details VARCHAR(255),\nPRIMARY KEY (thing_id),\nFOREIGN KEY (organization_id) REFERENCES Organizations (organization_id)\n);\nCREATE TABLE Timed_Locations_of_Things (\nthing_id INTEGER NOT NULL,\nDate_and_Time DATETIME NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nPRIMARY KEY (thing_id, Date_and_Time, Location_Code),\nFOREIGN KEY (thing_id) REFERENCES Things (thing_id));\nCREATE TABLE Timed_Status_of_Things (\nthing_id INTEGER NOT NULL,\nDate_and_Date DATETIME NOT NULL,\nStatus_of_Thing_Code CHAR(15) NOT NULL,\nPRIMARY KEY (thing_id, Date_and_Date, Status_of_Thing_Code),\nFOREIGN KEY (thing_id) REFERENCES Things (thing_id)\n);"} {"qid": "pool_0132", "split": "pool", "db_id": "soccer_2", "question": "What are the names of players whose training hours is between 500 and 1500?", "gold_sql": "SELECT pName FROM Player WHERE HS BETWEEN 500 AND 1500", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0133", "split": "pool", "db_id": "student_assessment", "question": "What are all details of the students who registered but did not attend any course?", "gold_sql": "SELECT * FROM student_course_registrations WHERE student_id NOT IN (SELECT student_id FROM student_course_attendance)", "db_path": "databases/student_assessment/student_assessment.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_1 VARCHAR(80),\nline_2 VARCHAR(80),\ncity VARCHAR(50),\nzip_postcode CHAR(20),\nstate_province_county VARCHAR(50),\ncountry VARCHAR(50),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Candidate_Assessments (\ncandidate_id INTEGER NOT NULL,\nqualification CHAR(15) NOT NULL,\nassessment_date DATETIME NOT NULL,\nasessment_outcome_code CHAR(15) NOT NULL,\nPRIMARY KEY (candidate_id, qualification),\nFOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)\n);\nCREATE TABLE Candidates (\ncandidate_id INTEGER NOT NULL ,\ncandidate_details VARCHAR(255),\nPRIMARY KEY (candidate_id),\nFOREIGN KEY (candidate_id) REFERENCES People (person_id)\n);\nCREATE TABLE Courses (\ncourse_id VARCHAR(100) NOT NULL,\ncourse_name VARCHAR(120),\ncourse_description VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (course_id)\n);\nCREATE TABLE People (\nperson_id INTEGER NOT NULL,\nfirst_name VARCHAR(255),\nmiddle_name VARCHAR(255),\nlast_name VARCHAR(255),\ncell_mobile_number VARCHAR(40),\nemail_address VARCHAR(40),\nlogin_name VARCHAR(40),\npassword VARCHAR(40),\nPRIMARY KEY (person_id)\n);\nCREATE TABLE People_Addresses (\nperson_address_id INTEGER NOT NULL,\nperson_id INTEGER NOT NULL,\naddress_id INTEGER NOT NULL,\ndate_from DATETIME,\ndate_to DATETIME,\nPRIMARY KEY (person_address_id),\nFOREIGN KEY (person_id) REFERENCES People (person_id),\nFOREIGN KEY (address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Student_Course_Attendance (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\ndate_of_attendance DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)\n);\nCREATE TABLE Student_Course_Registrations (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\nregistration_date DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id) REFERENCES Students (student_id),\nFOREIGN KEY (course_id) REFERENCES Courses (course_id)\n);\nCREATE TABLE Students (\nstudent_id INTEGER NOT NULL,\nstudent_details VARCHAR(255),\nPRIMARY KEY (student_id),\nFOREIGN KEY (student_id) REFERENCES People (person_id)\n);"} {"qid": "pool_0134", "split": "pool", "db_id": "tracking_software_problems", "question": "Find the oldest log id and its corresponding problem id.", "gold_sql": "SELECT problem_log_id , problem_id FROM problem_log ORDER BY log_entry_date LIMIT 1", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0135", "split": "pool", "db_id": "protein_institute", "question": "How many institutions do not have an associated protein in our record?", "gold_sql": "SELECT count(*) FROM institution WHERE institution_id NOT IN (SELECT institution_id FROM protein)", "db_path": "databases/protein_institute/protein_institute.sqlite", "schema": "CREATE TABLE \"Institution\" (\n\"Institution_id\" text,\n\"Institution\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Type\" text,\n\"Enrollment\" int,\n\"Team\" text,\n\"Primary_Conference\" text,\n\"building_id\" text,\nPRIMARY KEY(\"Institution_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"building\"(\"building_id\")\n);\nCREATE TABLE \"building\" (\n\"building_id\" text,\n\"Name\" text,\n\"Street_address\" text,\n\"Years_as_tallest\" text,\n\"Height_feet\" int,\n\"Floors\" int,\nPRIMARY KEY(\"building_id\")\n);\nCREATE TABLE \"protein\" (\n\"common_name\" text,\n\"protein_name\" text,\n\"divergence_from_human_lineage\" real,\n\"accession_number\" text,\n\"sequence_length\" real,\n\"sequence_identity_to_human_protein\" text,\n\"Institution_id\" text,\nPRIMARY KEY(\"common_name\"),\nFOREIGN KEY(\"Institution_id\") REFERENCES \"Institution\"(\"Institution_id\")\n);"} {"qid": "pool_0136", "split": "pool", "db_id": "e_learning", "question": "Which student are enrolled in at least two courses? Give me the student ID and personal name.", "gold_sql": "SELECT T1.student_id , T2.personal_name FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id HAVING COUNT(*) >= 2", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0137", "split": "pool", "db_id": "gymnast", "question": "List the total points of gymnasts in descending order.", "gold_sql": "SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC", "db_path": "databases/gymnast/gymnast.sqlite", "schema": "CREATE TABLE \"gymnast\" (\n\"Gymnast_ID\" int,\n\"Floor_Exercise_Points\" real,\n\"Pommel_Horse_Points\" real,\n\"Rings_Points\" real,\n\"Vault_Points\" real,\n\"Parallel_Bars_Points\" real,\n\"Horizontal_Bar_Points\" real,\n\"Total_Points\" real,\nPRIMARY KEY (\"Gymnast_ID\"),\nFOREIGN KEY (\"Gymnast_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Age\" real,\n\"Height\" real,\n\"Hometown\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0138", "split": "pool", "db_id": "department_store", "question": "Find the id of suppliers whose average amount purchased for each product is above 50000 or below 30000.", "gold_sql": "SELECT supplier_id FROM Product_Suppliers GROUP BY supplier_id HAVING avg(total_amount_purchased) > 50000 OR avg(total_amount_purchased) < 30000", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0139", "split": "pool", "db_id": "e_learning", "question": "Return the descriptions and names of the courses that have more than two students enrolled in.", "gold_sql": "SELECT T1.course_description , T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name HAVING COUNT(*) > 2", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0140", "split": "pool", "db_id": "flight_4", "question": "What is the number of different different airports that are destinations for American Airlines?", "gold_sql": "SELECT count(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0141", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "List all role codes, role names, and role descriptions.", "gold_sql": "SELECT role_code , role_name , role_description FROM ROLES", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0142", "split": "pool", "db_id": "music_1", "question": "How many artists are from Bangladesh?", "gold_sql": "SELECT count(*) FROM artist WHERE country = \"Bangladesh\"", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0143", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What is the id of the project with least number of documents?", "gold_sql": "SELECT project_id FROM Documents GROUP BY project_id ORDER BY count(*) ASC LIMIT 1", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0144", "split": "pool", "db_id": "loan_1", "question": "Find the city and state of the bank branch named morningside.", "gold_sql": "SELECT city , state FROM bank WHERE bname = 'morningside'", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0145", "split": "pool", "db_id": "apartment_rentals", "question": "Show the short names of the buildings managed by \"Emma\".", "gold_sql": "SELECT building_short_name FROM Apartment_Buildings WHERE building_manager\t = \"Emma\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0146", "split": "pool", "db_id": "phone_market", "question": "List the names of phones in ascending order of price.", "gold_sql": "SELECT Name FROM phone ORDER BY Price ASC", "db_path": "databases/phone_market/phone_market.sqlite", "schema": "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);\nCREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);\nCREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);"} {"qid": "pool_0147", "split": "pool", "db_id": "e_government", "question": "Which state can address \"6862 Kaitlyn Knolls\" possibly be in?", "gold_sql": "SELECT state_province_county FROM addresses WHERE line_1_number_building LIKE \"%6862 Kaitlyn Knolls%\"", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0148", "split": "pool", "db_id": "climbing", "question": "What is the maximum point for climbers whose country is United Kingdom?", "gold_sql": "SELECT max(Points) FROM climber WHERE Country = \"United Kingdom\"", "db_path": "databases/climbing/climbing.sqlite", "schema": "CREATE TABLE \"climber\" (\n\"Climber_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Time\" text,\n\"Points\" real,\n\"Mountain_ID\" int,\nPRIMARY KEY (\"Climber_ID\"),\nFOREIGN KEY (\"Mountain_ID\") REFERENCES \"mountain\"(\"Mountain_ID\")\n);\nCREATE TABLE \"mountain\" (\n\"Mountain_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Prominence\" real,\n\"Range\" text,\n\"Country\" text,\nPRIMARY KEY (\"Mountain_ID\")\n);"} {"qid": "pool_0149", "split": "pool", "db_id": "flight_1", "question": "Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.", "gold_sql": "SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0150", "split": "pool", "db_id": "college_3", "question": "Find the first names of students whose first names contain letter \"a\".", "gold_sql": "SELECT DISTINCT Fname FROM STUDENT WHERE Fname LIKE '%a%'", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0151", "split": "pool", "db_id": "soccer_2", "question": "How many colleges has more than 15000 students?", "gold_sql": "SELECT count(*) FROM College WHERE enr > 15000", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0152", "split": "pool", "db_id": "soccer_2", "question": "How many hours do the players train on average?", "gold_sql": "SELECT avg(HS) FROM Player", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0153", "split": "pool", "db_id": "cre_Theme_park", "question": "Which tourist attractions does the visitor with detail 'Vincent' visit?", "gold_sql": "SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID JOIN VISITORS AS T3 ON T2.Tourist_ID = T3.Tourist_ID WHERE T3.Tourist_Details = \"Vincent\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0154", "split": "pool", "db_id": "e_learning", "question": "What are all the dates of enrollment and completion in record?", "gold_sql": "SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0155", "split": "pool", "db_id": "store_1", "question": "What is Astrid Gruber's email and phone number?", "gold_sql": "SELECT email , phone FROM customers WHERE first_name = \"Astrid\" AND last_name = \"Gruber\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0156", "split": "pool", "db_id": "dorm_1", "question": "What is the name and capacity of the dorm with the fewest amount of amenities?", "gold_sql": "SELECT T1.dorm_name , T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY count(*) LIMIT 1", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0157", "split": "pool", "db_id": "aircraft", "question": "What is the number of aircraft?", "gold_sql": "SELECT count(*) FROM aircraft", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0158", "split": "pool", "db_id": "entrepreneur", "question": "List the companies of entrepreneurs in descending order of money requested.", "gold_sql": "SELECT Company FROM entrepreneur ORDER BY Money_Requested DESC", "db_path": "databases/entrepreneur/entrepreneur.sqlite", "schema": "CREATE TABLE \"entrepreneur\" (\n\"Entrepreneur_ID\" int,\n\"People_ID\" int,\n\"Company\" text,\n\"Money_Requested\" real,\n\"Investor\" text,\nPRIMARY KEY (\"Entrepreneur_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Date_of_Birth\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0159", "split": "pool", "db_id": "gas_company", "question": "How many gas companies are there?", "gold_sql": "SELECT count(*) FROM company", "db_path": "databases/gas_company/gas_company.sqlite", "schema": "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);"} {"qid": "pool_0160", "split": "pool", "db_id": "college_3", "question": "What are the department name and room for the course INTRODUCTION TO COMPUTER SCIENCE?", "gold_sql": "SELECT T2.Dname , T2.Room FROM COURSE AS T1 JOIN DEPARTMENT AS T2 ON T1.DNO = T2.DNO WHERE T1.CName = \"INTRODUCTION TO COMPUTER SCIENCE\"", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0161", "split": "pool", "db_id": "music_4", "question": "What is the famous release date of the artist with the oldest age?", "gold_sql": "SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0162", "split": "pool", "db_id": "icfp_1", "question": "Find the number of papers published by the institution \"University of Pennsylvania\".", "gold_sql": "SELECT count(DISTINCT t1.title) FROM papers AS t1 JOIN authorship AS t2 ON t1.paperid = t2.paperid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = \"University of Pennsylvania\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0163", "split": "pool", "db_id": "college_2", "question": "What are the building, room number, semester and year of courses in the Psychology department, sorted using course title?", "gold_sql": "SELECT T2.building , T2.room_number , T2.semester , T2.year FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE T1.dept_name = 'Psychology' ORDER BY T1.title", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0164", "split": "pool", "db_id": "e_government", "question": "What are the names of all cities and states?", "gold_sql": "SELECT town_city FROM addresses UNION SELECT state_province_county FROM addresses", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0165", "split": "pool", "db_id": "news_report", "question": "What is the nationality of the journalist with the largest number of years working?", "gold_sql": "SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1", "db_path": "databases/news_report/news_report.sqlite", "schema": "CREATE TABLE \"event\" (\n \"Event_ID\" int,\n \"Date\" text,\n \"Venue\" text,\n \"Name\" text,\n \"Event_Attendance\" int,\n PRIMARY KEY (\"Event_ID\")\n);\nCREATE TABLE \"journalist\" (\n \"journalist_ID\" int,\n \"Name\" text,\n \"Nationality\" text,\n \"Age\" text,\n \"Years_working\" int,\n PRIMARY KEY (\"journalist_ID\")\n);\nCREATE TABLE \"news_report\" (\n \"journalist_ID\" int,\n \"Event_ID\" int,\n \"Work_Type\" text,\n PRIMARY KEY (\"journalist_ID\",\"Event_ID\"),\n FOREIGN KEY (\"journalist_ID\") REFERENCES `journalist`(\"journalist_ID\"),\n FOREIGN KEY (\"Event_ID\") REFERENCES `event`(\"Event_ID\")\n);"} {"qid": "pool_0166", "split": "pool", "db_id": "customers_and_invoices", "question": "Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.", "gold_sql": "SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0167", "split": "pool", "db_id": "voter_2", "question": "Find the first names of students with age above 22.", "gold_sql": "SELECT Fname FROM STUDENT WHERE Age > 22", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0168", "split": "pool", "db_id": "flight_company", "question": "which pilot is in charge of the most number of flights?", "gold_sql": "SELECT pilot FROM flight GROUP BY pilot ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_company/flight_company.sqlite", "schema": "CREATE TABLE \"airport\" (\n\"id\" int,\n\"City\" text,\n\"Country\" text,\n\"IATA\" text,\n\"ICAO\" text,\n\"name\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"flight\" (\n\"id\" int,\n\"Vehicle_Flight_number\" text,\n\"Date\" text,\n\"Pilot\" text,\n\"Velocity\" real,\n\"Altitude\" real,\n\"airport_id\" int,\n\"company_id\" int,\nprimary key (\"id\"),\nforeign key (\"airport_id\") references `airport`(\"id\"),\nforeign key (\"company_id\") references `operate_company`(\"id\")\n);\nCREATE TABLE \"operate_company\" (\n\"id\" int,\n\"name\" text,\n\"Type\" text,\n\"Principal_activities\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0169", "split": "pool", "db_id": "city_record", "question": "Give me a list of cities whose temperature in March is lower than that in July or higher than that in Oct?", "gold_sql": "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Mar < T2.Jul OR T2.Mar > T2.Oct", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0170", "split": "pool", "db_id": "sports_competition", "question": "What are the names of all players that got more than the average number of points?", "gold_sql": "SELECT name FROM player WHERE points > (SELECT avg(points) FROM player)", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0171", "split": "pool", "db_id": "college_1", "question": "Which department has the most professors with a Ph.D.?", "gold_sql": "SELECT T2.dept_name , T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0172", "split": "pool", "db_id": "activity_1", "question": "What is the first and last name of the student participating in the most activities?", "gold_sql": "SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0173", "split": "pool", "db_id": "student_assessment", "question": "Find the cell mobile number of the candidates whose assessment code is \"Fail\"?", "gold_sql": "SELECT T3.cell_mobile_number FROM candidates AS T1 JOIN candidate_assessments AS T2 ON T1.candidate_id = T2.candidate_id JOIN people AS T3 ON T1.candidate_id = T3.person_id WHERE T2.asessment_outcome_code = \"Fail\"", "db_path": "databases/student_assessment/student_assessment.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_1 VARCHAR(80),\nline_2 VARCHAR(80),\ncity VARCHAR(50),\nzip_postcode CHAR(20),\nstate_province_county VARCHAR(50),\ncountry VARCHAR(50),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Candidate_Assessments (\ncandidate_id INTEGER NOT NULL,\nqualification CHAR(15) NOT NULL,\nassessment_date DATETIME NOT NULL,\nasessment_outcome_code CHAR(15) NOT NULL,\nPRIMARY KEY (candidate_id, qualification),\nFOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)\n);\nCREATE TABLE Candidates (\ncandidate_id INTEGER NOT NULL ,\ncandidate_details VARCHAR(255),\nPRIMARY KEY (candidate_id),\nFOREIGN KEY (candidate_id) REFERENCES People (person_id)\n);\nCREATE TABLE Courses (\ncourse_id VARCHAR(100) NOT NULL,\ncourse_name VARCHAR(120),\ncourse_description VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (course_id)\n);\nCREATE TABLE People (\nperson_id INTEGER NOT NULL,\nfirst_name VARCHAR(255),\nmiddle_name VARCHAR(255),\nlast_name VARCHAR(255),\ncell_mobile_number VARCHAR(40),\nemail_address VARCHAR(40),\nlogin_name VARCHAR(40),\npassword VARCHAR(40),\nPRIMARY KEY (person_id)\n);\nCREATE TABLE People_Addresses (\nperson_address_id INTEGER NOT NULL,\nperson_id INTEGER NOT NULL,\naddress_id INTEGER NOT NULL,\ndate_from DATETIME,\ndate_to DATETIME,\nPRIMARY KEY (person_address_id),\nFOREIGN KEY (person_id) REFERENCES People (person_id),\nFOREIGN KEY (address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Student_Course_Attendance (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\ndate_of_attendance DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)\n);\nCREATE TABLE Student_Course_Registrations (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\nregistration_date DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id) REFERENCES Students (student_id),\nFOREIGN KEY (course_id) REFERENCES Courses (course_id)\n);\nCREATE TABLE Students (\nstudent_id INTEGER NOT NULL,\nstudent_details VARCHAR(255),\nPRIMARY KEY (student_id),\nFOREIGN KEY (student_id) REFERENCES People (person_id)\n);"} {"qid": "pool_0174", "split": "pool", "db_id": "swimming", "question": "Find the names of swimmers who has a result of \"win\".", "gold_sql": "SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win'", "db_path": "databases/swimming/swimming.sqlite", "schema": "CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);\nCREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);\nCREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);\nCREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);"} {"qid": "pool_0175", "split": "pool", "db_id": "music_4", "question": "Return the number of music festivals of each category.", "gold_sql": "SELECT Category , COUNT(*) FROM music_festival GROUP BY Category", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0176", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "Show all statement id and the number of accounts for each statement.", "gold_sql": "SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0177", "split": "pool", "db_id": "tracking_software_problems", "question": "Which problem id and log id are assigned to the staff named Rylan Homenick?", "gold_sql": "SELECT DISTINCT T2.problem_id , T2.problem_log_id FROM staff AS T1 JOIN problem_log AS T2 ON T1.staff_id = T2.assigned_to_staff_id WHERE T1.staff_first_name = \"Rylan\" AND T1.staff_last_name = \"Homenick\"", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0178", "split": "pool", "db_id": "store_1", "question": "A list of the top 8 countries by gross/total invoice size. List country name and gross invoice size.", "gold_sql": "SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0179", "split": "pool", "db_id": "gymnast", "question": "Give the different hometowns of gymnasts that have a total point score of above 57.5.", "gold_sql": "SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE T1.Total_Points > 57.5", "db_path": "databases/gymnast/gymnast.sqlite", "schema": "CREATE TABLE \"gymnast\" (\n\"Gymnast_ID\" int,\n\"Floor_Exercise_Points\" real,\n\"Pommel_Horse_Points\" real,\n\"Rings_Points\" real,\n\"Vault_Points\" real,\n\"Parallel_Bars_Points\" real,\n\"Horizontal_Bar_Points\" real,\n\"Total_Points\" real,\nPRIMARY KEY (\"Gymnast_ID\"),\nFOREIGN KEY (\"Gymnast_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Age\" real,\n\"Height\" real,\n\"Hometown\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0180", "split": "pool", "db_id": "college_1", "question": "What are the first names of all students who got a grade C in a class?", "gold_sql": "SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0181", "split": "pool", "db_id": "program_share", "question": "Show me the owner of the channel with the highest rating.", "gold_sql": "SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1", "db_path": "databases/program_share/program_share.sqlite", "schema": "CREATE TABLE \"broadcast\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Time_of_day\" text,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"broadcast_share\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Date\" text,\n\"Share_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"channel\" (\n\"Channel_ID\" int,\n\"Name\" text,\n\"Owner\" text,\n\"Share_in_percent\" real,\n\"Rating_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\")\n);\nCREATE TABLE \"program\" (\n\"Program_ID\" int,\n\"Name\" text,\n\"Origin\" text,\n\"Launch\" real,\n\"Owner\" text,\nPRIMARY KEY (\"Program_ID\")\n);"} {"qid": "pool_0182", "split": "pool", "db_id": "device", "question": "What are the carriers of devices that are not in stock anywhere?", "gold_sql": "SELECT Carrier FROM device WHERE Device_ID NOT IN (SELECT Device_ID FROM stock)", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0183", "split": "pool", "db_id": "bike_1", "question": "What are the days that had the smallest temperature range, and what was that range?", "gold_sql": "SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0184", "split": "pool", "db_id": "department_store", "question": "What are the ids of products from the supplier with id 2, which are more expensive than the average price across all products?", "gold_sql": "SELECT T1.product_id FROM product_suppliers AS T1 JOIN products AS T2 ON T1.product_id = T2.product_id WHERE T1.supplier_id = 2 AND T2.product_price > (SELECT avg(product_price) FROM products)", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0185", "split": "pool", "db_id": "election_representative", "question": "What are the life spans of representatives from New York state or Indiana state?", "gold_sql": "SELECT Lifespan FROM representative WHERE State = \"New York\" OR State = \"Indiana\"", "db_path": "databases/election_representative/election_representative.sqlite", "schema": "CREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Representative_ID\" int,\n\"Date\" text,\n\"Votes\" real,\n\"Vote_Percent\" real,\n\"Seats\" real,\n\"Place\" real,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (\"Representative_ID\") REFERENCES `representative`(\"Representative_ID\")\n);\nCREATE TABLE \"representative\" (\n\"Representative_ID\" int,\n\"Name\" text,\n\"State\" text,\n\"Party\" text,\n\"Lifespan\" text,\nPRIMARY KEY (\"Representative_ID\")\n);"} {"qid": "pool_0186", "split": "pool", "db_id": "soccer_2", "question": "Find the names of either colleges in LA with greater than 15000 size or in state AZ with less than 13000 enrollment.", "gold_sql": "SELECT cName FROM College WHERE enr < 13000 AND state = \"AZ\" UNION SELECT cName FROM College WHERE enr > 15000 AND state = \"LA\"", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0187", "split": "pool", "db_id": "workshop_paper", "question": "Find the author for each submission and list them in ascending order of submission score.", "gold_sql": "SELECT Author FROM submission ORDER BY Scores ASC", "db_path": "databases/workshop_paper/workshop_paper.sqlite", "schema": "CREATE TABLE \"Acceptance\" (\n\"Submission_ID\" int,\n\"Workshop_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Submission_ID\",\"Workshop_ID\"),\nFOREIGN KEY (\"Submission_ID\") REFERENCES `submission`(\"Submission_ID\"),\nFOREIGN KEY (\"Workshop_ID\") REFERENCES `workshop`(\"Workshop_ID\")\n);\nCREATE TABLE \"submission\" (\n\"Submission_ID\" int,\n\"Scores\" real,\n\"Author\" text,\n\"College\" text,\nPRIMARY KEY (\"Submission_ID\")\n);\nCREATE TABLE \"workshop\" (\n\"Workshop_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Name\" text,\nPRIMARY KEY (\"Workshop_ID\")\n);"} {"qid": "pool_0188", "split": "pool", "db_id": "wine_1", "question": "Find the maximum price of wins from the appelations in Central Coast area and produced before the year of 2005.", "gold_sql": "SELECT max(T2.Price) FROM APPELLATIONS AS T1 JOIN WINE AS T2 ON T1.Appelation = T2.Appelation WHERE T1.Area = \"Central Coast\" AND T2.year < 2005", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0189", "split": "pool", "db_id": "sports_competition", "question": "what is the name of the country that participated in the most tournament competitions?", "gold_sql": "SELECT country FROM competition WHERE competition_type = 'Tournament' GROUP BY country ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0190", "split": "pool", "db_id": "browser_web", "question": "List the ids, names and market shares of all browsers.", "gold_sql": "SELECT id , name , market_share FROM browser", "db_path": "databases/browser_web/browser_web.sqlite", "schema": "CREATE TABLE \"Web_client_accelerator\" (\n\"id\" int,\n\"name\" text,\n\"Operating_system\" text,\n\"Client\" text,\n\"Connection\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"accelerator_compatible_browser\" (\n\"accelerator_id\" int,\n\"browser_id\" int,\n\"compatible_since_year\" int,\nprimary key(\"accelerator_id\", \"browser_id\"),\nforeign key (\"accelerator_id\") references `Web_client_accelerator`(\"id\"),\nforeign key (\"browser_id\") references `browser`(\"id\")\n);\nCREATE TABLE \"browser\" (\n\"id\" int,\n\"name\" text,\n\"market_share\" real,\nprimary key(\"id\")\n);"} {"qid": "pool_0191", "split": "pool", "db_id": "match_season", "question": "Show the positions of the players from the team with name \"Ryley Goldner\".", "gold_sql": "SELECT T1.Position FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = \"Ryley Goldner\"", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0192", "split": "pool", "db_id": "baseball_1", "question": "Which park had most attendances in 2008?", "gold_sql": "SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0193", "split": "pool", "db_id": "e_government", "question": "Find the payment method code used by more than 3 parties.", "gold_sql": "SELECT payment_method_code FROM parties GROUP BY payment_method_code HAVING count(*) > 3", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0194", "split": "pool", "db_id": "chinook_1", "question": "Find the average millisecond length of Latin and Pop tracks.", "gold_sql": "SELECT AVG(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = \"Latin\" OR T1.Name = \"Pop\"", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0195", "split": "pool", "db_id": "match_season", "question": "Show the season, the player, and the name of the country that player belongs to.", "gold_sql": "SELECT T2.Season , T2.Player , T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0196", "split": "pool", "db_id": "department_store", "question": "What are the phone numbers of all customers and suppliers.", "gold_sql": "SELECT customer_phone FROM customers UNION SELECT supplier_phone FROM suppliers", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0197", "split": "pool", "db_id": "company_office", "question": "What is the stories of highest building?", "gold_sql": "SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1", "db_path": "databases/company_office/company_office.sqlite", "schema": "CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);\nCREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);\nCREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);"} {"qid": "pool_0198", "split": "pool", "db_id": "tracking_software_problems", "question": "What are the product ids for the problems reported by Christop Berge with closure authorised by Ashley Medhurst?", "gold_sql": "SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.reported_by_staff_id = T2.staff_id WHERE T2.staff_first_name = \"Christop\" AND T2.staff_last_name = \"Berge\" INTERSECT SELECT product_id FROM problems AS T1 JOIN staff AS T2 ON T1.closure_authorised_by_staff_id = T2.staff_id WHERE T2.staff_first_name = \"Ashley\" AND T2.staff_last_name = \"Medhurst\"", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0199", "split": "pool", "db_id": "allergy_1", "question": "Provide the last name of the youngest student.", "gold_sql": "SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0200", "split": "pool", "db_id": "student_assessment", "question": "What are the ids of the students who registered for course 301?", "gold_sql": "SELECT student_id FROM student_course_attendance WHERE course_id = 301", "db_path": "databases/student_assessment/student_assessment.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_1 VARCHAR(80),\nline_2 VARCHAR(80),\ncity VARCHAR(50),\nzip_postcode CHAR(20),\nstate_province_county VARCHAR(50),\ncountry VARCHAR(50),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Candidate_Assessments (\ncandidate_id INTEGER NOT NULL,\nqualification CHAR(15) NOT NULL,\nassessment_date DATETIME NOT NULL,\nasessment_outcome_code CHAR(15) NOT NULL,\nPRIMARY KEY (candidate_id, qualification),\nFOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)\n);\nCREATE TABLE Candidates (\ncandidate_id INTEGER NOT NULL ,\ncandidate_details VARCHAR(255),\nPRIMARY KEY (candidate_id),\nFOREIGN KEY (candidate_id) REFERENCES People (person_id)\n);\nCREATE TABLE Courses (\ncourse_id VARCHAR(100) NOT NULL,\ncourse_name VARCHAR(120),\ncourse_description VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (course_id)\n);\nCREATE TABLE People (\nperson_id INTEGER NOT NULL,\nfirst_name VARCHAR(255),\nmiddle_name VARCHAR(255),\nlast_name VARCHAR(255),\ncell_mobile_number VARCHAR(40),\nemail_address VARCHAR(40),\nlogin_name VARCHAR(40),\npassword VARCHAR(40),\nPRIMARY KEY (person_id)\n);\nCREATE TABLE People_Addresses (\nperson_address_id INTEGER NOT NULL,\nperson_id INTEGER NOT NULL,\naddress_id INTEGER NOT NULL,\ndate_from DATETIME,\ndate_to DATETIME,\nPRIMARY KEY (person_address_id),\nFOREIGN KEY (person_id) REFERENCES People (person_id),\nFOREIGN KEY (address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Student_Course_Attendance (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\ndate_of_attendance DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)\n);\nCREATE TABLE Student_Course_Registrations (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\nregistration_date DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id) REFERENCES Students (student_id),\nFOREIGN KEY (course_id) REFERENCES Courses (course_id)\n);\nCREATE TABLE Students (\nstudent_id INTEGER NOT NULL,\nstudent_details VARCHAR(255),\nPRIMARY KEY (student_id),\nFOREIGN KEY (student_id) REFERENCES People (person_id)\n);"} {"qid": "pool_0201", "split": "pool", "db_id": "e_learning", "question": "How many distinct courses are enrolled in by students?", "gold_sql": "SELECT count(course_id) FROM Student_Course_Enrolment", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0202", "split": "pool", "db_id": "device", "question": "What are the names of shops in ascending order of open year?", "gold_sql": "SELECT Shop_Name FROM shop ORDER BY Open_Year ASC", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0203", "split": "pool", "db_id": "dorm_1", "question": "Find the average age of students who are living in the dorm with the largest capacity.", "gold_sql": "SELECT avg(T1.age) FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.student_capacity = (SELECT max(student_capacity) FROM dorm)", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0204", "split": "pool", "db_id": "store_1", "question": "Find number of tracks in each genre?", "gold_sql": "SELECT count(*) , T1.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id GROUP BY T1.name;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0205", "split": "pool", "db_id": "e_government", "question": "What is the last name of the first individual contacted from the organization with the maximum UK Vat number across all organizations?", "gold_sql": "SELECT t3.individual_last_name FROM organizations AS t1 JOIN organization_contact_individuals AS t2 ON t1.organization_id = t2.organization_id JOIN individuals AS t3 ON t2.individual_id = t3.individual_id WHERE t1.uk_vat_number = (SELECT max(uk_vat_number) FROM organizations) ORDER BY t2.date_contact_to ASC LIMIT 1", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0206", "split": "pool", "db_id": "activity_1", "question": "Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in.", "gold_sql": "SELECT T1.fname , T1.lname , count(*) , T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0207", "split": "pool", "db_id": "flight_1", "question": "Show all origins and the number of flights from each origin.", "gold_sql": "SELECT origin , count(*) FROM Flight GROUP BY origin", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0208", "split": "pool", "db_id": "college_1", "question": "Which school has the smallest amount of professors?", "gold_sql": "SELECT T1.school_code FROM department AS T1 JOIN professor AS T2 ON T1.dept_code = T2.dept_code GROUP BY T1.school_code ORDER BY count(*) LIMIT 1", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0209", "split": "pool", "db_id": "station_weather", "question": "Find names and times of trains that run through stations for the local authority Chiltern.", "gold_sql": "SELECT t3.name , t3.time FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id JOIN train AS t3 ON t2.train_id = t3.id WHERE t1.local_authority = \"Chiltern\"", "db_path": "databases/station_weather/station_weather.sqlite", "schema": "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);\nCREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);"} {"qid": "pool_0210", "split": "pool", "db_id": "store_1", "question": "List the name of albums that are released by aritist whose name has 'Led'", "gold_sql": "SELECT T2.title FROM artists AS T1 JOIN albums AS T2 ON T1.id = T2.artist_id WHERE T1.name LIKE '%Led%'", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0211", "split": "pool", "db_id": "flight_1", "question": "Show names for all employees who do not have certificate of Boeing 737-800.", "gold_sql": "SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = \"Boeing 737-800\"", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0212", "split": "pool", "db_id": "aircraft", "question": "List the names of aircrafts and the number of times it won matches.", "gold_sql": "SELECT T1.Aircraft , COUNT(*) FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0213", "split": "pool", "db_id": "solvency_ii", "question": "Show the names of products and the number of events they are in, sorted by the number of events in descending order.", "gold_sql": "SELECT T1.Product_Name , COUNT(*) FROM Products AS T1 JOIN Products_in_Events AS T2 ON T1.Product_ID = T2.Product_ID GROUP BY T1.Product_Name ORDER BY COUNT(*) DESC", "db_path": "databases/solvency_ii/solvency_ii.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID INTEGER NOT NULL ,\naddress_details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Agreements (\nDocument_ID INTEGER NOT NULL ,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);\nCREATE TABLE Assets (\nAsset_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Asset_ID)\n);\nCREATE TABLE Assets_in_Events (\nAsset_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nPRIMARY KEY (Asset_ID, Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);\nCREATE TABLE Channels (\nChannel_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Channel_ID)\n);\nCREATE TABLE Events (\nEvent_ID INTEGER NOT NULL ,\nAddress_ID INTEGER,\nChannel_ID INTEGER NOT NULL,\nEvent_Type_Code CHAR(15),\nFinance_ID INTEGER NOT NULL,\nLocation_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID),\nUNIQUE (Event_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Finance_ID) REFERENCES Finances (Finance_ID)\n);\nCREATE TABLE Finances (\nFinance_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Finance_ID)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL ,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Parties (\nParty_ID INTEGER NOT NULL,\nParty_Details VARCHAR(255),\nPRIMARY KEY (Party_ID)\n);\nCREATE TABLE Parties_in_Events (\nParty_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nRole_Code CHAR(15),\nPRIMARY KEY (Party_ID, Event_ID),\nFOREIGN KEY (Party_ID) REFERENCES Parties (Party_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);\nCREATE TABLE Products (\nProduct_ID INTEGER NOT NULL,\nProduct_Type_Code CHAR(15),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Products_in_Events (\nProduct_in_Event_ID INTEGER NOT NULL,\nEvent_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Product_in_Event_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);"} {"qid": "pool_0214", "split": "pool", "db_id": "movie_1", "question": "What are the names of all directors who made one movie?", "gold_sql": "SELECT director FROM Movie GROUP BY director HAVING count(*) = 1", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0215", "split": "pool", "db_id": "sports_competition", "question": "What are the types of competition that have most 5 competitions for that type?", "gold_sql": "SELECT Competition_type FROM competition GROUP BY Competition_type HAVING COUNT(*) <= 5", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0216", "split": "pool", "db_id": "shop_membership", "question": "Show the city and the number of branches opened before 2010 for each city.", "gold_sql": "SELECT city , count(*) FROM branch WHERE open_year < 2010 GROUP BY city", "db_path": "databases/shop_membership/shop_membership.sqlite", "schema": "CREATE TABLE \"branch\" (\n\"Branch_ID\" int,\n\"Name\" text,\n\"Open_year\" text,\n\"Address_road\" text,\n\"City\" text,\n\"membership_amount\" text,\nPRIMARY KEY (\"Branch_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Card_Number\" text,\n\"Name\" text,\n\"Hometown\" text,\n\"Level\" int,\nPRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"membership_register_branch\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Register_Year\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);\nCREATE TABLE \"purchase\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Year\" text,\n\"Total_pounds\" real,\nPRIMARY KEY (\"Member_ID\",\"Branch_ID\",\"Year\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);"} {"qid": "pool_0217", "split": "pool", "db_id": "store_1", "question": "What are the top 10 customers' first and last names by total number of orders and how many orders did they make?", "gold_sql": "SELECT T1.first_name , T1.last_name , COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0218", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "Give the ids of documents that have expenses and contain the letter s in their names.", "gold_sql": "SELECT T1.document_id FROM Documents AS T1 JOIN Documents_with_expenses AS T2 ON T1.document_id = T2.document_id WHERE T1.document_name LIKE '%s%'", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0219", "split": "pool", "db_id": "department_store", "question": "Find the name of the most expensive hardware product.", "gold_sql": "SELECT product_name FROM products WHERE product_type_code = 'Hardware' ORDER BY product_price DESC LIMIT 1", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0220", "split": "pool", "db_id": "tracking_software_problems", "question": "Which problem log was created most recently? Give me the log id.", "gold_sql": "SELECT problem_log_id FROM problem_log ORDER BY log_entry_date DESC LIMIT 1", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0221", "split": "pool", "db_id": "baseball_1", "question": "What are the name and id of the team with the most victories in 2008 postseason?", "gold_sql": "SELECT T2.name , T1.team_id_winner FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T1.year = 2008 GROUP BY T1.team_id_winner ORDER BY count(*) DESC LIMIT 1;", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0222", "split": "pool", "db_id": "gymnast", "question": "What are the names of gymnasts, ordered by their heights ascending?", "gold_sql": "SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Height ASC", "db_path": "databases/gymnast/gymnast.sqlite", "schema": "CREATE TABLE \"gymnast\" (\n\"Gymnast_ID\" int,\n\"Floor_Exercise_Points\" real,\n\"Pommel_Horse_Points\" real,\n\"Rings_Points\" real,\n\"Vault_Points\" real,\n\"Parallel_Bars_Points\" real,\n\"Horizontal_Bar_Points\" real,\n\"Total_Points\" real,\nPRIMARY KEY (\"Gymnast_ID\"),\nFOREIGN KEY (\"Gymnast_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Age\" real,\n\"Height\" real,\n\"Hometown\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0223", "split": "pool", "db_id": "icfp_1", "question": "How many papers have \"Atsushi Ohori\" published?", "gold_sql": "SELECT count(*) FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = \"Atsushi\" AND t1.lname = \"Ohori\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0224", "split": "pool", "db_id": "soccer_2", "question": "What are the names of players who train between 500 and 1500 hours?", "gold_sql": "SELECT pName FROM Player WHERE HS BETWEEN 500 AND 1500", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0225", "split": "pool", "db_id": "flight_4", "question": "Which country is the airport that has the highest altitude located in?", "gold_sql": "SELECT country FROM airports ORDER BY elevation DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0226", "split": "pool", "db_id": "dorm_1", "question": "Find the average age of students living in each dorm and the name of dorm.", "gold_sql": "SELECT avg(T1.age) , T3.dorm_name FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid GROUP BY T3.dorm_name", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0227", "split": "pool", "db_id": "cre_Theme_park", "question": "What are the price ranges of five star hotels?", "gold_sql": "SELECT price_range FROM HOTELS WHERE star_rating_code = \"5\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0228", "split": "pool", "db_id": "company_office", "question": "Which industries have both companies with headquarter in \"USA\" and companies with headquarter in \"China\"?", "gold_sql": "SELECT Industry FROM Companies WHERE Headquarters = \"USA\" INTERSECT SELECT Industry FROM Companies WHERE Headquarters = \"China\"", "db_path": "databases/company_office/company_office.sqlite", "schema": "CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);\nCREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);\nCREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);"} {"qid": "pool_0229", "split": "pool", "db_id": "flight_1", "question": "What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?", "gold_sql": "SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0230", "split": "pool", "db_id": "city_record", "question": "Which cities have higher temperature in Feb than in Jun or have once served as host cities?", "gold_sql": "SELECT T1.city FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T2.Feb > T2.Jun UNION SELECT T3.city FROM city AS T3 JOIN hosting_city AS T4 ON T3.city_id = T4.host_city", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0231", "split": "pool", "db_id": "bike_1", "question": "What are the dates with a maximum temperature higher than 85?", "gold_sql": "SELECT date FROM weather WHERE max_temperature_f > 85", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0232", "split": "pool", "db_id": "hospital_1", "question": "Find the name of the patient who made the appointment with the most recent start date.", "gold_sql": "SELECT T1.name FROM patient AS T1 JOIN appointment AS T2 ON T1.ssn = T2.patient ORDER BY T2.start DESC LIMIT 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0233", "split": "pool", "db_id": "cinema", "question": "What are the title and director of each film?", "gold_sql": "SELECT title , directed_by FROM film", "db_path": "databases/cinema/cinema.sqlite", "schema": "CREATE TABLE \"cinema\" (\n\"Cinema_ID\" int,\n\"Name\" text,\n\"Openning_year\" int,\n\"Capacity\" int,\n\"Location\" text,\nPRIMARY KEY (\"Cinema_ID\"));\nCREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Rank_in_series\" int,\n\"Number_in_season\" int,\n\"Title\" text,\n\"Directed_by\" text,\n\"Original_air_date\" text,\n\"Production_code\" text,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"schedule\" (\n\"Cinema_ID\" int,\n\"Film_ID\" int,\n\"Date\" text,\n\"Show_times_per_day\" int,\n\"Price\" float,\nPRIMARY KEY (\"Cinema_ID\",\"Film_ID\"),\nFOREIGN KEY (`Film_ID`) REFERENCES `film`(`Film_ID`),\nFOREIGN KEY (`Cinema_ID`) REFERENCES `cinema`(`Cinema_ID`)\n);"} {"qid": "pool_0234", "split": "pool", "db_id": "chinook_1", "question": "List the names of all music genres.", "gold_sql": "SELECT Name FROM GENRE", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0235", "split": "pool", "db_id": "loan_1", "question": "What are the names of customers who do not have saving accounts?", "gold_sql": "SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type = 'saving'", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0236", "split": "pool", "db_id": "entertainment_awards", "question": "What are the total number of the audiences who visited any of the festivals?", "gold_sql": "SELECT sum(Num_of_Audience) FROM festival_detail", "db_path": "databases/entertainment_awards/entertainment_awards.sqlite", "schema": "CREATE TABLE artwork (\n\"Artwork_ID\" int,\n\"Type\" text,\n\"Name\" text,\nPRIMARY KEY (\"Artwork_ID\")\n);\nCREATE TABLE \"festival_detail\" (\n\"Festival_ID\" int,\n\"Festival_Name\" text,\n\"Chair_Name\" text,\n\"Location\" text,\n\"Year\" int,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Festival_ID\")\n);\nCREATE TABLE nomination (\n\"Artwork_ID\" int,\n\"Festival_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Artwork_ID\",\"Festival_ID\"),\nFOREIGN KEY (\"Artwork_ID\") REFERENCES `artwork`(\"Artwork_ID\"),\nFOREIGN KEY (\"Festival_ID\") REFERENCES `festival_detail`(\"Festival_ID\")\n);"} {"qid": "pool_0237", "split": "pool", "db_id": "music_1", "question": "What is the name of the song that was released in the most recent year?", "gold_sql": "SELECT song_name , releasedate FROM song ORDER BY releasedate DESC LIMIT 1", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0238", "split": "pool", "db_id": "soccer_2", "question": "How many states have smaller colleges than average?", "gold_sql": "SELECT count(DISTINCT state) FROM college WHERE enr < (SELECT avg(enr) FROM college)", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0239", "split": "pool", "db_id": "insurance_and_eClaims", "question": "What are the type codes of the policies used by the customer \"Dayana Robel\"?", "gold_sql": "SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = \"Dayana Robel\"", "db_path": "databases/insurance_and_eClaims/insurance_and_eClaims.sqlite", "schema": "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);\nCREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);"} {"qid": "pool_0240", "split": "pool", "db_id": "movie_1", "question": "What are the names of all directors whose movies have been reviewed by Sarah Martinez?", "gold_sql": "SELECT DISTINCT T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Sarah Martinez'", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0241", "split": "pool", "db_id": "customers_and_invoices", "question": "Show the product ids and the number of unique orders containing each product.", "gold_sql": "SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0242", "split": "pool", "db_id": "city_record", "question": "Find the GDP of the city with the largest regional population.", "gold_sql": "SELECT gdp FROM city ORDER BY Regional_Population DESC LIMIT 1", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0243", "split": "pool", "db_id": "company_office", "question": "List the names of companies in descending order of market value.", "gold_sql": "SELECT name FROM Companies ORDER BY Market_Value_billion DESC", "db_path": "databases/company_office/company_office.sqlite", "schema": "CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);\nCREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);\nCREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);"} {"qid": "pool_0244", "split": "pool", "db_id": "csu_1", "question": "Find the average fee on a CSU campus in 1996", "gold_sql": "SELECT avg(campusfee) FROM csu_fees WHERE YEAR = 1996", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0245", "split": "pool", "db_id": "music_2", "question": "How many different instruments does the musician with the last name \"Heilo\" use?", "gold_sql": "SELECT count(DISTINCT instrument) FROM instruments AS T1 JOIN Band AS T2 ON T1.bandmateid = T2.id WHERE T2.lastname = \"Heilo\"", "db_path": "databases/music_2/music_2.sqlite", "schema": "CREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Label\" TEXT, \n\t\"Type\" TEXT );\nCREATE TABLE \"Band\" ( \n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Firstname\" TEXT, \n\t\"Lastname\" TEXT );\nCREATE TABLE \"Instruments\" ( \n\t\"SongId\" INTEGER, \n\t\"BandmateId\" INTEGER, \n\t\"Instrument\" TEXT ,\n\tPRIMARY KEY(SongId, BandmateId, Instrument),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (BandmateId) REFERENCES Band(Id)\n);\nCREATE TABLE \"Performance\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"StagePosition\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);\nCREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT \n);\nCREATE TABLE \"Tracklists\" ( \n\t\"AlbumId\" INTEGER, \n\t\"Position\" INTEGER, \n\t\"SongId\" INTEGER ,\n\tPRIMARY KEY(AlbumId, Position),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (AlbumId) REFERENCES Albums(AId)\n);\nCREATE TABLE \"Vocals\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"Type\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);"} {"qid": "pool_0246", "split": "pool", "db_id": "match_season", "question": "What are the players who played for Columbus Crew, and how many years did each play for?", "gold_sql": "SELECT T1.Player , T1.Years_Played FROM player AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = \"Columbus Crew\"", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0247", "split": "pool", "db_id": "e_learning", "question": "Which course is enrolled in by the most students? Give me the course name.", "gold_sql": "SELECT T1.course_name FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0248", "split": "pool", "db_id": "hospital_1", "question": "Find the ids of the nurses who are on call in block floor 1 and block code 1.", "gold_sql": "SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0249", "split": "pool", "db_id": "tracking_grants_for_research", "question": "What is the id of the organization with the maximum number of outcomes and how many outcomes are there?", "gold_sql": "SELECT T1.organisation_id , count(*) FROM Projects AS T1 JOIN Project_outcomes AS T2 ON T1.project_id = T2.project_id GROUP BY T1.organisation_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0250", "split": "pool", "db_id": "soccer_2", "question": "What is the name of school that has the smallest enrollment in each state?", "gold_sql": "SELECT cName , state , min(enr) FROM college GROUP BY state", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0251", "split": "pool", "db_id": "voter_2", "question": "Find the first and last name of all the students of age 18 who have vice president votes.", "gold_sql": "SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0252", "split": "pool", "db_id": "flight_1", "question": "How many aircrafts have distance between 1000 and 5000?", "gold_sql": "SELECT count(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0253", "split": "pool", "db_id": "store_1", "question": "List the name of tracks belongs to genre Rock and whose media type is MPEG audio file.", "gold_sql": "SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = \"Rock\" AND T3.name = \"MPEG audio file\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0254", "split": "pool", "db_id": "browser_web", "question": "give me names of all compatible browsers and accelerators in the descending order of compatible year", "gold_sql": "SELECT T2.name , T3.name FROM accelerator_compatible_browser AS T1 JOIN browser AS T2 ON T1.browser_id = T2.id JOIN web_client_accelerator AS T3 ON T1.accelerator_id = T3.id ORDER BY T1.compatible_since_year DESC", "db_path": "databases/browser_web/browser_web.sqlite", "schema": "CREATE TABLE \"Web_client_accelerator\" (\n\"id\" int,\n\"name\" text,\n\"Operating_system\" text,\n\"Client\" text,\n\"Connection\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"accelerator_compatible_browser\" (\n\"accelerator_id\" int,\n\"browser_id\" int,\n\"compatible_since_year\" int,\nprimary key(\"accelerator_id\", \"browser_id\"),\nforeign key (\"accelerator_id\") references `Web_client_accelerator`(\"id\"),\nforeign key (\"browser_id\") references `browser`(\"id\")\n);\nCREATE TABLE \"browser\" (\n\"id\" int,\n\"name\" text,\n\"market_share\" real,\nprimary key(\"id\")\n);"} {"qid": "pool_0255", "split": "pool", "db_id": "device", "question": "What are the names of shops that do not have any devices in stock?", "gold_sql": "SELECT Shop_Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM stock)", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0256", "split": "pool", "db_id": "driving_school", "question": "What is the total time for all lessons taught by Janessa Sawayn?", "gold_sql": "SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = \"Janessa\" AND T2.last_name = \"Sawayn\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0257", "split": "pool", "db_id": "store_1", "question": "List the top 10 customers by total gross sales. List customers' first and last name and total gross sales.", "gold_sql": "SELECT T1.first_name , T1.last_name , SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id = T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0258", "split": "pool", "db_id": "soccer_2", "question": "How many different players trained for more than 1000 hours?", "gold_sql": "SELECT count(*) FROM Player WHERE HS > 1000", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0259", "split": "pool", "db_id": "csu_1", "question": "How many faculty lines are there at San Francisco State University in 2004?", "gold_sql": "SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2004 AND T2.campus = \"San Francisco State University\"", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0260", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "Show project ids and the number of documents in each project.", "gold_sql": "SELECT project_id , count(*) FROM Documents GROUP BY project_id", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0261", "split": "pool", "db_id": "sports_competition", "question": "What are the different regions of clubs in ascending alphabetical order?", "gold_sql": "SELECT DISTINCT Region FROM club ORDER BY Region ASC", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0262", "split": "pool", "db_id": "riding_club", "question": "List the names of players in ascending order of votes.", "gold_sql": "SELECT Player_name FROM player ORDER BY Votes ASC", "db_path": "databases/riding_club/riding_club.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"Club_name\" text,\n\"Region\" text,\n\"Start_year\" int,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"coach\" (\n\"Coach_ID\" int,\n\"Coach_name\" text,\n\"Gender\" text,\n\"Club_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Coach_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"match_result\" (\n\"Rank\" int,\n\"Club_ID\" int,\n\"Gold\" int,\n\"Big_Silver\" int,\n\"Small_Silver\" int,\n\"Bronze\" int,\n\"Points\" int,\nPRIMARY KEY (\"Rank\",\"Club_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"Sponsor_name\" text,\n\"Player_name\" text,\n\"Gender\" text,\n\"Residence\" text,\n\"Occupation\" text,\n\"Votes\" int,\n\"Rank\" text,\nPRIMARY KEY (\"Player_ID\")\n);\nCREATE TABLE \"player_coach\" (\n\"Player_ID\" int,\n\"Coach_ID\" int,\n\"Starting_year\" int,\nPRIMARY KEY (\"Player_ID\",\"Coach_ID\"),\nFOREIGN KEY (`Player_ID`) REFERENCES `player`(`Player_ID`),\nFOREIGN KEY (`Coach_ID`) REFERENCES `coach`(`Coach_ID`)\n);"} {"qid": "pool_0263", "split": "pool", "db_id": "music_4", "question": "Return the average age across all artists.", "gold_sql": "SELECT avg(Age) FROM artist", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0264", "split": "pool", "db_id": "phone_market", "question": "Show the names of phones with carrier either \"Sprint\" or \"TMobile\".", "gold_sql": "SELECT Name FROM phone WHERE Carrier = \"Sprint\" OR Carrier = \"TMobile\"", "db_path": "databases/phone_market/phone_market.sqlite", "schema": "CREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"District\" text,\n\"Num_of_employees\" int,\n\"Num_of_shops\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Market_ID\")\n);\nCREATE TABLE \"phone\" (\n\"Name\" text,\n\"Phone_ID\" int,\n\"Memory_in_G\" int,\n\"Carrier\" text,\n\"Price\" real,\nPRIMARY KEY (\"Phone_ID\")\n);\nCREATE TABLE \"phone_market\" (\n\"Market_ID\" int,\n\"Phone_ID\" text,\n\"Num_of_stock\" int,\nPRIMARY KEY (\"Market_ID\",\"Phone_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES `market`(\"Market_ID\"),\nFOREIGN KEY (\"Phone_ID\") REFERENCES `phone`(\"Phone_ID\")\n);"} {"qid": "pool_0265", "split": "pool", "db_id": "movie_1", "question": "What are the names of the directors who made exactly one movie excluding director NULL?", "gold_sql": "SELECT director FROM Movie WHERE director != \"null\" GROUP BY director HAVING count(*) = 1", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0266", "split": "pool", "db_id": "network_2", "question": "How old is the youngest person for each job?", "gold_sql": "SELECT min(age) , job FROM Person GROUP BY job", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0267", "split": "pool", "db_id": "products_gen_characteristics", "question": "How many characteristics does the product named \"sesame\" have?", "gold_sql": "SELECT count(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = \"sesame\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0268", "split": "pool", "db_id": "swimming", "question": "Find the names of all swimmers, sorted by their 100 meter scores in ascending order.", "gold_sql": "SELECT name FROM swimmer ORDER BY meter_100", "db_path": "databases/swimming/swimming.sqlite", "schema": "CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);\nCREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);\nCREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);\nCREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);"} {"qid": "pool_0269", "split": "pool", "db_id": "workshop_paper", "question": "What is the average score of submissions?", "gold_sql": "SELECT avg(Scores) FROM submission", "db_path": "databases/workshop_paper/workshop_paper.sqlite", "schema": "CREATE TABLE \"Acceptance\" (\n\"Submission_ID\" int,\n\"Workshop_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Submission_ID\",\"Workshop_ID\"),\nFOREIGN KEY (\"Submission_ID\") REFERENCES `submission`(\"Submission_ID\"),\nFOREIGN KEY (\"Workshop_ID\") REFERENCES `workshop`(\"Workshop_ID\")\n);\nCREATE TABLE \"submission\" (\n\"Submission_ID\" int,\n\"Scores\" real,\n\"Author\" text,\n\"College\" text,\nPRIMARY KEY (\"Submission_ID\")\n);\nCREATE TABLE \"workshop\" (\n\"Workshop_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Name\" text,\nPRIMARY KEY (\"Workshop_ID\")\n);"} {"qid": "pool_0270", "split": "pool", "db_id": "entertainment_awards", "question": "Show the names of the three most recent festivals.", "gold_sql": "SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3", "db_path": "databases/entertainment_awards/entertainment_awards.sqlite", "schema": "CREATE TABLE artwork (\n\"Artwork_ID\" int,\n\"Type\" text,\n\"Name\" text,\nPRIMARY KEY (\"Artwork_ID\")\n);\nCREATE TABLE \"festival_detail\" (\n\"Festival_ID\" int,\n\"Festival_Name\" text,\n\"Chair_Name\" text,\n\"Location\" text,\n\"Year\" int,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Festival_ID\")\n);\nCREATE TABLE nomination (\n\"Artwork_ID\" int,\n\"Festival_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Artwork_ID\",\"Festival_ID\"),\nFOREIGN KEY (\"Artwork_ID\") REFERENCES `artwork`(\"Artwork_ID\"),\nFOREIGN KEY (\"Festival_ID\") REFERENCES `festival_detail`(\"Festival_ID\")\n);"} {"qid": "pool_0271", "split": "pool", "db_id": "hospital_1", "question": "What are the names of the physician who prescribed the highest dose?", "gold_sql": "SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0272", "split": "pool", "db_id": "chinook_1", "question": "Find the name of the artist who made the album \"Balls to the Wall\".", "gold_sql": "SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId WHERE T1.Title = \"Balls to the Wall\"", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0273", "split": "pool", "db_id": "customers_and_invoices", "question": "What are the full names of customers with the account name 900?", "gold_sql": "SELECT T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = \"900\"", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0274", "split": "pool", "db_id": "music_1", "question": "Find the names of songs whose genre is modern or language is English.", "gold_sql": "SELECT song_name FROM song WHERE genre_is = \"modern\" OR languages = \"english\"", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0275", "split": "pool", "db_id": "music_1", "question": "What are the names and number of works for all artists who have sung at least one song in English?", "gold_sql": "SELECT T1.artist_name , count(*) FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.languages = \"english\" GROUP BY T2.artist_name HAVING count(*) >= 1", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0276", "split": "pool", "db_id": "products_gen_characteristics", "question": "Give the unit of measure for the product with the name 'cumin'.", "gold_sql": "SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = \"cumin\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0277", "split": "pool", "db_id": "college_3", "question": "What are the full names of students minoring in department 140?", "gold_sql": "SELECT T2.Fname , T2.Lname FROM MINOR_IN AS T1 JOIN STUDENT AS T2 ON T1.StuID = T2.StuID WHERE T1.DNO = 140", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0278", "split": "pool", "db_id": "election_representative", "question": "What are the names of representatives with more than 10000 votes in election?", "gold_sql": "SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000", "db_path": "databases/election_representative/election_representative.sqlite", "schema": "CREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Representative_ID\" int,\n\"Date\" text,\n\"Votes\" real,\n\"Vote_Percent\" real,\n\"Seats\" real,\n\"Place\" real,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (\"Representative_ID\") REFERENCES `representative`(\"Representative_ID\")\n);\nCREATE TABLE \"representative\" (\n\"Representative_ID\" int,\n\"Name\" text,\n\"State\" text,\n\"Party\" text,\n\"Lifespan\" text,\nPRIMARY KEY (\"Representative_ID\")\n);"} {"qid": "pool_0279", "split": "pool", "db_id": "college_3", "question": "What are the full names of faculties with sex M and who live in building NEB?", "gold_sql": "SELECT Fname , Lname FROM FACULTY WHERE sex = \"M\" AND Building = \"NEB\"", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0280", "split": "pool", "db_id": "voter_2", "question": "What are the distinct last names of the students who have president votes and have 8741 as the advisor?", "gold_sql": "SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = \"8741\"", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0281", "split": "pool", "db_id": "soccer_2", "question": "What are the names of all tryout participants who are from the largest college?", "gold_sql": "SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0282", "split": "pool", "db_id": "store_1", "question": "How many customers live in Prague city?", "gold_sql": "SELECT count(*) FROM customers WHERE city = \"Prague\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0283", "split": "pool", "db_id": "e_learning", "question": "Find the number of distinct students enrolled in courses.", "gold_sql": "SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0284", "split": "pool", "db_id": "e_learning", "question": "Find the dates of the tests taken with result \"Pass\".", "gold_sql": "SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = \"Pass\"", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0285", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "How many distinct currency codes are there for all drama workshop groups?", "gold_sql": "SELECT count(DISTINCT Currency_Code) FROM Drama_Workshop_Groups", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0286", "split": "pool", "db_id": "college_1", "question": "What is the name of the department with the student that has the lowest GPA?", "gold_sql": "SELECT T2.dept_name FROM student AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code ORDER BY stu_gpa LIMIT 1", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0287", "split": "pool", "db_id": "music_1", "question": "How many songs were released for each format?", "gold_sql": "SELECT count(*) , formats FROM files GROUP BY formats", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0288", "split": "pool", "db_id": "e_learning", "question": "What are the personal name, family name, and author ID of the course author who teaches the most courses?", "gold_sql": "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", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0289", "split": "pool", "db_id": "city_record", "question": "Which cities have regional population above 10000000?", "gold_sql": "SELECT city FROM city WHERE regional_population > 10000000", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0290", "split": "pool", "db_id": "icfp_1", "question": "Which papers have \"Stephanie Weirich\" as an author?", "gold_sql": "SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = \"Stephanie\" AND t1.lname = \"Weirich\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0291", "split": "pool", "db_id": "loan_1", "question": "List the name of all different customers who have some loan sorted by their total loan amount.", "gold_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)", "db_path": "databases/loan_1/loan_1.sqlite", "schema": "CREATE TABLE bank (\nbranch_ID int PRIMARY KEY,\nbname varchar(20),\nno_of_customers int,\ncity varchar(10),\nstate varchar(20));\nCREATE TABLE customer (\ncust_ID varchar(3) PRIMARY KEY,\ncust_name varchar(20),\nacc_type char(1),\nacc_bal int,\nno_of_loans int,\ncredit_score int,\nbranch_ID int,\nstate varchar(20),\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID));\nCREATE TABLE loan (\nloan_ID varchar(3) PRIMARY KEY,\nloan_type varchar(15),\ncust_ID varchar(3),\nbranch_ID varchar(3),\namount int,\nFOREIGN KEY(branch_ID) REFERENCES bank(branch_ID),\nFOREIGN KEY(Cust_ID) REFERENCES customer(Cust_ID));"} {"qid": "pool_0292", "split": "pool", "db_id": "college_3", "question": "Find the rank of the faculty that the fewest faculties belong to.", "gold_sql": "SELECT Rank FROM FACULTY GROUP BY Rank ORDER BY count(*) ASC LIMIT 1", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0293", "split": "pool", "db_id": "store_1", "question": "What is the title, phone number and hire date for the employee named Nancy Edwards?", "gold_sql": "SELECT title , phone , hire_date FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0294", "split": "pool", "db_id": "flight_4", "question": "What is the maximum elevation of all airports in the country of Iceland?", "gold_sql": "SELECT max(elevation) FROM airports WHERE country = 'Iceland'", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0295", "split": "pool", "db_id": "activity_1", "question": "How many Professors are in building NEB?", "gold_sql": "SELECT count(*) FROM Faculty WHERE Rank = \"Professor\" AND building = \"NEB\"", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0296", "split": "pool", "db_id": "customer_deliveries", "question": "Find the name of route that has the highest number of deliveries.", "gold_sql": "SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customer_deliveries/customer_deliveries.sqlite", "schema": "CREATE TABLE `Actual_Order_Products` (\n`actual_order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`actual_order_id` ) REFERENCES `Actual_Orders`(`actual_order_id` )\n);\nCREATE TABLE `Actual_Orders` (\n`actual_order_id` INTEGER PRIMARY KEY,\n`order_status_code` VARCHAR(10) NOT NULL,\n`regular_order_id` INTEGER NOT NULL,\n`actual_order_date` DATETIME,\nFOREIGN KEY (`regular_order_id` ) REFERENCES `Regular_Orders`(`regular_order_id` )\n);\nCREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`address_type` VARCHAR(10) NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method` VARCHAR(10) NOT NULL,\n`customer_name` VARCHAR(80),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80),\n`date_became_customer` DATETIME\n);\nCREATE TABLE `Delivery_Route_Locations` (\n`location_code` VARCHAR(10) PRIMARY KEY,\n`route_id` INTEGER NOT NULL,\n`location_address_id` INTEGER NOT NULL,\n`location_name` VARCHAR(50),\nFOREIGN KEY (`location_address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`route_id` ) REFERENCES `Delivery_Routes`(`route_id` )\n);\nCREATE TABLE `Delivery_Routes` (\n`route_id` INTEGER PRIMARY KEY,\n`route_name` VARCHAR(50),\n`other_route_details` VARCHAR(255)\n);\nCREATE TABLE `Employees` (\n`employee_id` INTEGER PRIMARY KEY,\n`employee_address_id` INTEGER NOT NULL,\n`employee_name` VARCHAR(80),\n`employee_phone` VARCHAR(80),\nFOREIGN KEY (`employee_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Order_Deliveries` (\n`location_code` VARCHAR(10) NOT NULL,\n`actual_order_id` INTEGER NOT NULL,\n`delivery_status_code` VARCHAR(10) NOT NULL,\n`driver_employee_id` INTEGER NOT NULL,\n`truck_id` INTEGER NOT NULL,\n`delivery_date` DATETIME,\nFOREIGN KEY (`truck_id` ) REFERENCES `Trucks`(`truck_id` ),\nFOREIGN KEY (`actual_order_id` ) REFERENCES `Actual_Orders`(`actual_order_id` ),\nFOREIGN KEY (`location_code` ) REFERENCES `Delivery_Route_Locations`(`location_code` ),\nFOREIGN KEY (`driver_employee_id` ) REFERENCES `Employees`(`employee_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(20),\n`product_price` DECIMAL(19,4),\n`product_description` VARCHAR(255)\n);\nCREATE TABLE `Regular_Order_Products` (\n`regular_order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`regular_order_id` ) REFERENCES `Regular_Orders`(`regular_order_id` )\n);\nCREATE TABLE `Regular_Orders` (\n`regular_order_id` INTEGER PRIMARY KEY,\n`distributer_id` INTEGER NOT NULL,\nFOREIGN KEY (`distributer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Trucks` (\n`truck_id` INTEGER PRIMARY KEY,\n`truck_licence_number` VARCHAR(20),\n`truck_details` VARCHAR(255)\n);"} {"qid": "pool_0297", "split": "pool", "db_id": "bike_1", "question": "What is the average latitude and longitude of the starting points of all trips?", "gold_sql": "SELECT avg(T1.lat) , avg(T1.long) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0298", "split": "pool", "db_id": "school_player", "question": "Show the denomination of the school that has the most players.", "gold_sql": "SELECT T2.Denomination FROM player AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T1.School_ID ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/school_player/school_player.sqlite", "schema": "CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"Player\" text,\n\"Team\" text,\n\"Age\" int,\n\"Position\" text,\n\"School_ID\" int,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Enrollment\" real,\n\"Founded\" real,\n\"Denomination\" text,\n\"Boys_or_Girls\" text,\n\"Day_or_Boarding\" text,\n\"Year_Entered_Competition\" real,\n\"School_Colors\" text,\nPRIMARY KEY (\"School_Id\")\n);\nCREATE TABLE \"school_details\" (\n\"School_ID\" int,\n\"Nickname\" text,\n\"Colors\" text,\n\"League\" text,\n\"Class\" text,\n\"Division\" text,\nPRIMARY KEY (\"School_Id\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);\nCREATE TABLE \"school_performance\" (\n\"School_Id\" int,\n\"School_Year\" text,\n\"Class_A\" text,\n\"Class_AA\" text,\nPRIMARY KEY (\"School_Id\",\"School_Year\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);"} {"qid": "pool_0299", "split": "pool", "db_id": "products_gen_characteristics", "question": "How many products are in the 'Spices' category and have a typical price of over 1000?", "gold_sql": "SELECT count(*) FROM products WHERE product_category_code = \"Spices\" AND typical_buying_price > 1000", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0300", "split": "pool", "db_id": "college_2", "question": "What are the greatest and average capacity for rooms in each building?", "gold_sql": "SELECT max(capacity) , avg(capacity) , building FROM classroom GROUP BY building", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0301", "split": "pool", "db_id": "performance_attendance", "question": "What is the average number of attendees for performances?", "gold_sql": "SELECT avg(Attendance) FROM performance", "db_path": "databases/performance_attendance/performance_attendance.sqlite", "schema": "CREATE TABLE \"member\" (\n \"Member_ID\" text,\n \"Name\" text,\n \"Nationality\" text,\n \"Role\" text,\n PRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"member_attendance\" (\n \"Member_ID\" int,\n \"Performance_ID\" int,\n \"Num_of_Pieces\" int,\n PRIMARY KEY (\"Member_ID\",\"Performance_ID\"),\n FOREIGN KEY (\"Member_ID\") REFERENCES `member`(\"Member_ID\"),\n FOREIGN KEY (\"Performance_ID\") REFERENCES `performance`(\"Performance_ID\")\n);\nCREATE TABLE \"performance\" (\n \"Performance_ID\" real,\n \"Date\" text,\n \"Host\" text,\n \"Location\" text,\n \"Attendance\" int,\n PRIMARY KEY (\"Performance_ID\")\n);"} {"qid": "pool_0302", "split": "pool", "db_id": "products_gen_characteristics", "question": "Count the number of products in the category 'Seeds'.", "gold_sql": "SELECT count(*) FROM products WHERE product_category_code = \"Seeds\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0303", "split": "pool", "db_id": "soccer_2", "question": "What are the states of the colleges where students who tried out for the striker position attend?", "gold_sql": "SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker'", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0304", "split": "pool", "db_id": "wine_1", "question": "What are the names and scores of wines that are made of white color grapes?", "gold_sql": "SELECT T2.Name , T2.Score FROM GRAPES AS T1 JOIN WINE AS T2 ON T1.Grape = T2.Grape WHERE T1.Color = \"White\"", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0305", "split": "pool", "db_id": "gas_company", "question": "What are the headquarters that have both a company in the banking and 'oil and gas' industries?", "gold_sql": "SELECT headquarters FROM company WHERE main_industry = 'Banking' INTERSECT SELECT headquarters FROM company WHERE main_industry = 'Oil and gas'", "db_path": "databases/gas_company/gas_company.sqlite", "schema": "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);"} {"qid": "pool_0306", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What is the project detail for the project with document \"King Book\"?", "gold_sql": "SELECT T1.project_details FROM Projects AS T1 JOIN Documents AS T2 ON T1.project_id = T2.project_id WHERE T2.document_name = \"King Book\"", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0307", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "What are the email addresses of the drama workshop groups with address in Alaska state?", "gold_sql": "SELECT T2.Store_Email_Address FROM Addresses AS T1 JOIN Drama_Workshop_Groups AS T2 ON T1.Address_ID = T2.Address_ID WHERE T1.State_County = \"Alaska\"", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0308", "split": "pool", "db_id": "storm_record", "question": "Show all region code and region name sorted by the codes.", "gold_sql": "SELECT region_code , region_name FROM region ORDER BY region_code", "db_path": "databases/storm_record/storm_record.sqlite", "schema": "CREATE TABLE `affected_region` (\n`Region_id` int,\n`Storm_ID` int,\n`Number_city_affected` real,\nPRIMARY KEY (`Region_id`,`Storm_ID`),\nFOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`),\nFOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`)\n);\nCREATE TABLE \"region\" (\n`Region_id` int,\n`Region_code` text,\n`Region_name` text,\nPRIMARY KEY (\"Region_id\")\n);\nCREATE TABLE \"storm\" (\n\"Storm_ID\" int,\n\"Name\" text,\n\"Dates_active\" text,\n\"Max_speed\" int,\n\"Damage_millions_USD\" real,\n\"Number_Deaths\" int,\nPRIMARY KEY (\"Storm_ID\")\n);"} {"qid": "pool_0309", "split": "pool", "db_id": "csu_1", "question": "What is the number of faculty at Long Beach State University in 2002?", "gold_sql": "SELECT faculty FROM faculty AS T1 JOIN campuses AS T2 ON T1.campus = T2.id WHERE T1.year = 2002 AND T2.campus = \"Long Beach State University\"", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0310", "split": "pool", "db_id": "program_share", "question": "Which program was launched most recently? Return the program name.", "gold_sql": "SELECT name FROM program ORDER BY launch DESC LIMIT 1", "db_path": "databases/program_share/program_share.sqlite", "schema": "CREATE TABLE \"broadcast\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Time_of_day\" text,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"broadcast_share\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Date\" text,\n\"Share_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"channel\" (\n\"Channel_ID\" int,\n\"Name\" text,\n\"Owner\" text,\n\"Share_in_percent\" real,\n\"Rating_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\")\n);\nCREATE TABLE \"program\" (\n\"Program_ID\" int,\n\"Name\" text,\n\"Origin\" text,\n\"Launch\" real,\n\"Owner\" text,\nPRIMARY KEY (\"Program_ID\")\n);"} {"qid": "pool_0311", "split": "pool", "db_id": "theme_gallery", "question": "Show all artist names with an average exhibition attendance over 200.", "gold_sql": "SELECT T3.name FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id JOIN artist AS T3 ON T3.artist_id = T2.artist_id GROUP BY T3.artist_id HAVING avg(T1.attendance) > 200", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0312", "split": "pool", "db_id": "music_4", "question": "What are the songs in volumes that have resulted in a nomination at music festivals?", "gold_sql": "SELECT T2.Song FROM music_festival AS T1 JOIN volume AS T2 ON T1.Volume = T2.Volume_ID WHERE T1.Result = \"Nominated\"", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0313", "split": "pool", "db_id": "company_office", "question": "List the industry shared by the most companies.", "gold_sql": "SELECT Industry FROM Companies GROUP BY Industry ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/company_office/company_office.sqlite", "schema": "CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);\nCREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);\nCREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);"} {"qid": "pool_0314", "split": "pool", "db_id": "movie_1", "question": "What are the ids of all moviest hat have not been reviewed by Britanny Harris?", "gold_sql": "SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = \"Brittany Harris\"", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0315", "split": "pool", "db_id": "icfp_1", "question": "Retrieve the country that has published the most papers.", "gold_sql": "SELECT t1.country FROM inst AS t1 JOIN authorship AS t2 ON t1.instid = t2.instid JOIN papers AS t3 ON t2.paperid = t3.paperid GROUP BY t1.country ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0316", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "Show the id of the employee named Ebba.", "gold_sql": "SELECT employee_ID FROM Employees WHERE employee_name = \"Ebba\"", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0317", "split": "pool", "db_id": "assets_maintenance", "question": "How many assets does each third party company supply? List the count and the company id.", "gold_sql": "SELECT count(*) , T1.company_id FROM Third_Party_Companies AS T1 JOIN Assets AS T2 ON T1.company_id = T2.supplier_company_id GROUP BY T1.company_id", "db_path": "databases/assets_maintenance/assets_maintenance.sqlite", "schema": "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);\nCREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);\nCREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);\nCREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);\nCREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);\nCREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);\nCREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);"} {"qid": "pool_0318", "split": "pool", "db_id": "icfp_1", "question": "What are the titles of papers published by \"Jeremy Gibbons\"?", "gold_sql": "SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = \"Jeremy\" AND t1.lname = \"Gibbons\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0319", "split": "pool", "db_id": "flight_4", "question": "What is the name of the country with the most number of home airlines?", "gold_sql": "SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0320", "split": "pool", "db_id": "music_1", "question": "What are the names of all songs that are ordered by their resolution numbers?", "gold_sql": "SELECT song_name FROM song ORDER BY resolution", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0321", "split": "pool", "db_id": "college_1", "question": "How many students are enrolled in the class taught by some professor from the accounting department?", "gold_sql": "SELECT count(*) FROM CLASS AS T1 JOIN enroll AS T2 ON T1.class_code = T2.class_code JOIN course AS T3 ON T1.crs_code = T3.crs_code JOIN department AS T4 ON T3.dept_code = T4.dept_code WHERE T4.dept_name = 'Accounting'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0322", "split": "pool", "db_id": "activity_1", "question": "Which students participate in both Canoeing and Kayaking as their activities? Tell me their student ids.", "gold_sql": "SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Canoeing' INTERSECT SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Kayaking'", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0323", "split": "pool", "db_id": "chinook_1", "question": "Find the names of artists that do not have any albums.", "gold_sql": "SELECT Name FROM ARTIST EXCEPT SELECT T2.Name FROM ALBUM AS T1 JOIN ARTIST AS T2 ON T1.ArtistId = T2.ArtistId", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0324", "split": "pool", "db_id": "flight_4", "question": "What is the name of the airport that is the destination of the most number of routes that start in China?", "gold_sql": "SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0325", "split": "pool", "db_id": "company_employee", "question": "list the names of the companies with more than 200 sales in the descending order of sales and profits.", "gold_sql": "SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion , Profits_in_Billion DESC", "db_path": "databases/company_employee/company_employee.sqlite", "schema": "CREATE TABLE \"company\" (\n \"Company_ID\" real,\n \"Name\" text,\n \"Headquarters\" text,\n \"Industry\" text,\n \"Sales_in_Billion\" real,\n \"Profits_in_Billion\" real,\n \"Assets_in_Billion\" real,\n \"Market_Value_in_Billion\" real,\n PRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"employment\" (\n \"Company_ID\" int,\n \"People_ID\" int,\n \"Year_working\" int,\n PRIMARY KEY (\"Company_ID\",\"People_ID\"),\n FOREIGN KEY (\"Company_ID\") REFERENCES `company`(\"Company_ID\"),\n FOREIGN KEY (\"People_ID\") REFERENCES `people`(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n \"People_ID\" int,\n \"Age\" int,\n \"Name\" text,\n \"Nationality\" text,\n \"Graduation_College\" text,\n PRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0326", "split": "pool", "db_id": "music_4", "question": "Return the famous release date for the oldest artist.", "gold_sql": "SELECT Famous_Release_date FROM artist ORDER BY Age DESC LIMIT 1", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0327", "split": "pool", "db_id": "icfp_1", "question": "Who belong to the institution \"University of Oxford\"? Show the first names and last names.", "gold_sql": "SELECT DISTINCT t1.fname , t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN inst AS t3 ON t2.instid = t3.instid WHERE t3.name = \"University of Oxford\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0328", "split": "pool", "db_id": "chinook_1", "question": "Find the birth dates corresponding to employees who live in the city of Edmonton.", "gold_sql": "SELECT BirthDate FROM EMPLOYEE WHERE City = \"Edmonton\"", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0329", "split": "pool", "db_id": "tracking_grants_for_research", "question": "List the description of the outcomes for all projects.", "gold_sql": "SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0330", "split": "pool", "db_id": "election", "question": "Which county do the delegates on \"Appropriations\" committee belong to? Give me the county names.", "gold_sql": "SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = \"Appropriations\"", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0331", "split": "pool", "db_id": "flight_4", "question": "What is the number of routes operated by the airline American Airlines whose destinations are in Italy?", "gold_sql": "SELECT count(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0332", "split": "pool", "db_id": "store_1", "question": "What are the names of the tracks that are Rock or Jazz songs?", "gold_sql": "SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id WHERE T1.name = \"Rock\" OR T1.name = \"Jazz\"", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0333", "split": "pool", "db_id": "icfp_1", "question": "Find all the papers published by \"Aaron Turon\".", "gold_sql": "SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = \"Aaron\" AND t1.lname = \"Turon\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0334", "split": "pool", "db_id": "network_2", "question": "What is the average age for a male in each job?", "gold_sql": "SELECT avg(age) , job FROM Person WHERE gender = 'male' GROUP BY job", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0335", "split": "pool", "db_id": "insurance_and_eClaims", "question": "Find the number of records of each policy type and its type code.", "gold_sql": "SELECT policy_type_code , count(*) FROM policies GROUP BY policy_type_code", "db_path": "databases/insurance_and_eClaims/insurance_and_eClaims.sqlite", "schema": "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);\nCREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);"} {"qid": "pool_0336", "split": "pool", "db_id": "products_gen_characteristics", "question": "Find the unit of measurement and product category code of product named \"chervil\".", "gold_sql": "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\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0337", "split": "pool", "db_id": "college_2", "question": "How many classrooms are not in Lamberton?", "gold_sql": "SELECT count(*) FROM classroom WHERE building != 'Lamberton'", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0338", "split": "pool", "db_id": "flight_4", "question": "How many airports are there per country? Order the countries by decreasing number of airports.", "gold_sql": "SELECT count(*) , country FROM airports GROUP BY country ORDER BY count(*) DESC", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0339", "split": "pool", "db_id": "e_learning", "question": "What is the name of each course and the corresponding number of student enrollment?", "gold_sql": "SELECT T1.course_name , COUNT(*) FROM Courses AS T1 JOIN Student_Course_Enrolment AS T2 ON T1.course_id = T2.course_id GROUP BY T1.course_name", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0340", "split": "pool", "db_id": "station_weather", "question": "Find the id and local authority of the station with has the highest average high temperature.", "gold_sql": "SELECT t2.id , t2.local_authority FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id GROUP BY t1.station_id ORDER BY avg(high_temperature) DESC LIMIT 1", "db_path": "databases/station_weather/station_weather.sqlite", "schema": "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);\nCREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);"} {"qid": "pool_0341", "split": "pool", "db_id": "aircraft", "question": "What are the names and descriptions of aircrafts associated with an airport that has more total passengers than 10000000?", "gold_sql": "SELECT T1.Aircraft , T1.Description 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.Total_Passengers > 10000000", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0342", "split": "pool", "db_id": "sports_competition", "question": "What are the different years for all competitions that are not of type equal to tournament?", "gold_sql": "SELECT DISTINCT YEAR FROM competition WHERE Competition_type != \"Tournament\"", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0343", "split": "pool", "db_id": "wrestler", "question": "What are the elimination moves of wrestlers whose team is \"Team Orton\"?", "gold_sql": "SELECT Elimination_Move FROM Elimination WHERE Team = \"Team Orton\"", "db_path": "databases/wrestler/wrestler.sqlite", "schema": "CREATE TABLE \"Elimination\" (\n\"Elimination_ID\" text,\n\"Wrestler_ID\" text,\n\"Team\" text,\n\"Eliminated_By\" text,\n\"Elimination_Move\" text,\n\"Time\" text,\nPRIMARY KEY (\"Elimination_ID\"),\nFOREIGN KEY (\"Wrestler_ID\") REFERENCES \"wrestler\"(\"Wrestler_ID\")\n);\nCREATE TABLE \"wrestler\" (\n\"Wrestler_ID\" int,\n\"Name\" text,\n\"Reign\" text,\n\"Days_held\" text,\n\"Location\" text,\n\"Event\" text,\nPRIMARY KEY (\"Wrestler_ID\")\n);"} {"qid": "pool_0344", "split": "pool", "db_id": "apartment_rentals", "question": "Sort the apartment numbers in ascending order of room count.", "gold_sql": "SELECT apt_number FROM Apartments ORDER BY room_count ASC", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0345", "split": "pool", "db_id": "customers_and_invoices", "question": "How many transactions correspond to each invoice number?", "gold_sql": "SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0346", "split": "pool", "db_id": "music_1", "question": "List the id, genre and artist name of English songs ordered by rating.", "gold_sql": "SELECT f_id , genre_is , artist_name FROM song WHERE languages = \"english\" ORDER BY rating", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0347", "split": "pool", "db_id": "restaurant_1", "question": "What is the address of the restaurant Subway?", "gold_sql": "SELECT Address FROM Restaurant WHERE ResName = \"Subway\";", "db_path": "databases/restaurant_1/restaurant_1.sqlite", "schema": "CREATE TABLE Restaurant (\n ResID INTEGER PRIMARY KEY,\n ResName VARCHAR(100),\n Address VARCHAR(100),\n Rating INTEGER\n);\nCREATE TABLE Restaurant_Type (\n ResTypeID INTEGER PRIMARY KEY,\n ResTypeName VARCHAR(40),\n ResTypeDescription VARCHAR(100)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Type_Of_Restaurant (\n ResID INTEGER,\n ResTypeID INTEGER,\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),\n FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)\n);\nCREATE TABLE Visits_Restaurant (\n StuID INTEGER,\n ResID INTEGER,\n Time TIMESTAMP,\n Spent FLOAT,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)\n);"} {"qid": "pool_0348", "split": "pool", "db_id": "movie_1", "question": "Find the titles of all movies not reviewed by Chris Jackson.", "gold_sql": "SELECT DISTINCT title FROM Movie EXCEPT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Chris Jackson'", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0349", "split": "pool", "db_id": "wine_1", "question": "Find the distinct names of all wines that have prices higher than some wines from John Anthony winery.", "gold_sql": "SELECT DISTINCT Name FROM WINE WHERE Price > (SELECT min(Price) FROM wine WHERE Winery = \"John Anthony\")", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0350", "split": "pool", "db_id": "bike_1", "question": "What are the ids of stations that are located in San Francisco and have average bike availability above 10.", "gold_sql": "SELECT id FROM station WHERE city = \"San Francisco\" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING avg(bikes_available) > 10", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0351", "split": "pool", "db_id": "college_1", "question": "How many professors do have a Ph.D. degree?", "gold_sql": "SELECT count(*) FROM professor WHERE prof_high_degree = 'Ph.D.'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0352", "split": "pool", "db_id": "soccer_2", "question": "For each position, what is the minimum time students spent practicing?", "gold_sql": "SELECT min(T2.HS) , T1.pPos FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID GROUP BY T1.pPos", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0353", "split": "pool", "db_id": "station_weather", "question": "list the local authorities and services provided by all stations.", "gold_sql": "SELECT local_authority , services FROM station", "db_path": "databases/station_weather/station_weather.sqlite", "schema": "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);\nCREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);"} {"qid": "pool_0354", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "What are the product names with average product price smaller than 1000000?", "gold_sql": "SELECT Product_Name FROM PRODUCTS GROUP BY Product_Name HAVING avg(Product_Price) < 1000000", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0355", "split": "pool", "db_id": "csu_1", "question": "How many people graduated from San Francisco State University in 2004?", "gold_sql": "SELECT sum(t1.graduate) FROM discipline_enrollments AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t1.year = 2004 AND t2.campus = \"San Francisco State University\"", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0356", "split": "pool", "db_id": "music_1", "question": "List the duration, file size and format of songs whose genre is pop, ordered by title?", "gold_sql": "SELECT T1.duration , T1.file_size , T1.formats FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T2.genre_is = \"pop\" ORDER BY T2.song_name", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0357", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "List all statement ids and statement details.", "gold_sql": "SELECT STATEMENT_ID , statement_details FROM Statements", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0358", "split": "pool", "db_id": "activity_1", "question": "Count the number of female Professors we have.", "gold_sql": "SELECT count(*) FROM Faculty WHERE Sex = 'F' AND Rank = \"Professor\"", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0359", "split": "pool", "db_id": "college_2", "question": "Find the total number of students in each department.", "gold_sql": "SELECT count(*) , dept_name FROM student GROUP BY dept_name", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0360", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "What are the ids of all the employees who have destroyed documents?", "gold_sql": "SELECT DISTINCT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0361", "split": "pool", "db_id": "voter_2", "question": "Count the number of voting records for each election cycle.", "gold_sql": "SELECT Election_Cycle , count(*) FROM VOTING_RECORD GROUP BY Election_Cycle", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0362", "split": "pool", "db_id": "county_public_safety", "question": "What are the names of cities in ascending alphabetical order?", "gold_sql": "SELECT Name FROM city ORDER BY Name ASC", "db_path": "databases/county_public_safety/county_public_safety.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"County_ID\" int,\n\"Name\" text,\n\"White\" real,\n\"Black\" real,\n\"Amerindian\" real,\n\"Asian\" real,\n\"Multiracial\" real,\n\"Hispanic\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (\"County_ID\") REFERENCES \"county_public_safety\"(\"County_ID\")\n);\nCREATE TABLE \"county_public_safety\" (\n\"County_ID\" int,\n\"Name\" text,\n\"Population\" int,\n\"Police_officers\" int,\n\"Residents_per_officer\" int,\n\"Case_burden\" int,\n\"Crime_rate\" real,\n\"Police_force\" text,\n\"Location\" text,\nPRIMARY KEY (\"County_ID\")\n);"} {"qid": "pool_0363", "split": "pool", "db_id": "network_2", "question": "Find the name and age of the person who is a friend of both Dan and Alice.", "gold_sql": "SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0364", "split": "pool", "db_id": "station_weather", "question": "Find the origins from which more than 1 train starts.", "gold_sql": "SELECT origin FROM train GROUP BY origin HAVING count(*) > 1", "db_path": "databases/station_weather/station_weather.sqlite", "schema": "CREATE TABLE \"route\" (\n \"train_id\" int,\n \"station_id\" int,\n primary key (\"train_id\", \"station_id\"),\n foreign key (\"train_id\") references `train`(\"id\"),\n foreign key (\"station_id\") references `station`(\"id\")\n);\nCREATE TABLE \"station\" (\n \"id\" int,\n \"network_name\" text,\n \"services\" text,\n \"local_authority\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"train\" (\n \"id\" int,\n \"train_number\" int,\n \"name\" text,\n \"origin\" text,\n \"destination\" text,\n \"time\" text,\n \"interval\" text,\n primary key (\"id\")\n);\nCREATE TABLE \"weekly_weather\" (\n \"station_id\" int,\n \"day_of_week\" text,\n \"high_temperature\" int,\n \"low_temperature\" int,\n \"precipitation\" real,\n \"wind_speed_mph\" int,\n primary key (\"station_id\", \"day_of_week\"),\n foreign key (\"station_id\") references \"station\"(\"id\")\n);"} {"qid": "pool_0365", "split": "pool", "db_id": "flight_4", "question": "Find the number of routes that have destination John F Kennedy International Airport.", "gold_sql": "SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport'", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0366", "split": "pool", "db_id": "soccer_2", "question": "How many states have a college with more students than average?", "gold_sql": "SELECT count(DISTINCT state) FROM college WHERE enr > (SELECT avg(enr) FROM college)", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0367", "split": "pool", "db_id": "device", "question": "What are the different software platforms for devices, ordered by frequency descending?", "gold_sql": "SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0368", "split": "pool", "db_id": "music_1", "question": "How many Bangladeshi artists are listed?", "gold_sql": "SELECT count(*) FROM artist WHERE country = \"Bangladesh\"", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0369", "split": "pool", "db_id": "flight_1", "question": "What are the origins of all flights that are headed to Honolulu?", "gold_sql": "SELECT origin FROM Flight WHERE destination = \"Honolulu\"", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0370", "split": "pool", "db_id": "school_finance", "question": "What is the total budget amount for school \"Glenn\" in all years?", "gold_sql": "SELECT sum(T1.budgeted) FROM budget AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id WHERE T2.school_name = 'Glenn'", "db_path": "databases/school_finance/school_finance.sqlite", "schema": "CREATE TABLE \"School\" (\n\"School_id\" text,\n\"School_name\" text,\n\"Location\" text,\n\"Mascot\" text,\n\"Enrollment\" int,\n\"IHSAA_Class\" text,\n\"IHSAA_Football_Class\" text,\n\"County\" text,\nPRIMARY KEY (\"School_id\")\n);\nCREATE TABLE \"budget\" (\n\"School_id\" int,\n\"Year\" int,\n\"Budgeted\" int,\n\"total_budget_percent_budgeted\" real,\n\"Invested\" int,\n\"total_budget_percent_invested\" real,\n\"Budget_invested_percent\" text,\nPRIMARY KEY(\"School_id\",\"YEAR\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n\n);\nCREATE TABLE \"endowment\" (\n\"endowment_id\" int,\n\"School_id\" int,\n\"donator_name\" text,\n\"amount\" real,\nPRIMARY KEY(\"endowment_id\"),\nFOREIGN KEY(\"School_id\") REFERENCES \"School\"(\"School_id\")\n);"} {"qid": "pool_0371", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "Show all role codes with at least 3 employees.", "gold_sql": "SELECT role_code FROM Employees GROUP BY role_code HAVING count(*) >= 3", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0372", "split": "pool", "db_id": "tracking_grants_for_research", "question": "What is the complete description of the job of a researcher?", "gold_sql": "SELECT role_description FROM Staff_Roles WHERE role_code = 'researcher'", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0373", "split": "pool", "db_id": "hospital_1", "question": "What are the names of procedures physician John Wen was trained in?", "gold_sql": "SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = \"John Wen\"", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0374", "split": "pool", "db_id": "election_representative", "question": "What is the party of the representative that has the smallest number of votes.", "gold_sql": "SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes ASC LIMIT 1", "db_path": "databases/election_representative/election_representative.sqlite", "schema": "CREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Representative_ID\" int,\n\"Date\" text,\n\"Votes\" real,\n\"Vote_Percent\" real,\n\"Seats\" real,\n\"Place\" real,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (\"Representative_ID\") REFERENCES `representative`(\"Representative_ID\")\n);\nCREATE TABLE \"representative\" (\n\"Representative_ID\" int,\n\"Name\" text,\n\"State\" text,\n\"Party\" text,\n\"Lifespan\" text,\nPRIMARY KEY (\"Representative_ID\")\n);"} {"qid": "pool_0375", "split": "pool", "db_id": "customers_and_invoices", "question": "Show the unique first names, last names, and phone numbers for all customers with any account.", "gold_sql": "SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0376", "split": "pool", "db_id": "flight_4", "question": "Which countries has the most number of airlines?", "gold_sql": "SELECT country FROM airlines GROUP BY country ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0377", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Find the order dates of the orders with price above 1000.", "gold_sql": "SELECT T1.Order_Date FROM Customer_Orders AS T1 JOIN ORDER_ITEMS AS T2 ON T1.Order_ID = T2.Order_ID JOIN Products AS T3 ON T2.Product_ID = T3.Product_ID WHERE T3.Product_price > 1000", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0378", "split": "pool", "db_id": "hospital_1", "question": "Which physicians have never taken any appointment? Find their names.", "gold_sql": "SELECT name FROM physician EXCEPT SELECT T2.name FROM appointment AS T1 JOIN physician AS T2 ON T1.Physician = T2.EmployeeID", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0379", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "Compute the total order quantities of the product \"photo\".", "gold_sql": "SELECT sum(T1.Order_Quantity) FROM ORDER_ITEMS AS T1 JOIN Products AS T2 ON T1.Product_ID = T2.Product_ID WHERE T2.Product_Name = \"photo\"", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0380", "split": "pool", "db_id": "voter_2", "question": "How many male (sex is M) students have class senator votes in the fall election cycle?", "gold_sql": "SELECT count(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = \"M\" AND T2.Election_Cycle = \"Fall\"", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0381", "split": "pool", "db_id": "flight_1", "question": "Show name and distance for all aircrafts.", "gold_sql": "SELECT name , distance FROM Aircraft", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0382", "split": "pool", "db_id": "music_1", "question": "List the names of all genres in alphabetical oder, together with its ratings.", "gold_sql": "SELECT g_name , rating FROM genre ORDER BY g_name", "db_path": "databases/music_1/music_1.sqlite", "schema": "CREATE TABLE artist(\n\tartist_name varchar2(50) not null,\n\tcountry varchar2(20),\n\tgender varchar2(20),\n\tpreferred_genre varchar2(50),\n\tconstraint a_name primary key(artist_name),\n\tforeign key(preferred_genre) references genre(g_name) ON DELETE CASCADE\n);\nCREATE TABLE files(\n\tf_id number(10) not null,\n\tartist_name varchar2(50),\n\tfile_size varchar2(20),\n\tduration varchar2(20),\n\tformats varchar2(20),\n\tprimary key(f_id),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE\n);\nCREATE TABLE genre(\n\tg_name varchar2(20) not null,\n\trating varchar2(10),\n\tmost_popular_in varchar2(50),\n\tprimary key(g_name)\n);\nCREATE TABLE song(\n\tsong_name varchar2(50),\n\tartist_name varchar2(50),\n\tcountry varchar2(20),\n\tf_id number(10),\n \tgenre_is varchar2(20),\n\trating number(10) check(rating>0 and rating<11),\n\tlanguages varchar2(20),\n\treleasedate Date, \n\tresolution number(10) not null,\n\tconstraint s_name primary key(song_name),\n\tforeign key(artist_name) references artist(artist_name) ON DELETE CASCADE,\n\tforeign key(f_id) references files(f_id) ON DELETE CASCADE,\n\tforeign key(genre_is) references genre(g_name) ON DELETE CASCADE\n);"} {"qid": "pool_0383", "split": "pool", "db_id": "activity_1", "question": "Tell me the first and last name of the student who has the most activities.", "gold_sql": "SELECT T1.fname , T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0384", "split": "pool", "db_id": "products_gen_characteristics", "question": "Return the color code and description for the product with the name 'chervil'.", "gold_sql": "SELECT t1.color_code , t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = \"chervil\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0385", "split": "pool", "db_id": "driving_school", "question": "How many employees are there?", "gold_sql": "SELECT count(*) FROM Staff;", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0386", "split": "pool", "db_id": "bike_1", "question": "What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.", "gold_sql": "SELECT date , cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0387", "split": "pool", "db_id": "products_gen_characteristics", "question": "Return the unit of measure for 'Herb' products.", "gold_sql": "SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = \"Herbs\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0388", "split": "pool", "db_id": "match_season", "question": "Show the name of colleges that have at least two players.", "gold_sql": "SELECT College FROM match_season GROUP BY College HAVING count(*) >= 2", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0389", "split": "pool", "db_id": "network_2", "question": "What are the names and ages of every person who is a friend of both Dan and Alice?", "gold_sql": "SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Dan' INTERSECT SELECT T1.name , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.name WHERE T2.friend = 'Alice'", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0390", "split": "pool", "db_id": "theme_gallery", "question": "Return the average and minimum ages across artists from the United States.", "gold_sql": "SELECT avg(age) , min(age) FROM artist WHERE country = 'United States'", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0391", "split": "pool", "db_id": "flight_1", "question": "What are the names of all employees who have a salary higher than average?", "gold_sql": "SELECT name FROM Employee WHERE salary > (SELECT avg(salary) FROM Employee)", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0392", "split": "pool", "db_id": "apartment_rentals", "question": "What are the address and phone number of the buildings managed by \"Brenden\"?", "gold_sql": "SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager\t = \"Brenden\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0393", "split": "pool", "db_id": "baseball_1", "question": "How many home games did the team Boston Red Stockings play from 1990 to 2000 in total?", "gold_sql": "SELECT sum(T1.games) FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year BETWEEN 1990 AND 2000;", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0394", "split": "pool", "db_id": "cre_Theme_park", "question": "What are the names of the tourist attractions Vincent and Marcelle visit?", "gold_sql": "SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = \"Vincent\" INTERSECT SELECT T1.Name FROM Tourist_Attractions AS T1 JOIN VISITORS AS T2 JOIN VISITS AS T3 ON T1.Tourist_Attraction_ID = T3.Tourist_Attraction_ID AND T2.Tourist_ID = T3.Tourist_ID WHERE T2.Tourist_Details = \"Marcelle\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0395", "split": "pool", "db_id": "program_share", "question": "List all channel names ordered by their rating in percent from big to small.", "gold_sql": "SELECT name FROM channel ORDER BY rating_in_percent DESC", "db_path": "databases/program_share/program_share.sqlite", "schema": "CREATE TABLE \"broadcast\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Time_of_day\" text,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"broadcast_share\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Date\" text,\n\"Share_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"channel\" (\n\"Channel_ID\" int,\n\"Name\" text,\n\"Owner\" text,\n\"Share_in_percent\" real,\n\"Rating_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\")\n);\nCREATE TABLE \"program\" (\n\"Program_ID\" int,\n\"Name\" text,\n\"Origin\" text,\n\"Launch\" real,\n\"Owner\" text,\nPRIMARY KEY (\"Program_ID\")\n);"} {"qid": "pool_0396", "split": "pool", "db_id": "scientist_1", "question": "List the name of all projects that are operated longer than the average working hours of all projects.", "gold_sql": "SELECT name FROM projects WHERE hours > (SELECT avg(hours) FROM projects)", "db_path": "databases/scientist_1/scientist_1.sqlite", "schema": "CREATE TABLE AssignedTo (\n Scientist int not null,\n Project char(4) not null,\n Primary Key (Scientist, Project),\n Foreign Key (Scientist) references Scientists (SSN),\n Foreign Key (Project) references Projects (Code)\n);\nCREATE TABLE Projects (\n Code Char(4),\n Name Char(50) not null,\n Hours int,\n Primary Key (Code)\n);\nCREATE TABLE Scientists (\n SSN int,\n Name Char(30) not null,\n Primary Key (SSN)\n);"} {"qid": "pool_0397", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "Count the number of statements.", "gold_sql": "SELECT count(*) FROM Statements", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0398", "split": "pool", "db_id": "apartment_rentals", "question": "Show the addresses and phones of all the buildings managed by \"Brenden\".", "gold_sql": "SELECT building_address , building_phone FROM Apartment_Buildings WHERE building_manager\t = \"Brenden\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0399", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What is the document type description for document type named Film?", "gold_sql": "SELECT document_type_description FROM Ref_document_types WHERE document_type_name = \"Film\"", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0400", "split": "pool", "db_id": "college_1", "question": "How many classes exist for each school?", "gold_sql": "SELECT count(*) , T3.school_code FROM CLASS AS T1 JOIN course AS T2 ON T1.crs_code = T2.crs_code JOIN department AS T3 ON T2.dept_code = T3.dept_code GROUP BY T3.school_code", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0401", "split": "pool", "db_id": "wrestler", "question": "Which locations are shared by more than two wrestlers?", "gold_sql": "SELECT LOCATION FROM wrestler GROUP BY LOCATION HAVING COUNT(*) > 2", "db_path": "databases/wrestler/wrestler.sqlite", "schema": "CREATE TABLE \"Elimination\" (\n\"Elimination_ID\" text,\n\"Wrestler_ID\" text,\n\"Team\" text,\n\"Eliminated_By\" text,\n\"Elimination_Move\" text,\n\"Time\" text,\nPRIMARY KEY (\"Elimination_ID\"),\nFOREIGN KEY (\"Wrestler_ID\") REFERENCES \"wrestler\"(\"Wrestler_ID\")\n);\nCREATE TABLE \"wrestler\" (\n\"Wrestler_ID\" int,\n\"Name\" text,\n\"Reign\" text,\n\"Days_held\" text,\n\"Location\" text,\n\"Event\" text,\nPRIMARY KEY (\"Wrestler_ID\")\n);"} {"qid": "pool_0402", "split": "pool", "db_id": "epinions_1", "question": "For each user, return the name and the average rating of reviews given by them.", "gold_sql": "SELECT T1.name , avg(T2.rating) FROM useracct AS T1 JOIN review AS T2 ON T1.u_id = T2.u_id GROUP BY T2.u_id", "db_path": "databases/epinions_1/epinions_1.sqlite", "schema": "CREATE TABLE `item` (\n `i_id` integer NOT NULL\n, `title` varchar(20) DEFAULT NULL\n, PRIMARY KEY (`i_id`)\n);\nCREATE TABLE `review` (\n `a_id` integer NOT NULL PRIMARY KEY\n, `u_id` integer NOT NULL\n, `i_id` integer NOT NULL\n, `rating` integer DEFAULT NULL\n, `rank` integer DEFAULT NULL\n, \tFOREIGN KEY (`u_id`) REFERENCES `useracct`(`u_id`)\n, \tFOREIGN KEY (`i_id`) REFERENCES `item`(`i_id`)\n);\nCREATE TABLE \"trust\" (`source_u_id` integer NOT NULL, `target_u_id` integer NOT NULL, `trust` integer NOT NULL, FOREIGN KEY (`source_u_id`) REFERENCES `useracct`(`u_id`), FOREIGN KEY (`target_u_id`) REFERENCES `useracct`(`u_id`));\nCREATE TABLE `useracct` (\n `u_id` integer NOT NULL\n, `name` varchar(128) DEFAULT NULL\n, PRIMARY KEY (`u_id`)\n);"} {"qid": "pool_0403", "split": "pool", "db_id": "tracking_grants_for_research", "question": "What are the details of the project with no outcomes?", "gold_sql": "SELECT project_details FROM Projects WHERE project_id NOT IN ( SELECT project_id FROM Project_outcomes )", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0404", "split": "pool", "db_id": "allergy_1", "question": "What student id corresponds to the oldest student?", "gold_sql": "SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0405", "split": "pool", "db_id": "customers_and_products_contacts", "question": "Show the name of the customer who has the most orders.", "gold_sql": "SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customers_and_products_contacts/customers_and_products_contacts.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Contacts` (\n`contact_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(50),\n`contact_phone` VARCHAR(80)\n);\nCREATE TABLE `Customer_Address_History` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_date` DATETIME NOT NULL,\n`order_status_code` VARCHAR(15),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15),\n`customer_number` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER NOT NULL ,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(15),\n`product_name` VARCHAR(80),\n`product_price` DOUBLE NULL\n);"} {"qid": "pool_0406", "split": "pool", "db_id": "baseball_1", "question": "Find the team that attended the least number of home games in 1980.", "gold_sql": "SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0407", "split": "pool", "db_id": "cre_Theme_park", "question": "Find all the locations whose names contain the word \"film\".", "gold_sql": "SELECT Location_Name FROM LOCATIONS WHERE Location_Name LIKE \"%film%\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0408", "split": "pool", "db_id": "e_learning", "question": "Find the number of distinct courses that have enrolled students.", "gold_sql": "SELECT count(course_id) FROM Student_Course_Enrolment", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0409", "split": "pool", "db_id": "tracking_software_problems", "question": "For each product which has problems, what are the number of problems and the product id?", "gold_sql": "SELECT count(*) , T2.product_id FROM problems AS T1 JOIN product AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_id", "db_path": "databases/tracking_software_problems/tracking_software_problems.sqlite", "schema": "CREATE TABLE `Problem_Category_Codes` (\n`problem_category_code` VARCHAR(20) PRIMARY KEY,\n`problem_category_description` VARCHAR(80)\n);\nCREATE TABLE `Problem_Log` (\n`problem_log_id` INTEGER PRIMARY KEY,\n`assigned_to_staff_id` INTEGER NOT NULL,\n`problem_id` INTEGER NOT NULL,\n`problem_category_code` VARCHAR(20) NOT NULL,\n`problem_status_code` VARCHAR(20) NOT NULL,\n`log_entry_date` DATETIME,\n`log_entry_description` VARCHAR(255),\n`log_entry_fix` VARCHAR(255),\n`other_log_details` VARCHAR(255),\nFOREIGN KEY (`problem_category_code` ) REFERENCES `Problem_Category_Codes`(`problem_category_code` ),FOREIGN KEY (`assigned_to_staff_id` ) REFERENCES `Staff`(`staff_id` ),FOREIGN KEY (`problem_id` ) REFERENCES `Problems`(`problem_id` ),FOREIGN KEY (`problem_status_code` ) REFERENCES `Problem_Status_Codes`(`problem_status_code` )\n);\nCREATE TABLE `Problem_Status_Codes` (\n`problem_status_code` VARCHAR(20) PRIMARY KEY,\n`problem_status_description` VARCHAR(80)\n);\nCREATE TABLE `Problems` (\n`problem_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`closure_authorised_by_staff_id` INTEGER NOT NULL,\n`reported_by_staff_id` INTEGER NOT NULL,\n`date_problem_reported` DATETIME NOT NULL,\n`date_problem_closed` DATETIME,\n`problem_description` VARCHAR(255),\n`other_problem_details` VARCHAR(255),\nFOREIGN KEY (`closure_authorised_by_staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Product`(`product_id` ),\nFOREIGN KEY (`reported_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Product` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_first_name` VARCHAR(80),\n`staff_last_name` VARCHAR(80),\n`other_staff_details` VARCHAR(255)\n);"} {"qid": "pool_0410", "split": "pool", "db_id": "store_1", "question": "What are the first and last names of all the employees and how many people report to them?", "gold_sql": "SELECT T2.first_name , T2.last_name , count(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY count(T1.reports_to) DESC LIMIT 1;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0411", "split": "pool", "db_id": "storm_record", "question": "Show the average and maximum damage for all storms with max speed higher than 1000.", "gold_sql": "SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000", "db_path": "databases/storm_record/storm_record.sqlite", "schema": "CREATE TABLE `affected_region` (\n`Region_id` int,\n`Storm_ID` int,\n`Number_city_affected` real,\nPRIMARY KEY (`Region_id`,`Storm_ID`),\nFOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`),\nFOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`)\n);\nCREATE TABLE \"region\" (\n`Region_id` int,\n`Region_code` text,\n`Region_name` text,\nPRIMARY KEY (\"Region_id\")\n);\nCREATE TABLE \"storm\" (\n\"Storm_ID\" int,\n\"Name\" text,\n\"Dates_active\" text,\n\"Max_speed\" int,\n\"Damage_millions_USD\" real,\n\"Number_Deaths\" int,\nPRIMARY KEY (\"Storm_ID\")\n);"} {"qid": "pool_0412", "split": "pool", "db_id": "school_player", "question": "Please show different denominations and the corresponding number of schools in descending order.", "gold_sql": "SELECT Denomination , COUNT(*) FROM school GROUP BY Denomination ORDER BY COUNT(*) DESC", "db_path": "databases/school_player/school_player.sqlite", "schema": "CREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"Player\" text,\n\"Team\" text,\n\"Age\" int,\n\"Position\" text,\n\"School_ID\" int,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Enrollment\" real,\n\"Founded\" real,\n\"Denomination\" text,\n\"Boys_or_Girls\" text,\n\"Day_or_Boarding\" text,\n\"Year_Entered_Competition\" real,\n\"School_Colors\" text,\nPRIMARY KEY (\"School_Id\")\n);\nCREATE TABLE \"school_details\" (\n\"School_ID\" int,\n\"Nickname\" text,\n\"Colors\" text,\n\"League\" text,\n\"Class\" text,\n\"Division\" text,\nPRIMARY KEY (\"School_Id\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);\nCREATE TABLE \"school_performance\" (\n\"School_Id\" int,\n\"School_Year\" text,\n\"Class_A\" text,\n\"Class_AA\" text,\nPRIMARY KEY (\"School_Id\",\"School_Year\"),\nFOREIGN KEY (`School_ID`) REFERENCES `school`(`School_ID`)\n);"} {"qid": "pool_0413", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What are the different statement ids on accounts, and the number of accounts for each?", "gold_sql": "SELECT STATEMENT_ID , count(*) FROM Accounts GROUP BY STATEMENT_ID", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0414", "split": "pool", "db_id": "local_govt_in_alabama", "question": "Which services type had both successful and failure event details?", "gold_sql": "SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Success' INTERSECT SELECT T1.service_type_code FROM services AS T1 JOIN EVENTS AS T2 ON T1.service_id = T2.service_id WHERE T2.event_details = 'Fail'", "db_path": "databases/local_govt_in_alabama/local_govt_in_alabama.sqlite", "schema": "CREATE TABLE Events (\nEvent_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nEvent_Details VARCHAR(255),\nPRIMARY KEY (Event_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Participants (\nParticipant_ID INTEGER NOT NULL,\nParticipant_Type_Code CHAR(15) NOT NULL,\nParticipant_Details VARCHAR(255),\nPRIMARY KEY (Participant_ID)\n);\nCREATE TABLE Participants_in_Events (\nEvent_ID INTEGER NOT NULL,\nParticipant_ID INTEGER NOT NULL,\nPRIMARY KEY (Event_ID, Participant_ID),\nFOREIGN KEY (Participant_ID) REFERENCES Participants (Participant_ID),\nFOREIGN KEY (Event_ID) REFERENCES Events (Event_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15) NOT NULL,\nPRIMARY KEY (Service_ID)\n);"} {"qid": "pool_0415", "split": "pool", "db_id": "college_1", "question": "What is the name of department where has the largest number of professors with a Ph.D. degree?", "gold_sql": "SELECT T2.dept_name , T1.dept_code FROM professor AS T1 JOIN department AS T2 ON T1.dept_code = T2.dept_code WHERE T1.prof_high_degree = 'Ph.D.' GROUP BY T1.dept_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0416", "split": "pool", "db_id": "apartment_rentals", "question": "What are the start date and end date of each apartment booking?", "gold_sql": "SELECT booking_start_date , booking_end_date FROM Apartment_Bookings", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0417", "split": "pool", "db_id": "customers_campaigns_ecommerce", "question": "What are all the distinct premise types?", "gold_sql": "SELECT DISTINCT premises_type FROM premises", "db_path": "databases/customers_campaigns_ecommerce/customers_campaigns_ecommerce.sqlite", "schema": "CREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`premise_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`premise_id` ) REFERENCES `Premises`(`premise_id` )\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(15) NOT NULL,\n`shipping_method_code` VARCHAR(15) NOT NULL,\n`order_placed_datetime` DATETIME NOT NULL,\n`order_delivered_datetime` DATETIME,\n`order_shipping_charges` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method` VARCHAR(15) NOT NULL,\n`customer_name` VARCHAR(80),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_login` VARCHAR(80),\n`customer_password` VARCHAR(10)\n);\nCREATE TABLE `Mailshot_Campaigns` (\n`mailshot_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15),\n`mailshot_name` VARCHAR(80),\n`mailshot_start_date` DATETIME,\n`mailshot_end_date` DATETIME\n);\nCREATE TABLE `Mailshot_Customers` (\n`mailshot_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(15) NOT NULL,\n`mailshot_customer_date` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`mailshot_id` ) REFERENCES `Mailshot_Campaigns`(`mailshot_id` )\n);\nCREATE TABLE `Order_Items` (\n`item_id` INTEGER NOT NULL ,\n`order_item_status_code` VARCHAR(15) NOT NULL,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`item_status_code` VARCHAR(15),\n`item_delivered_datetime` DATETIME,\n`item_order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);\nCREATE TABLE `Premises` (\n`premise_id` INTEGER PRIMARY KEY,\n`premises_type` VARCHAR(15) NOT NULL,\n`premise_details` VARCHAR(255)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80)\n);"} {"qid": "pool_0418", "split": "pool", "db_id": "icfp_1", "question": "Which paper's title contains the word \"Database\"?", "gold_sql": "SELECT title FROM papers WHERE title LIKE \"%Database%\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0419", "split": "pool", "db_id": "college_1", "question": "What are the first names of all teachers who have taught a course and the corresponding course codes?", "gold_sql": "SELECT T2.emp_fname , T1.crs_code FROM CLASS AS T1 JOIN employee AS T2 ON T1.prof_num = T2.emp_num", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0420", "split": "pool", "db_id": "wine_1", "question": "Give the average price and case of wines made from Zinfandel grapes in the year 2009.", "gold_sql": "SELECT AVG(Price) , AVG(Cases) FROM WINE WHERE YEAR = 2009 AND Grape = \"Zinfandel\"", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0421", "split": "pool", "db_id": "bike_1", "question": "What is the id of the bike that traveled the most in 94002?", "gold_sql": "SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0422", "split": "pool", "db_id": "baseball_1", "question": "For each year, return the year and the number of times the team Boston Red Stockings won in the postseasons.", "gold_sql": "SELECT count(*) , T1.year FROM postseason AS T1 JOIN team AS T2 ON T1.team_id_winner = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' GROUP BY T1.year", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0423", "split": "pool", "db_id": "storm_record", "question": "What are the region names affected by the storm with a number of deaths of least 10?", "gold_sql": "SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10", "db_path": "databases/storm_record/storm_record.sqlite", "schema": "CREATE TABLE `affected_region` (\n`Region_id` int,\n`Storm_ID` int,\n`Number_city_affected` real,\nPRIMARY KEY (`Region_id`,`Storm_ID`),\nFOREIGN KEY (`Region_id`) REFERENCES `region`(`Region_id`),\nFOREIGN KEY (`Storm_ID`) REFERENCES `storm`(`Storm_ID`)\n);\nCREATE TABLE \"region\" (\n`Region_id` int,\n`Region_code` text,\n`Region_name` text,\nPRIMARY KEY (\"Region_id\")\n);\nCREATE TABLE \"storm\" (\n\"Storm_ID\" int,\n\"Name\" text,\n\"Dates_active\" text,\n\"Max_speed\" int,\n\"Damage_millions_USD\" real,\n\"Number_Deaths\" int,\nPRIMARY KEY (\"Storm_ID\")\n);"} {"qid": "pool_0424", "split": "pool", "db_id": "shop_membership", "question": "How many branches where have more than average number of memberships are there?", "gold_sql": "SELECT count(*) FROM branch WHERE membership_amount > (SELECT avg(membership_amount) FROM branch)", "db_path": "databases/shop_membership/shop_membership.sqlite", "schema": "CREATE TABLE \"branch\" (\n\"Branch_ID\" int,\n\"Name\" text,\n\"Open_year\" text,\n\"Address_road\" text,\n\"City\" text,\n\"membership_amount\" text,\nPRIMARY KEY (\"Branch_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Card_Number\" text,\n\"Name\" text,\n\"Hometown\" text,\n\"Level\" int,\nPRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"membership_register_branch\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Register_Year\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);\nCREATE TABLE \"purchase\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Year\" text,\n\"Total_pounds\" real,\nPRIMARY KEY (\"Member_ID\",\"Branch_ID\",\"Year\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);"} {"qid": "pool_0425", "split": "pool", "db_id": "sports_competition", "question": "Please show the names and the players of clubs.", "gold_sql": "SELECT T1.name , T2.Player_id FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID", "db_path": "databases/sports_competition/sports_competition.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"name\" text,\n\"Region\" text,\n\"Start_year\" text,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"club_rank\" (\n\"Rank\" real,\n\"Club_ID\" int,\n\"Gold\" real,\n\"Silver\" real,\n\"Bronze\" real,\n\"Total\" real,\nPRIMARY KEY (\"Rank\",\"Club_ID\")\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"competition\" (\n\"Competition_ID\" int,\n\"Year\" real,\n\"Competition_type\" text,\n\"Country\" text,\nPRIMARY KEY (\"Competition_ID\")\n);\nCREATE TABLE \"competition_result\" (\n\"Competition_ID\" int,\n\"Club_ID_1\" int,\n\"Club_ID_2\" int,\n\"Score\" text,\nPRIMARY KEY (\"Competition_ID\",\"Club_ID_1\",\"Club_ID_2\"),\nFOREIGN KEY (`Club_ID_1`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Club_ID_2`) REFERENCES `club`(`Club_ID`),\nFOREIGN KEY (`Competition_ID`) REFERENCES `competition`(`Competition_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"name\" text,\n\"Position\" text,\n\"Club_ID\" int,\n\"Apps\" real,\n\"Tries\" real,\n\"Goals\" text,\n\"Points\" real,\nPRIMARY KEY (\"Player_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);"} {"qid": "pool_0426", "split": "pool", "db_id": "music_2", "question": "How many instruments does the song \"Badlands\" use?", "gold_sql": "SELECT count(DISTINCT instrument) FROM instruments AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE title = \"Badlands\"", "db_path": "databases/music_2/music_2.sqlite", "schema": "CREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Label\" TEXT, \n\t\"Type\" TEXT );\nCREATE TABLE \"Band\" ( \n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Firstname\" TEXT, \n\t\"Lastname\" TEXT );\nCREATE TABLE \"Instruments\" ( \n\t\"SongId\" INTEGER, \n\t\"BandmateId\" INTEGER, \n\t\"Instrument\" TEXT ,\n\tPRIMARY KEY(SongId, BandmateId, Instrument),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (BandmateId) REFERENCES Band(Id)\n);\nCREATE TABLE \"Performance\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"StagePosition\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);\nCREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT \n);\nCREATE TABLE \"Tracklists\" ( \n\t\"AlbumId\" INTEGER, \n\t\"Position\" INTEGER, \n\t\"SongId\" INTEGER ,\n\tPRIMARY KEY(AlbumId, Position),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (AlbumId) REFERENCES Albums(AId)\n);\nCREATE TABLE \"Vocals\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"Type\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);"} {"qid": "pool_0427", "split": "pool", "db_id": "game_injury", "question": "For each injury accident, find the date of the game and the name of the injured player in the game, and sort the results in descending order of game season.", "gold_sql": "SELECT T1.date , T2.player FROM game AS T1 JOIN injury_accident AS T2 ON T1.id = T2.game_id ORDER BY T1.season DESC", "db_path": "databases/game_injury/game_injury.sqlite", "schema": "CREATE TABLE \"game\" (\n\"stadium_id\" int,\n\"id\" int,\n\"Season\" int,\n\"Date\" text,\n\"Home_team\" text,\n\"Away_team\" text,\n\"Score\" text,\n\"Competition\" text,\nprimary key (\"id\"),\nforeign key (\"stadium_id\") references `stadium`(\"id\")\n);\nCREATE TABLE \"injury_accident\" (\n\"game_id\" int,\n\"id\" int,\n\"Player\" text,\n\"Injury\" text,\n\"Number_of_matches\" text,\n\"Source\" text,\nprimary key (\"id\"),\nforeign key (\"game_id\") references `game`(\"id\")\n);\nCREATE TABLE \"stadium\" (\n\"id\" int,\n\"name\" text,\n\"Home_Games\" int,\n\"Average_Attendance\" real,\n\"Total_Attendance\" real,\n\"Capacity_Percentage\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0428", "split": "pool", "db_id": "student_assessment", "question": "How many students attend course English?", "gold_sql": "SELECT count(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T1.course_name = \"English\"", "db_path": "databases/student_assessment/student_assessment.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_1 VARCHAR(80),\nline_2 VARCHAR(80),\ncity VARCHAR(50),\nzip_postcode CHAR(20),\nstate_province_county VARCHAR(50),\ncountry VARCHAR(50),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Candidate_Assessments (\ncandidate_id INTEGER NOT NULL,\nqualification CHAR(15) NOT NULL,\nassessment_date DATETIME NOT NULL,\nasessment_outcome_code CHAR(15) NOT NULL,\nPRIMARY KEY (candidate_id, qualification),\nFOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)\n);\nCREATE TABLE Candidates (\ncandidate_id INTEGER NOT NULL ,\ncandidate_details VARCHAR(255),\nPRIMARY KEY (candidate_id),\nFOREIGN KEY (candidate_id) REFERENCES People (person_id)\n);\nCREATE TABLE Courses (\ncourse_id VARCHAR(100) NOT NULL,\ncourse_name VARCHAR(120),\ncourse_description VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (course_id)\n);\nCREATE TABLE People (\nperson_id INTEGER NOT NULL,\nfirst_name VARCHAR(255),\nmiddle_name VARCHAR(255),\nlast_name VARCHAR(255),\ncell_mobile_number VARCHAR(40),\nemail_address VARCHAR(40),\nlogin_name VARCHAR(40),\npassword VARCHAR(40),\nPRIMARY KEY (person_id)\n);\nCREATE TABLE People_Addresses (\nperson_address_id INTEGER NOT NULL,\nperson_id INTEGER NOT NULL,\naddress_id INTEGER NOT NULL,\ndate_from DATETIME,\ndate_to DATETIME,\nPRIMARY KEY (person_address_id),\nFOREIGN KEY (person_id) REFERENCES People (person_id),\nFOREIGN KEY (address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Student_Course_Attendance (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\ndate_of_attendance DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)\n);\nCREATE TABLE Student_Course_Registrations (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\nregistration_date DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id) REFERENCES Students (student_id),\nFOREIGN KEY (course_id) REFERENCES Courses (course_id)\n);\nCREATE TABLE Students (\nstudent_id INTEGER NOT NULL,\nstudent_details VARCHAR(255),\nPRIMARY KEY (student_id),\nFOREIGN KEY (student_id) REFERENCES People (person_id)\n);"} {"qid": "pool_0429", "split": "pool", "db_id": "flight_1", "question": "What is the flight number and its distance for the one with the maximum price?", "gold_sql": "SELECT flno , distance FROM Flight ORDER BY price DESC LIMIT 1", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0430", "split": "pool", "db_id": "college_1", "question": "What are the first names and offices of history professors who don't have Ph.D.s?", "gold_sql": "SELECT T2.emp_fname , T1.prof_office FROM professor AS T1 JOIN employee AS T2 ON T1.emp_num = T2.emp_num JOIN department AS T3 ON T1.dept_code = T3.dept_code WHERE T3.dept_name = 'History' AND T1.prof_high_degree != 'Ph.D.'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0431", "split": "pool", "db_id": "driving_school", "question": "How much in total does customer with first name as Carole and last name as Bernhard paid?", "gold_sql": "SELECT sum(T1.amount_payment) FROM Customer_Payments AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = \"Carole\" AND T2.last_name = \"Bernhard\"", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0432", "split": "pool", "db_id": "baseball_1", "question": "How many players did Boston Red Stockings have in 2000?", "gold_sql": "SELECT count(*) FROM salary AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T2.name = 'Boston Red Stockings' AND T1.year = 2000", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0433", "split": "pool", "db_id": "college_3", "question": "What is all the information about courses, ordered by credits ascending?", "gold_sql": "SELECT * FROM COURSE ORDER BY Credits", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0434", "split": "pool", "db_id": "music_2", "question": "How many unique labels are there for albums?", "gold_sql": "SELECT count(DISTINCT label) FROM albums", "db_path": "databases/music_2/music_2.sqlite", "schema": "CREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Label\" TEXT, \n\t\"Type\" TEXT );\nCREATE TABLE \"Band\" ( \n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Firstname\" TEXT, \n\t\"Lastname\" TEXT );\nCREATE TABLE \"Instruments\" ( \n\t\"SongId\" INTEGER, \n\t\"BandmateId\" INTEGER, \n\t\"Instrument\" TEXT ,\n\tPRIMARY KEY(SongId, BandmateId, Instrument),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (BandmateId) REFERENCES Band(Id)\n);\nCREATE TABLE \"Performance\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"StagePosition\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);\nCREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT \n);\nCREATE TABLE \"Tracklists\" ( \n\t\"AlbumId\" INTEGER, \n\t\"Position\" INTEGER, \n\t\"SongId\" INTEGER ,\n\tPRIMARY KEY(AlbumId, Position),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (AlbumId) REFERENCES Albums(AId)\n);\nCREATE TABLE \"Vocals\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"Type\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);"} {"qid": "pool_0435", "split": "pool", "db_id": "dorm_1", "question": "What are the first names of all students in Smith Hall?", "gold_sql": "SELECT T1.fname FROM student AS T1 JOIN lives_in AS T2 ON T1.stuid = T2.stuid JOIN dorm AS T3 ON T3.dormid = T2.dormid WHERE T3.dorm_name = 'Smith Hall'", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0436", "split": "pool", "db_id": "flight_1", "question": "What is the salaray and name of the employee that is certified to fly the most planes?", "gold_sql": "SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0437", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "What are the names of the employees who authorised the destruction and the employees who destroyed the corresponding documents?", "gold_sql": "SELECT T2.employee_name , T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id;", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0438", "split": "pool", "db_id": "allergy_1", "question": "What are the average ages for male and female students?", "gold_sql": "SELECT avg(age) , sex FROM Student GROUP BY sex", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0439", "split": "pool", "db_id": "flight_4", "question": "What is the name of the airline with the most routes?", "gold_sql": "SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0440", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "What is the location code with the most documents?", "gold_sql": "SELECT location_code FROM Document_locations GROUP BY location_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0441", "split": "pool", "db_id": "csu_1", "question": "What is the total number of campuses?", "gold_sql": "SELECT count(*) FROM campuses", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0442", "split": "pool", "db_id": "driving_school", "question": "How many lessons taken by customer with first name as Rylan and last name as Goodwin were completed?", "gold_sql": "SELECT count(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = \"Rylan\" AND T2.last_name = \"Goodwin\" AND T1.lesson_status_code = \"Completed\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0443", "split": "pool", "db_id": "entrepreneur", "question": "How many distinct companies are there?", "gold_sql": "SELECT count(DISTINCT Company) FROM entrepreneur", "db_path": "databases/entrepreneur/entrepreneur.sqlite", "schema": "CREATE TABLE \"entrepreneur\" (\n\"Entrepreneur_ID\" int,\n\"People_ID\" int,\n\"Company\" text,\n\"Money_Requested\" real,\n\"Investor\" text,\nPRIMARY KEY (\"Entrepreneur_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Date_of_Birth\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0444", "split": "pool", "db_id": "flight_4", "question": "Find the number of routes for each source airport and the airport name.", "gold_sql": "SELECT count(*) , T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0445", "split": "pool", "db_id": "company_office", "question": "Find the stories of the building with the largest height.", "gold_sql": "SELECT Stories FROM buildings ORDER BY Height DESC LIMIT 1", "db_path": "databases/company_office/company_office.sqlite", "schema": "CREATE TABLE \"Companies\" (\n\"id\" int,\n\"name\" text,\n\"Headquarters\" text,\n\"Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value_billion\" text,\nPRIMARY KEY (\"id\")\n);\nCREATE TABLE \"Office_locations\" (\n\"building_id\" int,\n\"company_id\" int,\n\"move_in_year\" int,\nPRIMARY KEY (\"building_id\", \"company_id\"),\nFOREIGN KEY (\"building_id\") REFERENCES \"buildings\"(\"id\"),\nFOREIGN KEY (\"company_id\") REFERENCES \"Companies\"(\"id\")\n);\nCREATE TABLE \"buildings\" (\n\"id\" int,\n\"name\" text,\n\"City\" text,\n\"Height\" int,\n\"Stories\" int,\n\"Status\" text,\nPRIMARY KEY(\"id\")\n);"} {"qid": "pool_0446", "split": "pool", "db_id": "restaurant_1", "question": "What is the age of student Linda Smith?", "gold_sql": "SELECT Age FROM Student WHERE Fname = \"Linda\" AND Lname = \"Smith\";", "db_path": "databases/restaurant_1/restaurant_1.sqlite", "schema": "CREATE TABLE Restaurant (\n ResID INTEGER PRIMARY KEY,\n ResName VARCHAR(100),\n Address VARCHAR(100),\n Rating INTEGER\n);\nCREATE TABLE Restaurant_Type (\n ResTypeID INTEGER PRIMARY KEY,\n ResTypeName VARCHAR(40),\n ResTypeDescription VARCHAR(100)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Type_Of_Restaurant (\n ResID INTEGER,\n ResTypeID INTEGER,\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),\n FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)\n);\nCREATE TABLE Visits_Restaurant (\n StuID INTEGER,\n ResID INTEGER,\n Time TIMESTAMP,\n Spent FLOAT,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)\n);"} {"qid": "pool_0447", "split": "pool", "db_id": "news_report", "question": "List the names of journalists who have not reported any event.", "gold_sql": "SELECT Name FROM journalist WHERE journalist_ID NOT IN (SELECT journalist_ID FROM news_report)", "db_path": "databases/news_report/news_report.sqlite", "schema": "CREATE TABLE \"event\" (\n \"Event_ID\" int,\n \"Date\" text,\n \"Venue\" text,\n \"Name\" text,\n \"Event_Attendance\" int,\n PRIMARY KEY (\"Event_ID\")\n);\nCREATE TABLE \"journalist\" (\n \"journalist_ID\" int,\n \"Name\" text,\n \"Nationality\" text,\n \"Age\" text,\n \"Years_working\" int,\n PRIMARY KEY (\"journalist_ID\")\n);\nCREATE TABLE \"news_report\" (\n \"journalist_ID\" int,\n \"Event_ID\" int,\n \"Work_Type\" text,\n PRIMARY KEY (\"journalist_ID\",\"Event_ID\"),\n FOREIGN KEY (\"journalist_ID\") REFERENCES `journalist`(\"journalist_ID\"),\n FOREIGN KEY (\"Event_ID\") REFERENCES `event`(\"Event_ID\")\n);"} {"qid": "pool_0448", "split": "pool", "db_id": "driving_school", "question": "What is the nickname of staff with first name as Janessa and last name as Sawayn?", "gold_sql": "SELECT nickname FROM Staff WHERE first_name = \"Janessa\" AND last_name = \"Sawayn\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0449", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "Show the ids of all employees who don't destroy any document.", "gold_sql": "SELECT employee_id FROM Employees EXCEPT SELECT Destroyed_by_Employee_ID FROM Documents_to_be_destroyed", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0450", "split": "pool", "db_id": "products_gen_characteristics", "question": "Find the names of all the product characteristics.", "gold_sql": "SELECT DISTINCT characteristic_name FROM CHARACTERISTICS", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0451", "split": "pool", "db_id": "college_2", "question": "Count the number of classrooms in Lamberton.", "gold_sql": "SELECT count(*) FROM classroom WHERE building = 'Lamberton'", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0452", "split": "pool", "db_id": "products_gen_characteristics", "question": "What are the names of the characteristics of the product 'sesame' that have the characteristic type code 'Grade'?", "gold_sql": "SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = \"sesame\" AND t3.characteristic_type_code = \"Grade\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0453", "split": "pool", "db_id": "customers_and_invoices", "question": "What is the average, minimum, maximum, and total transaction amount?", "gold_sql": "SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0454", "split": "pool", "db_id": "bike_1", "question": "Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.", "gold_sql": "SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0455", "split": "pool", "db_id": "baseball_1", "question": "For each team, return the team name, id and the maximum salary among the team.", "gold_sql": "SELECT T1.name , T1.team_id , max(T2.salary) FROM team AS T1 JOIN salary AS T2 ON T1.team_id = T2.team_id GROUP BY T1.team_id;", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0456", "split": "pool", "db_id": "department_store", "question": "Return the ids of the two department store chains with the most department stores.", "gold_sql": "SELECT dept_store_chain_id FROM department_stores GROUP BY dept_store_chain_id ORDER BY count(*) DESC LIMIT 2", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0457", "split": "pool", "db_id": "store_1", "question": "Which employee manage most number of peoples? List employee's first and last name, and number of people report to that employee.", "gold_sql": "SELECT T2.first_name , T2.last_name , count(T1.reports_to) FROM employees AS T1 JOIN employees AS T2 ON T1.reports_to = T2.id GROUP BY T1.reports_to ORDER BY count(T1.reports_to) DESC LIMIT 1;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0458", "split": "pool", "db_id": "dorm_1", "question": "What is the average age for each city and what are those cities?", "gold_sql": "SELECT avg(age) , city_code FROM student GROUP BY city_code", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0459", "split": "pool", "db_id": "city_record", "question": "Which three cities have the largest regional population?", "gold_sql": "SELECT city FROM city ORDER BY regional_population DESC LIMIT 3", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0460", "split": "pool", "db_id": "gas_company", "question": "List the main industry with highest total market value and its number of companies.", "gold_sql": "SELECT main_industry , count(*) FROM company GROUP BY main_industry ORDER BY sum(market_value) DESC LIMIT 1", "db_path": "databases/gas_company/gas_company.sqlite", "schema": "CREATE TABLE \"company\" (\n\"Company_ID\" int,\n\"Rank\" int,\n\"Company\" text,\n\"Headquarters\" text,\n\"Main_Industry\" text,\n\"Sales_billion\" real,\n\"Profits_billion\" real,\n\"Assets_billion\" real,\n\"Market_Value\" real,\nPRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"gas_station\" (\n\"Station_ID\" int,\n\"Open_Year\" int,\n\"Location\" text,\n\"Manager_Name\" text,\n\"Vice_Manager_Name\" text,\n\"Representative_Name\" text,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"station_company\" (\n\"Station_ID\" int,\n\"Company_ID\" int,\n\"Rank_of_the_Year\" int,\nPRIMARY KEY (\"Station_ID\",\"Company_ID\"),\nFOREIGN KEY (`Station_ID`) REFERENCES `gas_station`(`Station_ID`),\nFOREIGN KEY (`Company_ID`) REFERENCES `company`(`Company_ID`)\n);"} {"qid": "pool_0461", "split": "pool", "db_id": "store_1", "question": "What are the names of the top 8 countries by total invoice size and what are those sizes?", "gold_sql": "SELECT billing_country , SUM(total) FROM invoices GROUP BY billing_country ORDER BY SUM(total) DESC LIMIT 8;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0462", "split": "pool", "db_id": "device", "question": "List the names of shops that have no devices in stock.", "gold_sql": "SELECT Shop_Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM stock)", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0463", "split": "pool", "db_id": "movie_1", "question": "What are the titles and average ratings for all movies that have the lowest average rating?", "gold_sql": "SELECT T2.title , avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY avg(T1.stars) LIMIT 1", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0464", "split": "pool", "db_id": "assets_maintenance", "question": "When was the first asset acquired?", "gold_sql": "SELECT asset_acquired_date FROM Assets ORDER BY asset_acquired_date ASC LIMIT 1", "db_path": "databases/assets_maintenance/assets_maintenance.sqlite", "schema": "CREATE TABLE `Asset_Parts` (\n`asset_id` INTEGER NOT NULL,\n`part_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` ),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` )\n);\nCREATE TABLE `Assets` (\n`asset_id` INTEGER PRIMARY KEY,\n`maintenance_contract_id` INTEGER NOT NULL,\n`supplier_company_id` INTEGER NOT NULL,\n`asset_details` VARCHAR(255),\n`asset_make` VARCHAR(20),\n`asset_model` VARCHAR(20),\n`asset_acquired_date` DATETIME,\n`asset_disposed_date` DATETIME,\n`other_asset_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_id` )\nREFERENCES `Maintenance_Contracts`(`maintenance_contract_id` ),\nFOREIGN KEY (`supplier_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Engineer_Skills` (\n`engineer_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Engineer_Visits` (\n`engineer_visit_id` INTEGER PRIMARY KEY,\n`contact_staff_id` INTEGER,\n`engineer_id` INTEGER NOT NULL,\n`fault_log_entry_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\n`visit_start_datetime` DATETIME,\n`visit_end_datetime` DATETIME,\n`other_visit_details` VARCHAR(255),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` ),\nFOREIGN KEY (`engineer_id` ) REFERENCES `Maintenance_Engineers`(`engineer_id` ),\nFOREIGN KEY (`contact_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log` (\n`fault_log_entry_id` INTEGER PRIMARY KEY,\n`asset_id` INTEGER NOT NULL,\n`recorded_by_staff_id` INTEGER NOT NULL,\n`fault_log_entry_datetime` DATETIME,\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`asset_id` ) REFERENCES `Assets`(`asset_id` ),\nFOREIGN KEY (`recorded_by_staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Fault_Log_Parts` (\n`fault_log_entry_id` INTEGER NOT NULL,\n`part_fault_id` INTEGER NOT NULL,\n`fault_status` VARCHAR(10) NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`fault_log_entry_id` ) REFERENCES `Fault_Log`(`fault_log_entry_id` )\n);\nCREATE TABLE `Maintenance_Contracts` (\n`maintenance_contract_id` INTEGER PRIMARY KEY,\n`maintenance_contract_company_id` INTEGER NOT NULL,\n`contract_start_date` DATETIME,\n`contract_end_date` DATETIME,\n`other_contract_details` VARCHAR(255),\nFOREIGN KEY (`maintenance_contract_company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Maintenance_Engineers` (\n`engineer_id` INTEGER PRIMARY KEY,\n`company_id` INTEGER NOT NULL,\n`first_name` VARCHAR(50),\n`last_name` VARCHAR(50),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`company_id` ) REFERENCES `Third_Party_Companies`(`company_id` )\n);\nCREATE TABLE `Part_Faults` (\n`part_fault_id` INTEGER PRIMARY KEY,\n`part_id` INTEGER NOT NULL,\n`fault_short_name` VARCHAR(20),\n`fault_description` VARCHAR(255),\n`other_fault_details` VARCHAR(255),\nFOREIGN KEY (`part_id` ) REFERENCES `Parts`(`part_id` )\n);\nCREATE TABLE `Parts` (\n`part_id` INTEGER PRIMARY KEY,\n`part_name` VARCHAR(255),\n`chargeable_yn` VARCHAR(1),\n`chargeable_amount` VARCHAR(20),\n`other_part_details` VARCHAR(255)\n);\nCREATE TABLE `Skills` (\n`skill_id` INTEGER PRIMARY KEY,\n`skill_code` VARCHAR(20),\n`skill_description` VARCHAR(255)\n);\nCREATE TABLE `Skills_Required_To_Fix` (\n`part_fault_id` INTEGER NOT NULL,\n`skill_id` INTEGER NOT NULL,\nFOREIGN KEY (`part_fault_id` ) REFERENCES `Part_Faults`(`part_fault_id` ),\nFOREIGN KEY (`skill_id` ) REFERENCES `Skills`(`skill_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_name` VARCHAR(255),\n`gender` VARCHAR(1),\n`other_staff_details` VARCHAR(255)\n);\nCREATE TABLE `Third_Party_Companies` (\n`company_id` INTEGER PRIMARY KEY ,\n`company_type` VARCHAR(5) NOT NULL,\n`company_name` VARCHAR(255),\n`company_address` VARCHAR(255),\n`other_company_details` VARCHAR(255)\n);"} {"qid": "pool_0465", "split": "pool", "db_id": "store_1", "question": "What are the states with the most invoices?", "gold_sql": "SELECT billing_state , COUNT(*) FROM invoices WHERE billing_country = \"USA\" GROUP BY billing_state ORDER BY COUNT(*) DESC LIMIT 1;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0466", "split": "pool", "db_id": "performance_attendance", "question": "Show the most common location of performances.", "gold_sql": "SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/performance_attendance/performance_attendance.sqlite", "schema": "CREATE TABLE \"member\" (\n \"Member_ID\" text,\n \"Name\" text,\n \"Nationality\" text,\n \"Role\" text,\n PRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"member_attendance\" (\n \"Member_ID\" int,\n \"Performance_ID\" int,\n \"Num_of_Pieces\" int,\n PRIMARY KEY (\"Member_ID\",\"Performance_ID\"),\n FOREIGN KEY (\"Member_ID\") REFERENCES `member`(\"Member_ID\"),\n FOREIGN KEY (\"Performance_ID\") REFERENCES `performance`(\"Performance_ID\")\n);\nCREATE TABLE \"performance\" (\n \"Performance_ID\" real,\n \"Date\" text,\n \"Host\" text,\n \"Location\" text,\n \"Attendance\" int,\n PRIMARY KEY (\"Performance_ID\")\n);"} {"qid": "pool_0467", "split": "pool", "db_id": "flight_1", "question": "What are the aircrafts with top 3 shortest lengthes? List their names.", "gold_sql": "SELECT name FROM Aircraft ORDER BY distance LIMIT 3", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0468", "split": "pool", "db_id": "city_record", "question": "IN which year did city \"Taizhou ( Zhejiang )\" serve as a host city?", "gold_sql": "SELECT T2.year FROM city AS T1 JOIN hosting_city AS T2 ON T1.city_id = T2.host_city WHERE T1.city = \"Taizhou ( Zhejiang )\"", "db_path": "databases/city_record/city_record.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"City\" text,\n\"Hanzi\" text,\n\"Hanyu_Pinyin\" text,\n\"Regional_Population\" int,\n\"GDP\" real,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"hosting_city\" (\n \"Year\" int,\n \"Match_ID\" int,\n \"Host_City\" text,\n PRIMARY KEY (\"Year\"),\n FOREIGN KEY (`Host_City`) REFERENCES `city`(`City_ID`),\n FOREIGN KEY (`Match_ID`) REFERENCES `match`(`Match_ID`)\n);\nCREATE TABLE \"match\" (\n\"Match_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Score\" text,\n\"Result\" text,\n\"Competition\" text,\nPRIMARY KEY (\"Match_ID\")\n);\nCREATE TABLE \"temperature\" (\n\"City_ID\" int,\n\"Jan\" real,\n\"Feb\" real,\n\"Mar\" real,\n\"Apr\" real,\n\"Jun\" real,\n\"Jul\" real,\n\"Aug\" real,\n\"Sep\" real,\n\"Oct\" real,\n\"Nov\" real,\n\"Dec\" real,\nPRIMARY KEY (\"City_ID\"),\nFOREIGN KEY (`City_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "pool_0469", "split": "pool", "db_id": "department_store", "question": "Give the ids of the three products purchased in the largest amounts.", "gold_sql": "SELECT product_id FROM product_suppliers ORDER BY total_amount_purchased DESC LIMIT 3", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0470", "split": "pool", "db_id": "college_2", "question": "What is the title of the course that was offered at building Chandler during the fall semester in the year of 2010?", "gold_sql": "SELECT T1.title FROM course AS T1 JOIN SECTION AS T2 ON T1.course_id = T2.course_id WHERE building = 'Chandler' AND semester = 'Fall' AND YEAR = 2010", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0471", "split": "pool", "db_id": "movie_1", "question": "What are the names of all reviewers that have given 3 or 4 stars for reviews?", "gold_sql": "SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0472", "split": "pool", "db_id": "music_2", "question": "How many songs have vocals of type lead?", "gold_sql": "SELECT count(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = \"lead\"", "db_path": "databases/music_2/music_2.sqlite", "schema": "CREATE TABLE \"Albums\" ( \n\t\"AId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Label\" TEXT, \n\t\"Type\" TEXT );\nCREATE TABLE \"Band\" ( \n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Firstname\" TEXT, \n\t\"Lastname\" TEXT );\nCREATE TABLE \"Instruments\" ( \n\t\"SongId\" INTEGER, \n\t\"BandmateId\" INTEGER, \n\t\"Instrument\" TEXT ,\n\tPRIMARY KEY(SongId, BandmateId, Instrument),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (BandmateId) REFERENCES Band(Id)\n);\nCREATE TABLE \"Performance\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"StagePosition\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);\nCREATE TABLE \"Songs\" ( \n\t\"SongId\" INTEGER PRIMARY KEY, \n\t\"Title\" TEXT \n);\nCREATE TABLE \"Tracklists\" ( \n\t\"AlbumId\" INTEGER, \n\t\"Position\" INTEGER, \n\t\"SongId\" INTEGER ,\n\tPRIMARY KEY(AlbumId, Position),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (AlbumId) REFERENCES Albums(AId)\n);\nCREATE TABLE \"Vocals\" ( \n\t\"SongId\" INTEGER, \n\t\"Bandmate\" INTEGER, \n\t\"Type\" TEXT,\n\tPRIMARY KEY(SongId, Bandmate),\n\tFOREIGN KEY (SongId) REFERENCES Songs(SongId),\n\tFOREIGN KEY (Bandmate) REFERENCES Band(Id)\n);"} {"qid": "pool_0473", "split": "pool", "db_id": "college_1", "question": "Where is the history department?", "gold_sql": "SELECT dept_address FROM department WHERE dept_name = 'History'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0474", "split": "pool", "db_id": "hospital_1", "question": "What is the name of the nurse has the most appointments?", "gold_sql": "SELECT T1.name FROM nurse AS T1 JOIN appointment AS T2 ON T1.employeeid = T2.prepnurse GROUP BY T1.employeeid ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0475", "split": "pool", "db_id": "voter_2", "question": "Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.", "gold_sql": "SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = \"PIT\"", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0476", "split": "pool", "db_id": "store_1", "question": "List top 10 employee work longest in the company. List employee's first and last name.", "gold_sql": "SELECT first_name , last_name FROM employees ORDER BY hire_date ASC LIMIT 10;", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0477", "split": "pool", "db_id": "driving_school", "question": "Which city does staff with first name as Janessa and last name as Sawayn live?", "gold_sql": "SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = \"Janessa\" AND T2.last_name = \"Sawayn\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0478", "split": "pool", "db_id": "ship_mission", "question": "What are the different fates of the mission that involved ships from the United States?", "gold_sql": "SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = \"United States\"", "db_path": "databases/ship_mission/ship_mission.sqlite", "schema": "CREATE TABLE \"mission\" (\n\"Mission_ID\" int,\n\"Ship_ID\" int,\n\"Code\" text,\n\"Launched_Year\" int,\n\"Location\" text,\n\"Speed_knots\" int,\n\"Fate\" text,\nPRIMARY KEY (\"Mission_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES `ship`(\"Ship_ID\")\n);\nCREATE TABLE \"ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Nationality\" text,\n\"Tonnage\" int,\nPRIMARY KEY (\"Ship_ID\")\n);"} {"qid": "pool_0479", "split": "pool", "db_id": "flight_company", "question": "What is the most common company type, and how many are there?", "gold_sql": "SELECT TYPE , count(*) FROM operate_company GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_company/flight_company.sqlite", "schema": "CREATE TABLE \"airport\" (\n\"id\" int,\n\"City\" text,\n\"Country\" text,\n\"IATA\" text,\n\"ICAO\" text,\n\"name\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"flight\" (\n\"id\" int,\n\"Vehicle_Flight_number\" text,\n\"Date\" text,\n\"Pilot\" text,\n\"Velocity\" real,\n\"Altitude\" real,\n\"airport_id\" int,\n\"company_id\" int,\nprimary key (\"id\"),\nforeign key (\"airport_id\") references `airport`(\"id\"),\nforeign key (\"company_id\") references `operate_company`(\"id\")\n);\nCREATE TABLE \"operate_company\" (\n\"id\" int,\n\"name\" text,\n\"Type\" text,\n\"Principal_activities\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0480", "split": "pool", "db_id": "college_2", "question": "What are the names of students who haven't taken any Biology courses?", "gold_sql": "SELECT name FROM student WHERE id NOT IN (SELECT T1.id FROM takes AS T1 JOIN course AS T2 ON T1.course_id = T2.course_id WHERE T2.dept_name = 'Biology')", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0481", "split": "pool", "db_id": "riding_club", "question": "List the names of players that do not have coaches.", "gold_sql": "SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM player_coach)", "db_path": "databases/riding_club/riding_club.sqlite", "schema": "CREATE TABLE \"club\" (\n\"Club_ID\" int,\n\"Club_name\" text,\n\"Region\" text,\n\"Start_year\" int,\nPRIMARY KEY (\"Club_ID\")\n);\nCREATE TABLE \"coach\" (\n\"Coach_ID\" int,\n\"Coach_name\" text,\n\"Gender\" text,\n\"Club_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Coach_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"match_result\" (\n\"Rank\" int,\n\"Club_ID\" int,\n\"Gold\" int,\n\"Big_Silver\" int,\n\"Small_Silver\" int,\n\"Bronze\" int,\n\"Points\" int,\nPRIMARY KEY (\"Rank\",\"Club_ID\"),\nFOREIGN KEY (`Club_ID`) REFERENCES `club`(`Club_ID`)\n);\nCREATE TABLE \"player\" (\n\"Player_ID\" int,\n\"Sponsor_name\" text,\n\"Player_name\" text,\n\"Gender\" text,\n\"Residence\" text,\n\"Occupation\" text,\n\"Votes\" int,\n\"Rank\" text,\nPRIMARY KEY (\"Player_ID\")\n);\nCREATE TABLE \"player_coach\" (\n\"Player_ID\" int,\n\"Coach_ID\" int,\n\"Starting_year\" int,\nPRIMARY KEY (\"Player_ID\",\"Coach_ID\"),\nFOREIGN KEY (`Player_ID`) REFERENCES `player`(`Player_ID`),\nFOREIGN KEY (`Coach_ID`) REFERENCES `coach`(`Coach_ID`)\n);"} {"qid": "pool_0482", "split": "pool", "db_id": "allergy_1", "question": "What are the student ids for all male students?", "gold_sql": "SELECT StuID FROM Student WHERE Sex = 'M'", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0483", "split": "pool", "db_id": "hospital_1", "question": "How many appointments are there?", "gold_sql": "SELECT count(*) FROM appointment", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0484", "split": "pool", "db_id": "wine_1", "question": "What are the names of wines that are more expensive then all wines made in the year 2006?", "gold_sql": "SELECT Name FROM WINE WHERE Price > (SELECT max(Price) FROM WINE WHERE YEAR = 2006)", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0485", "split": "pool", "db_id": "csu_1", "question": "What is the campus fee for San Jose State University in 1996?", "gold_sql": "SELECT campusfee FROM campuses AS T1 JOIN csu_fees AS T2 ON T1.id = t2.campus WHERE t1.campus = \"San Jose State University\" AND T2.year = 1996", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0486", "split": "pool", "db_id": "driving_school", "question": "What is maximum, minimum and average amount of outstanding of customer?", "gold_sql": "SELECT max(amount_outstanding) , min(amount_outstanding) , avg(amount_outstanding) FROM Customers;", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0487", "split": "pool", "db_id": "college_2", "question": "What are the names of students who have taken Statistics courses?", "gold_sql": "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'", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0488", "split": "pool", "db_id": "network_2", "question": "Whare the names, friends, and ages of all people who are older than the average age of a person?", "gold_sql": "SELECT DISTINCT T2.name , T2.friend , T1.age FROM Person AS T1 JOIN PersonFriend AS T2 ON T1.name = T2.friend WHERE T1.age > (SELECT avg(age) FROM person)", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0489", "split": "pool", "db_id": "department_store", "question": "Return the staff ids and genders for any staff with the title Department Manager.", "gold_sql": "SELECT T1.staff_id , T1.staff_gender FROM staff AS T1 JOIN staff_department_assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Department Manager\"", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0490", "split": "pool", "db_id": "college_2", "question": "What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students?", "gold_sql": "SELECT building , room_number FROM classroom WHERE capacity BETWEEN 50 AND 100", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0491", "split": "pool", "db_id": "baseball_1", "question": "Find the number of games taken place in city Atlanta in 2000.", "gold_sql": "SELECT count(*) FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2000 AND T2.city = 'Atlanta';", "db_path": "databases/baseball_1/baseball_1.sqlite", "schema": "CREATE TABLE all_star (\n player_id TEXT,\n year INTEGER,\n game_num INTEGER,\n game_id TEXT,\n team_id TEXT,\n league_id TEXT,\n gp NUMERIC,\n starting_pos NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE appearances (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n g_all NUMERIC,\n gs NUMERIC,\n g_batting INTEGER,\n g_defense NUMERIC,\n g_p INTEGER,\n g_c INTEGER,\n g_1b INTEGER,\n g_2b INTEGER,\n g_3b INTEGER,\n g_ss INTEGER,\n g_lf INTEGER,\n g_cf INTEGER,\n g_rf INTEGER,\n g_of INTEGER,\n g_dh NUMERIC,\n g_ph NUMERIC,\n g_pr NUMERIC,\n foreign key (team_id) references team(team_id),\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE batting ( player_id TEXT, year INTEGER, stint INTEGER, team_id TEXT, league_id TEXT, g INTEGER, ab NUMERIC,\n r NUMERIC,\n h NUMERIC,\n double NUMERIC,\n triple NUMERIC,\n hr NUMERIC,\n rbi NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n bb NUMERIC,\n so NUMERIC,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\nforeign key (player_id) references player(player_id)\n);\nCREATE TABLE batting_postseason (\n year INTEGER,\n round TEXT,\n player_id TEXT,\n team_id TEXT,\n league_id TEXT,\n g INTEGER,\n ab INTEGER,\n r INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n rbi INTEGER,\n sb INTEGER,\n cs NUMERIC,\n bb INTEGER,\n so INTEGER,\n ibb NUMERIC,\n hbp NUMERIC,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE college (\n college_id TEXT,\n name_full TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE fielding (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po NUMERIC,\n a NUMERIC,\n e NUMERIC,\n dp NUMERIC,\n pb NUMERIC,\n wp NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n zr NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_outfield (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n glf NUMERIC,\n gcf NUMERIC,\n grf NUMERIC,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE fielding_postseason (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n round TEXT,\n pos TEXT,\n g INTEGER,\n gs NUMERIC,\n inn_outs NUMERIC,\n po INTEGER,\n a INTEGER,\n e INTEGER,\n dp INTEGER,\n tp INTEGER,\n pb NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (team_id) references player(team_id)\n);\nCREATE TABLE hall_of_fame (\n player_id TEXT,\n yearid INTEGER,\n votedby TEXT,\n ballots NUMERIC,\n needed NUMERIC,\n votes NUMERIC,\n inducted TEXT,\n category TEXT,\n needed_note TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE home_game (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n park_id TEXT,\n span_first TEXT,\n span_last TEXT,\n games INTEGER,\n openings INTEGER,\n attendance INTEGER,\n\tforeign key (team_id) references team(team_id),\n\tforeign key (park_id) references park(park_id)\n);\nCREATE TABLE manager (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank NUMERIC,\n plyr_mgr TEXT,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE manager_award (\n player_id TEXT,\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n tie TEXT,\n notes NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE manager_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won INTEGER,\n points_max INTEGER,\n votes_first INTEGER);\nCREATE TABLE manager_half (\n player_id TEXT,\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n inseason INTEGER,\n half INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER,\n rank INTEGER,\n\tforeign key (team_id) references team(team_id)\n);\nCREATE TABLE park (\n park_id TEXT,\n park_name TEXT,\n park_alias TEXT,\n city TEXT,\n state TEXT,\n country TEXT);\nCREATE TABLE pitching (\n player_id TEXT,\n year INTEGER,\n stint INTEGER,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts NUMERIC,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp NUMERIC,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk INTEGER,\n bfp NUMERIC,\n gf NUMERIC,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE pitching_postseason (\n player_id TEXT,\n year INTEGER,\n round TEXT,\n team_id TEXT,\n league_id TEXT,\n w INTEGER,\n l INTEGER,\n g INTEGER,\n gs INTEGER,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n h INTEGER,\n er INTEGER,\n hr INTEGER,\n bb INTEGER,\n so INTEGER,\n baopp TEXT,\n era NUMERIC,\n ibb NUMERIC,\n wp NUMERIC,\n hbp NUMERIC,\n bk NUMERIC,\n bfp NUMERIC,\n gf INTEGER,\n r INTEGER,\n sh NUMERIC,\n sf NUMERIC,\n g_idp NUMERIC);\nCREATE TABLE player (\n player_id TEXT,\n birth_year NUMERIC,\n birth_month NUMERIC,\n birth_day NUMERIC,\n birth_country TEXT,\n birth_state TEXT,\n birth_city TEXT,\n death_year NUMERIC,\n death_month NUMERIC,\n death_day NUMERIC,\n death_country TEXT,\n death_state TEXT,\n death_city TEXT,\n name_first TEXT,\n name_last TEXT,\n name_given TEXT,\n weight NUMERIC,\n height NUMERIC,\n bats TEXT,\n throws TEXT,\n debut TEXT,\n final_game TEXT,\n retro_id TEXT,\n bbref_id TEXT);\nCREATE TABLE player_award ( \n\tplayer_id TEXT, \n\taward_id TEXT, \n\tyear INTEGER, \n\tleague_id TEXT,\n \ttie TEXT,\n \tnotes TEXT,\n\tforeign key (player_id) references player(player_id)\n);\nCREATE TABLE player_award_vote (\n award_id TEXT,\n year INTEGER,\n league_id TEXT,\n player_id TEXT,\n points_won NUMERIC,\n points_max INTEGER,\n votes_first NUMERIC,\n foreign key (player_id) references player(player_id)\n);\nCREATE TABLE player_college ( player_id TEXT,\n college_id TEXT,\n year INTEGER,\n\tforeign key (player_id) references player(player_id),\n\tforeign key (college_id) references college(college_id)\n);\nCREATE TABLE postseason (\n year INTEGER,\n round TEXT,\n team_id_winner TEXT,\n league_id_winner TEXT,\n team_id_loser TEXT,\n league_id_loser TEXT,\n wins INTEGER,\n losses INTEGER,\n ties INTEGER);\nCREATE TABLE salary (\n year INTEGER,\n team_id TEXT,\n league_id TEXT,\n player_id TEXT,\n salary INTEGER);\nCREATE TABLE team (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n franchise_id TEXT,\n div_id TEXT,\n rank INTEGER,\n g INTEGER,\n ghome NUMERIC,\n w INTEGER,\n l INTEGER,\n div_win TEXT,\n wc_win TEXT,\n lg_win TEXT,\n ws_win TEXT,\n r INTEGER,\n ab INTEGER,\n h INTEGER,\n double INTEGER,\n triple INTEGER,\n hr INTEGER,\n bb INTEGER,\n so NUMERIC,\n sb NUMERIC,\n cs NUMERIC,\n hbp NUMERIC,\n sf NUMERIC,\n ra INTEGER,\n er INTEGER,\n era NUMERIC,\n cg INTEGER,\n sho INTEGER,\n sv INTEGER,\n ipouts INTEGER,\n ha INTEGER,\n hra INTEGER,\n bba INTEGER,\n soa INTEGER,\n e INTEGER,\n dp NUMERIC,\n fp NUMERIC,\n name TEXT,\n park TEXT,\n attendance NUMERIC,\n bpf INTEGER,\n ppf INTEGER,\n team_id_br TEXT,\n team_id_lahman45 TEXT,\n team_id_retro TEXT);\nCREATE TABLE team_franchise (\n franchise_id TEXT,\n franchise_name TEXT,\n active TEXT,\n na_assoc TEXT);\nCREATE TABLE team_half (\n year INTEGER,\n league_id TEXT,\n team_id TEXT,\n half INTEGER,\n div_id TEXT,\n div_win TEXT,\n rank INTEGER,\n g INTEGER,\n w INTEGER,\n l INTEGER);"} {"qid": "pool_0492", "split": "pool", "db_id": "activity_1", "question": "Show all the buildings that have at least 10 professors.", "gold_sql": "SELECT building FROM Faculty WHERE rank = \"Professor\" GROUP BY building HAVING count(*) >= 10", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0493", "split": "pool", "db_id": "flight_1", "question": "What is the salaray and name of the employee with the most certificates to fly planes more than 5000?", "gold_sql": "SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0494", "split": "pool", "db_id": "icfp_1", "question": "Which authors have first name \"Amal\"? List their last names.", "gold_sql": "SELECT lname FROM authors WHERE fname = \"Amal\"", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0495", "split": "pool", "db_id": "college_1", "question": "What is the first name of students who got grade C in any class?", "gold_sql": "SELECT DISTINCT stu_fname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE enroll_grade = 'C'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0496", "split": "pool", "db_id": "epinions_1", "question": "Find the number of users who did not write any review.", "gold_sql": "SELECT count(*) FROM useracct WHERE u_id NOT IN (SELECT u_id FROM review)", "db_path": "databases/epinions_1/epinions_1.sqlite", "schema": "CREATE TABLE `item` (\n `i_id` integer NOT NULL\n, `title` varchar(20) DEFAULT NULL\n, PRIMARY KEY (`i_id`)\n);\nCREATE TABLE `review` (\n `a_id` integer NOT NULL PRIMARY KEY\n, `u_id` integer NOT NULL\n, `i_id` integer NOT NULL\n, `rating` integer DEFAULT NULL\n, `rank` integer DEFAULT NULL\n, \tFOREIGN KEY (`u_id`) REFERENCES `useracct`(`u_id`)\n, \tFOREIGN KEY (`i_id`) REFERENCES `item`(`i_id`)\n);\nCREATE TABLE \"trust\" (`source_u_id` integer NOT NULL, `target_u_id` integer NOT NULL, `trust` integer NOT NULL, FOREIGN KEY (`source_u_id`) REFERENCES `useracct`(`u_id`), FOREIGN KEY (`target_u_id`) REFERENCES `useracct`(`u_id`));\nCREATE TABLE `useracct` (\n `u_id` integer NOT NULL\n, `name` varchar(128) DEFAULT NULL\n, PRIMARY KEY (`u_id`)\n);"} {"qid": "pool_0497", "split": "pool", "db_id": "college_3", "question": "What are the course names for courses taught on MTW?", "gold_sql": "SELECT CName FROM COURSE WHERE Days = \"MTW\"", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0498", "split": "pool", "db_id": "bike_1", "question": "For each zip code, select all those that have an average mean visiblity below 10.", "gold_sql": "SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_visibility_miles) < 10", "db_path": "databases/bike_1/bike_1.sqlite", "schema": "CREATE TABLE station (\n id INTEGER PRIMARY KEY,\n name TEXT,\n lat NUMERIC,\n long NUMERIC,\n dock_count INTEGER,\n city TEXT,\n installation_date TEXT);\nCREATE TABLE status (\n station_id INTEGER,\n bikes_available INTEGER,\n docks_available INTEGER,\n time TEXT,\n FOREIGN KEY (station_id) REFERENCES station(id)\n);\nCREATE TABLE trip (\n id INTEGER PRIMARY KEY,\n duration INTEGER,\n start_date TEXT,\n start_station_name TEXT, -- this should be removed\n start_station_id INTEGER,\n end_date TEXT,\n end_station_name TEXT, -- this should be removed\n end_station_id INTEGER,\n bike_id INTEGER,\n subscription_type TEXT,\n zip_code INTEGER);\nCREATE TABLE weather (\n date TEXT,\n max_temperature_f INTEGER,\n mean_temperature_f INTEGER,\n min_temperature_f INTEGER,\n max_dew_point_f INTEGER,\n mean_dew_point_f INTEGER,\n min_dew_point_f INTEGER,\n max_humidity INTEGER,\n mean_humidity INTEGER,\n min_humidity INTEGER,\n max_sea_level_pressure_inches NUMERIC,\n mean_sea_level_pressure_inches NUMERIC,\n min_sea_level_pressure_inches NUMERIC,\n max_visibility_miles INTEGER,\n mean_visibility_miles INTEGER,\n min_visibility_miles INTEGER,\n max_wind_Speed_mph INTEGER,\n mean_wind_speed_mph INTEGER,\n max_gust_speed_mph INTEGER,\n precipitation_inches INTEGER,\n cloud_cover INTEGER,\n events TEXT,\n wind_dir_degrees INTEGER,\n zip_code INTEGER);"} {"qid": "pool_0499", "split": "pool", "db_id": "entertainment_awards", "question": "What are the names and locations of festivals?", "gold_sql": "SELECT Festival_Name , LOCATION FROM festival_detail", "db_path": "databases/entertainment_awards/entertainment_awards.sqlite", "schema": "CREATE TABLE artwork (\n\"Artwork_ID\" int,\n\"Type\" text,\n\"Name\" text,\nPRIMARY KEY (\"Artwork_ID\")\n);\nCREATE TABLE \"festival_detail\" (\n\"Festival_ID\" int,\n\"Festival_Name\" text,\n\"Chair_Name\" text,\n\"Location\" text,\n\"Year\" int,\n\"Num_of_Audience\" int,\nPRIMARY KEY (\"Festival_ID\")\n);\nCREATE TABLE nomination (\n\"Artwork_ID\" int,\n\"Festival_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Artwork_ID\",\"Festival_ID\"),\nFOREIGN KEY (\"Artwork_ID\") REFERENCES `artwork`(\"Artwork_ID\"),\nFOREIGN KEY (\"Festival_ID\") REFERENCES `festival_detail`(\"Festival_ID\")\n);"} {"qid": "pool_0500", "split": "pool", "db_id": "restaurant_1", "question": "List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.", "gold_sql": "SELECT Fname , Lname FROM Student WHERE Age > 18 AND Major != 600 AND Sex = 'F';", "db_path": "databases/restaurant_1/restaurant_1.sqlite", "schema": "CREATE TABLE Restaurant (\n ResID INTEGER PRIMARY KEY,\n ResName VARCHAR(100),\n Address VARCHAR(100),\n Rating INTEGER\n);\nCREATE TABLE Restaurant_Type (\n ResTypeID INTEGER PRIMARY KEY,\n ResTypeName VARCHAR(40),\n ResTypeDescription VARCHAR(100)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Type_Of_Restaurant (\n ResID INTEGER,\n ResTypeID INTEGER,\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),\n FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)\n);\nCREATE TABLE Visits_Restaurant (\n StuID INTEGER,\n ResID INTEGER,\n Time TIMESTAMP,\n Spent FLOAT,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)\n);"} {"qid": "pool_0501", "split": "pool", "db_id": "store_1", "question": "List the name of tracks belongs to genre Rock or media type is MPEG audio file.", "gold_sql": "SELECT T2.name FROM genres AS T1 JOIN tracks AS T2 ON T1.id = T2.genre_id JOIN media_types AS T3 ON T3.id = T2.media_type_id WHERE T1.name = \"Rock\" OR T3.name = \"MPEG audio file\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0502", "split": "pool", "db_id": "swimming", "question": "List countries that have more than one swimmer.", "gold_sql": "SELECT nationality , count(*) FROM swimmer GROUP BY nationality HAVING count(*) > 1", "db_path": "databases/swimming/swimming.sqlite", "schema": "CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);\nCREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);\nCREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);\nCREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);"} {"qid": "pool_0503", "split": "pool", "db_id": "apartment_rentals", "question": "Show the distinct apartment numbers of the apartments that have bookings with status code \"Confirmed\".", "gold_sql": "SELECT DISTINCT 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\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0504", "split": "pool", "db_id": "music_4", "question": "What are the date of ceremony of music festivals with category \"Best Song\" and result \"Awarded\"?", "gold_sql": "SELECT Date_of_ceremony FROM music_festival WHERE Category = \"Best Song\" AND RESULT = \"Awarded\"", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0505", "split": "pool", "db_id": "match_season", "question": "How many players played each position?", "gold_sql": "SELECT POSITION , COUNT(*) FROM match_season GROUP BY POSITION", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0506", "split": "pool", "db_id": "dorm_1", "question": "What is the code of the city with the most students?", "gold_sql": "SELECT city_code FROM student GROUP BY city_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/dorm_1/dorm_1.sqlite", "schema": "CREATE TABLE Dorm (\n dormid\t\tINTEGER,\n dorm_name\tVARCHAR(20),\n student_capacity\tINTEGER,\n gender\t\t\tVARCHAR(1)\n);\nCREATE TABLE Dorm_amenity (\n amenid\t\t\tINTEGER,\n amenity_name\t\tVARCHAR(25)\n);\nCREATE TABLE Has_amenity (\n dormid\t\t\tINTEGER,\n amenid\t\t\t\tINTEGER,\n\tFOREIGN KEY (dormid) REFERENCES `Dorm`(dormid),\n\tFOREIGN KEY (amenid) REFERENCES `Dorm_amenity`(amenid)\n);\nCREATE TABLE Lives_in (\n stuid \t INTEGER,\n dormid\t\tINTEGER,\n room_number\tINTEGER,\n\tFOREIGN KEY (stuid) REFERENCES `Student`(StuID),\n FOREIGN KEY (dormid) REFERENCES `Dorm`(dormid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0507", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "What is the code of each role and the number of employees in each role?", "gold_sql": "SELECT role_code , count(*) FROM Employees GROUP BY role_code", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0508", "split": "pool", "db_id": "icfp_1", "question": "Count the number of authors.", "gold_sql": "SELECT count(*) FROM authors", "db_path": "databases/icfp_1/icfp_1.sqlite", "schema": "CREATE TABLE Authors (\n authID INTEGER,\n lname TEXT,\n fname TEXT,\n PRIMARY KEY (authID)\n);\nCREATE TABLE Authorship (\n authID INTEGER,\n instID INTEGER,\n paperID INTEGER,\n authOrder INTEGER,\n PRIMARY KEY (authID, instID, paperID),\n FOREIGN KEY (authID) REFERENCES Authors (authID),\n FOREIGN KEY (instID) REFERENCES Inst (instID),\n FOREIGN KEY (paperID) REFERENCES Papers (paperID)\n);\nCREATE TABLE Inst (\n instID INTEGER,\n name TEXT,\n country TEXT, -- the home country of the institution (this is obviously an impoverished model)\n PRIMARY KEY (instID)\n);\nCREATE TABLE Papers (\n paperID INTEGER,\n title TEXT,\n PRIMARY KEY (paperID)\n);"} {"qid": "pool_0509", "split": "pool", "db_id": "epinions_1", "question": "Find the highest rank of all reviews.", "gold_sql": "SELECT min(rank) FROM review", "db_path": "databases/epinions_1/epinions_1.sqlite", "schema": "CREATE TABLE `item` (\n `i_id` integer NOT NULL\n, `title` varchar(20) DEFAULT NULL\n, PRIMARY KEY (`i_id`)\n);\nCREATE TABLE `review` (\n `a_id` integer NOT NULL PRIMARY KEY\n, `u_id` integer NOT NULL\n, `i_id` integer NOT NULL\n, `rating` integer DEFAULT NULL\n, `rank` integer DEFAULT NULL\n, \tFOREIGN KEY (`u_id`) REFERENCES `useracct`(`u_id`)\n, \tFOREIGN KEY (`i_id`) REFERENCES `item`(`i_id`)\n);\nCREATE TABLE \"trust\" (`source_u_id` integer NOT NULL, `target_u_id` integer NOT NULL, `trust` integer NOT NULL, FOREIGN KEY (`source_u_id`) REFERENCES `useracct`(`u_id`), FOREIGN KEY (`target_u_id`) REFERENCES `useracct`(`u_id`));\nCREATE TABLE `useracct` (\n `u_id` integer NOT NULL\n, `name` varchar(128) DEFAULT NULL\n, PRIMARY KEY (`u_id`)\n);"} {"qid": "pool_0510", "split": "pool", "db_id": "match_season", "question": "Count the number of different colleges that players who play for Columbus Crew are from.", "gold_sql": "SELECT count(DISTINCT T1.College) FROM match_season AS T1 JOIN team AS T2 ON T1.Team = T2.Team_id WHERE T2.Name = \"Columbus Crew\"", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0511", "split": "pool", "db_id": "insurance_and_eClaims", "question": "Find the names of customers whose name contains \"Diana\".", "gold_sql": "SELECT customer_details FROM customers WHERE customer_details LIKE \"%Diana%\"", "db_path": "databases/insurance_and_eClaims/insurance_and_eClaims.sqlite", "schema": "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);\nCREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);"} {"qid": "pool_0512", "split": "pool", "db_id": "movie_1", "question": "What is the reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then finally rating?", "gold_sql": "SELECT T3.name , T2.title , T1.stars , T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name , T2.title , T1.stars", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0513", "split": "pool", "db_id": "department_store", "question": "What are the names and ids of products costing between 600 and 700?", "gold_sql": "SELECT product_name , product_id FROM products WHERE product_price BETWEEN 600 AND 700", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0514", "split": "pool", "db_id": "apartment_rentals", "question": "Show the start dates and end dates of all the apartment bookings made by guests with gender code \"Female\".", "gold_sql": "SELECT T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = \"Female\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0515", "split": "pool", "db_id": "cre_Theme_park", "question": "What are the names of the tourist attractions that can be accessed by bus?", "gold_sql": "SELECT Name FROM TOURIST_ATTRACTIONS WHERE How_to_Get_There = \"bus\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0516", "split": "pool", "db_id": "shop_membership", "question": "List all open years when at least two shops are opened.", "gold_sql": "SELECT open_year FROM branch GROUP BY open_year HAVING count(*) >= 2", "db_path": "databases/shop_membership/shop_membership.sqlite", "schema": "CREATE TABLE \"branch\" (\n\"Branch_ID\" int,\n\"Name\" text,\n\"Open_year\" text,\n\"Address_road\" text,\n\"City\" text,\n\"membership_amount\" text,\nPRIMARY KEY (\"Branch_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Card_Number\" text,\n\"Name\" text,\n\"Hometown\" text,\n\"Level\" int,\nPRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"membership_register_branch\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Register_Year\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);\nCREATE TABLE \"purchase\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Year\" text,\n\"Total_pounds\" real,\nPRIMARY KEY (\"Member_ID\",\"Branch_ID\",\"Year\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);"} {"qid": "pool_0517", "split": "pool", "db_id": "college_2", "question": "How many different instructors have taught some course?", "gold_sql": "SELECT COUNT (DISTINCT id) FROM teaches", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0518", "split": "pool", "db_id": "chinook_1", "question": "Find the maximum and minimum millisecond lengths of pop tracks.", "gold_sql": "SELECT max(Milliseconds) , min(Milliseconds) FROM GENRE AS T1 JOIN TRACK AS T2 ON T1.GenreId = T2.GenreId WHERE T1.Name = \"Pop\"", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0519", "split": "pool", "db_id": "college_2", "question": "Find the year and semester when offers the largest number of courses.", "gold_sql": "SELECT semester , YEAR FROM SECTION GROUP BY semester , YEAR ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0520", "split": "pool", "db_id": "driving_school", "question": "What is the zip code of staff with first name as Janessa and last name as Sawayn lived?", "gold_sql": "SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = \"Janessa\" AND T2.last_name = \"Sawayn\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0521", "split": "pool", "db_id": "department_store", "question": "Find the name and gender of the staff who has been assigned the job of Sales Person but never Clerical Staff.", "gold_sql": "SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Sales Person\" EXCEPT SELECT T1.staff_name , T1.staff_gender FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id WHERE T2.job_title_code = \"Clerical Staff\"", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0522", "split": "pool", "db_id": "theme_gallery", "question": "What is the name of the artist who joined latest?", "gold_sql": "SELECT name FROM artist ORDER BY year_join DESC LIMIT 1", "db_path": "databases/theme_gallery/theme_gallery.sqlite", "schema": "CREATE TABLE \"artist\" (\n\"Artist_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Year_Join\" int,\n\"Age\" int,\nPRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"exhibition\" (\n\"Exhibition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Artist_ID\" int,\n\"Ticket_Price\" real,\nPRIMARY KEY (\"Exhibition_ID\"),\nFOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);\nCREATE TABLE \"exhibition_record\" (\n\"Exhibition_ID\" int,\n\"Date\" text,\n\"Attendance\" int,\nPRIMARY KEY (\"Exhibition_ID\",\"Date\"),\nFOREIGN KEY (`Exhibition_ID`) REFERENCES `exhibition`(`Exhibition_ID`)\n);"} {"qid": "pool_0523", "split": "pool", "db_id": "local_govt_mdm", "question": "What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code.", "gold_sql": "SELECT T1.cmi_cross_ref_id , T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING count(*) >= 1", "db_path": "databases/local_govt_mdm/local_govt_mdm.sqlite", "schema": "CREATE TABLE Benefits_Overpayments (\ncouncil_tax_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (council_tax_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);\nCREATE TABLE Business_Rates (\nbusiness_rates_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (business_rates_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);\nCREATE TABLE CMI_Cross_References (\ncmi_cross_ref_id INTEGER NOT NULL,\nmaster_customer_id INTEGER NOT NULL,\nsource_system_code CHAR(15) NOT NULL,\nPRIMARY KEY (cmi_cross_ref_id),\nFOREIGN KEY (master_customer_id) REFERENCES Customer_Master_Index (master_customer_id)\n\n);\nCREATE TABLE Council_Tax (\ncouncil_tax_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (council_tax_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);\nCREATE TABLE Customer_Master_Index (\nmaster_customer_id INTEGER NOT NULL,\ncmi_details VARCHAR(255),\nPRIMARY KEY (master_customer_id)\n);\nCREATE TABLE Electoral_Register (\nelectoral_register_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (electoral_register_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);\nCREATE TABLE Parking_Fines (\ncouncil_tax_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (council_tax_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);\nCREATE TABLE Rent_Arrears (\ncouncil_tax_id INTEGER NOT NULL,\ncmi_cross_ref_id INTEGER NOT NULL,\nPRIMARY KEY (council_tax_id),\nFOREIGN KEY (cmi_cross_ref_id) REFERENCES CMI_Cross_References (cmi_cross_ref_id)\n);"} {"qid": "pool_0524", "split": "pool", "db_id": "movie_1", "question": "Find the names of all reviewers who rated Gone with the Wind.", "gold_sql": "SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0525", "split": "pool", "db_id": "roller_coaster", "question": "How many roller coasters are there?", "gold_sql": "SELECT count(*) FROM roller_coaster", "db_path": "databases/roller_coaster/roller_coaster.sqlite", "schema": "CREATE TABLE \"country\" (\n\"Country_ID\" int,\n\"Name\" text,\n\"Population\" int,\n\"Area\" int,\n\"Languages\" text,\nPRIMARY KEY (\"Country_ID\")\n);\nCREATE TABLE \"roller_coaster\" (\n\"Roller_Coaster_ID\" int,\n\"Name\" text,\n\"Park\" text,\n\"Country_ID\" int,\n\"Length\" real,\n\"Height\" real,\n\"Speed\" text,\n\"Opened\" text,\n\"Status\" text,\nPRIMARY KEY (\"Roller_Coaster_ID\"),\nFOREIGN KEY (\"Country_ID\") REFERENCES `country`(\"Country_ID\")\n);"} {"qid": "pool_0526", "split": "pool", "db_id": "tracking_grants_for_research", "question": "What are the distinct grant amount for the grants where the documents were sent before '1986-08-26 20:49:27' and grant were ended after '1989-03-16 18:27:16'?", "gold_sql": "SELECT T1.grant_amount FROM Grants AS T1 JOIN Documents AS T2 ON T1.grant_id = T2.grant_id WHERE T2.sent_date < '1986-08-26 20:49:27' INTERSECT SELECT grant_amount FROM grants WHERE grant_end_date > '1989-03-16 18:27:16'", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0527", "split": "pool", "db_id": "election", "question": "For each delegate, find the names of the party they are part of.", "gold_sql": "SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0528", "split": "pool", "db_id": "customers_campaigns_ecommerce", "question": "What are the distinct address type codes for all customer addresses?", "gold_sql": "SELECT DISTINCT address_type_code FROM customer_addresses", "db_path": "databases/customers_campaigns_ecommerce/customers_campaigns_ecommerce.sqlite", "schema": "CREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`premise_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`premise_id` ) REFERENCES `Premises`(`premise_id` )\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(15) NOT NULL,\n`shipping_method_code` VARCHAR(15) NOT NULL,\n`order_placed_datetime` DATETIME NOT NULL,\n`order_delivered_datetime` DATETIME,\n`order_shipping_charges` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method` VARCHAR(15) NOT NULL,\n`customer_name` VARCHAR(80),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_login` VARCHAR(80),\n`customer_password` VARCHAR(10)\n);\nCREATE TABLE `Mailshot_Campaigns` (\n`mailshot_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15),\n`mailshot_name` VARCHAR(80),\n`mailshot_start_date` DATETIME,\n`mailshot_end_date` DATETIME\n);\nCREATE TABLE `Mailshot_Customers` (\n`mailshot_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(15) NOT NULL,\n`mailshot_customer_date` DATETIME,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` ),\nFOREIGN KEY (`mailshot_id` ) REFERENCES `Mailshot_Campaigns`(`mailshot_id` )\n);\nCREATE TABLE `Order_Items` (\n`item_id` INTEGER NOT NULL ,\n`order_item_status_code` VARCHAR(15) NOT NULL,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`item_status_code` VARCHAR(15),\n`item_delivered_datetime` DATETIME,\n`item_order_quantity` VARCHAR(80),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` )\n);\nCREATE TABLE `Premises` (\n`premise_id` INTEGER PRIMARY KEY,\n`premises_type` VARCHAR(15) NOT NULL,\n`premise_details` VARCHAR(255)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_category` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80)\n);"} {"qid": "pool_0529", "split": "pool", "db_id": "shop_membership", "question": "What are the names of the members and branches at which they are registered sorted by year of registration?", "gold_sql": "SELECT T3.name , T2.name FROM membership_register_branch AS T1 JOIN branch AS T2 ON T1.branch_id = T2.branch_id JOIN member AS T3 ON T1.member_id = T3.member_id ORDER BY T1.register_year", "db_path": "databases/shop_membership/shop_membership.sqlite", "schema": "CREATE TABLE \"branch\" (\n\"Branch_ID\" int,\n\"Name\" text,\n\"Open_year\" text,\n\"Address_road\" text,\n\"City\" text,\n\"membership_amount\" text,\nPRIMARY KEY (\"Branch_ID\")\n);\nCREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Card_Number\" text,\n\"Name\" text,\n\"Hometown\" text,\n\"Level\" int,\nPRIMARY KEY (\"Member_ID\")\n);\nCREATE TABLE \"membership_register_branch\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Register_Year\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);\nCREATE TABLE \"purchase\" (\n\"Member_ID\" int,\n\"Branch_ID\" text,\n\"Year\" text,\n\"Total_pounds\" real,\nPRIMARY KEY (\"Member_ID\",\"Branch_ID\",\"Year\"),\nFOREIGN KEY (\"Member_ID\") REFERENCES \"member\"(\"Member_ID\"),\nFOREIGN KEY (\"Branch_ID\") REFERENCES \"branch\"(\"Branch_ID\")\n);"} {"qid": "pool_0530", "split": "pool", "db_id": "department_store", "question": "How many customers use each payment method?", "gold_sql": "SELECT payment_method_code , count(*) FROM customers GROUP BY payment_method_code", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0531", "split": "pool", "db_id": "college_2", "question": "Find the title of the course that is offered by more than one department.", "gold_sql": "SELECT title FROM course GROUP BY title HAVING count(*) > 1", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0532", "split": "pool", "db_id": "apartment_rentals", "question": "What are the guest first name, start date, and end date of each apartment booking?", "gold_sql": "SELECT T2.guest_first_name , T1.booking_start_date , T1.booking_start_date FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0533", "split": "pool", "db_id": "college_2", "question": "What is the name of the department with an instructure who has a name like 'Soisalon'?", "gold_sql": "SELECT dept_name FROM instructor WHERE name LIKE '%Soisalon%'", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0534", "split": "pool", "db_id": "csu_1", "question": "How many campuses exist are in the county of LA?", "gold_sql": "SELECT count(*) FROM campuses WHERE county = \"Los Angeles\"", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0535", "split": "pool", "db_id": "e_learning", "question": "Find the subject ID, name of subject and the corresponding number of courses for each subject, and sort by the course count in ascending order.", "gold_sql": "SELECT T1.subject_id , T2.subject_name , COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY COUNT(*) ASC", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0536", "split": "pool", "db_id": "ship_mission", "question": "Show the distinct fate of missions that involve ships with nationality \"United States\"", "gold_sql": "SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = \"United States\"", "db_path": "databases/ship_mission/ship_mission.sqlite", "schema": "CREATE TABLE \"mission\" (\n\"Mission_ID\" int,\n\"Ship_ID\" int,\n\"Code\" text,\n\"Launched_Year\" int,\n\"Location\" text,\n\"Speed_knots\" int,\n\"Fate\" text,\nPRIMARY KEY (\"Mission_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES `ship`(\"Ship_ID\")\n);\nCREATE TABLE \"ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Nationality\" text,\n\"Tonnage\" int,\nPRIMARY KEY (\"Ship_ID\")\n);"} {"qid": "pool_0537", "split": "pool", "db_id": "gymnast", "question": "What is the average age of all gymnasts?", "gold_sql": "SELECT avg(T2.Age) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID", "db_path": "databases/gymnast/gymnast.sqlite", "schema": "CREATE TABLE \"gymnast\" (\n\"Gymnast_ID\" int,\n\"Floor_Exercise_Points\" real,\n\"Pommel_Horse_Points\" real,\n\"Rings_Points\" real,\n\"Vault_Points\" real,\n\"Parallel_Bars_Points\" real,\n\"Horizontal_Bar_Points\" real,\n\"Total_Points\" real,\nPRIMARY KEY (\"Gymnast_ID\"),\nFOREIGN KEY (\"Gymnast_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Age\" real,\n\"Height\" real,\n\"Hometown\" text,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0538", "split": "pool", "db_id": "workshop_paper", "question": "Show each author and the number of workshops they submitted to.", "gold_sql": "SELECT T2.Author , COUNT(DISTINCT T1.workshop_id) FROM acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID GROUP BY T2.Author", "db_path": "databases/workshop_paper/workshop_paper.sqlite", "schema": "CREATE TABLE \"Acceptance\" (\n\"Submission_ID\" int,\n\"Workshop_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Submission_ID\",\"Workshop_ID\"),\nFOREIGN KEY (\"Submission_ID\") REFERENCES `submission`(\"Submission_ID\"),\nFOREIGN KEY (\"Workshop_ID\") REFERENCES `workshop`(\"Workshop_ID\")\n);\nCREATE TABLE \"submission\" (\n\"Submission_ID\" int,\n\"Scores\" real,\n\"Author\" text,\n\"College\" text,\nPRIMARY KEY (\"Submission_ID\")\n);\nCREATE TABLE \"workshop\" (\n\"Workshop_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Name\" text,\nPRIMARY KEY (\"Workshop_ID\")\n);"} {"qid": "pool_0539", "split": "pool", "db_id": "movie_1", "question": "What is the total number of ratings that has more than 3 stars?", "gold_sql": "SELECT count(*) FROM Rating WHERE stars > 3", "db_path": "databases/movie_1/movie_1.sqlite", "schema": "CREATE TABLE Movie(\n\tmID int primary key, \n\ttitle text, \n\tyear int, \n\tdirector text\n);\nCREATE TABLE Rating(\n\trID int, \n\tmID int, \n\tstars int, \n\tratingDate date,\n\tFOREIGN KEY (mID) references Movie(mID),\n\tFOREIGN KEY (rID) references Reviewer(rID)\n);\nCREATE TABLE Reviewer(\n\trID int primary key, \n\tname text);"} {"qid": "pool_0540", "split": "pool", "db_id": "products_gen_characteristics", "question": "Give the color description for the product 'catnip'.", "gold_sql": "SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = \"catnip\"", "db_path": "databases/products_gen_characteristics/products_gen_characteristics.sqlite", "schema": "CREATE TABLE `Characteristics` (\n`characteristic_id` INTEGER PRIMARY KEY,\n`characteristic_type_code` VARCHAR(15) NOT NULL,\n`characteristic_data_type` VARCHAR(10),\n`characteristic_name` VARCHAR(80),\n`other_characteristic_details` VARCHAR(255),\nFOREIGN KEY (`characteristic_type_code` ) REFERENCES `Ref_Characteristic_Types`(`characteristic_type_code` )\n);\nCREATE TABLE `Product_Characteristics` (\n`product_id` INTEGER NOT NULL,\n`characteristic_id` INTEGER NOT NULL,\n`product_characteristic_value` VARCHAR(50),\nFOREIGN KEY (`characteristic_id` ) REFERENCES `Characteristics`(`characteristic_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`color_code` VARCHAR(15) NOT NULL,\n`product_category_code` VARCHAR(15) NOT NULL,\n`product_name` VARCHAR(80),\n`typical_buying_price` VARCHAR(20),\n`typical_selling_price` VARCHAR(20),\n`product_description` VARCHAR(255),\n`other_product_details` VARCHAR(255),\nFOREIGN KEY (`product_category_code` ) REFERENCES `Ref_Product_Categories`(`product_category_code` ),FOREIGN KEY (`color_code` ) REFERENCES `Ref_Colors`(`color_code` )\n);\nCREATE TABLE `Ref_Characteristic_Types` (\n`characteristic_type_code` VARCHAR(15) PRIMARY KEY,\n`characteristic_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Colors` (\n`color_code` VARCHAR(15) PRIMARY KEY,\n`color_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Product_Categories` (\n`product_category_code` VARCHAR(15) PRIMARY KEY,\n`product_category_description` VARCHAR(80),\n`unit_of_measure` VARCHAR(20)\n);"} {"qid": "pool_0541", "split": "pool", "db_id": "cre_Doc_Tracking_DB", "question": "List the names of the employees who authorized the destruction of documents and the employees who destroyed the corresponding documents.", "gold_sql": "SELECT T2.employee_name , T3.employee_name FROM Documents_to_be_destroyed AS T1 JOIN Employees AS T2 ON T1.Destruction_Authorised_by_Employee_ID = T2.employee_id JOIN Employees AS T3 ON T1.Destroyed_by_Employee_ID = T3.employee_id;", "db_path": "databases/cre_Doc_Tracking_DB/cre_Doc_Tracking_DB.sqlite", "schema": "CREATE TABLE All_Documents (\nDocument_ID INTEGER NOT NULL,\nDate_Stored DATETIME,\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Name CHAR(255),\nDocument_Description CHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)\n);\nCREATE TABLE Document_Locations (\nDocument_ID INTEGER NOT NULL,\nLocation_Code CHAR(15) NOT NULL,\nDate_in_Location_From DATETIME NOT NULL,\nDate_in_Locaton_To DATETIME,\nPRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),\nFOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),\nFOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Documents_to_be_Destroyed (\nDocument_ID INTEGER NOT NULL,\nDestruction_Authorised_by_Employee_ID INTEGER,\nDestroyed_by_Employee_ID INTEGER,\nPlanned_Destruction_Date DATETIME,\nActual_Destruction_Date DATETIME,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),\nFOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),\nFOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)\n);\nCREATE TABLE Employees (\nEmployee_ID INTEGER NOT NULL,\nRole_Code CHAR(15) NOT NULL,\nEmployee_Name VARCHAR(255),\nGender_MFU CHAR(1) NOT NULL,\nDate_of_Birth DATETIME NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Employee_ID),\nFOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)\n);\nCREATE TABLE Ref_Calendar (\nCalendar_Date DATETIME NOT NULL,\nDay_Number INTEGER,\nPRIMARY KEY (Calendar_Date)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Ref_Locations (\nLocation_Code CHAR(15) NOT NULL,\nLocation_Name VARCHAR(255) NOT NULL,\nLocation_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Location_Code)\n);\nCREATE TABLE Roles (\nRole_Code CHAR(15) NOT NULL,\nRole_Name VARCHAR(255),\nRole_Description VARCHAR(255),\nPRIMARY KEY (Role_Code)\n);"} {"qid": "pool_0542", "split": "pool", "db_id": "election", "question": "What are the maximum and minimum population of the counties?", "gold_sql": "SELECT max(Population) , min(Population) FROM county", "db_path": "databases/election/election.sqlite", "schema": "CREATE TABLE \"county\" (\n\"County_Id\" int,\n\"County_name\" text,\n\"Population\" real,\n\"Zip_code\" text,\nPRIMARY KEY (\"County_Id\")\n);\nCREATE TABLE \"election\" (\n\"Election_ID\" int,\n\"Counties_Represented\" text,\n\"District\" int,\n\"Delegate\" text,\n\"Party\" int,\n\"First_Elected\" real,\n\"Committee\" text,\nPRIMARY KEY (\"Election_ID\"),\nFOREIGN KEY (`Party`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`District`) REFERENCES `county`(`County_Id`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Year\" real,\n\"Party\" text,\n\"Governor\" text,\n\"Lieutenant_Governor\" text,\n\"Comptroller\" text,\n\"Attorney_General\" text,\n\"US_Senate\" text,\nPRIMARY KEY (\"Party_ID\")\n);"} {"qid": "pool_0543", "split": "pool", "db_id": "college_2", "question": "Find the name of department has the highest amount of students?", "gold_sql": "SELECT dept_name FROM student GROUP BY dept_name ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0544", "split": "pool", "db_id": "flight_1", "question": "What is the id and name of the employee with the highest salary?", "gold_sql": "SELECT eid , name FROM Employee ORDER BY salary DESC LIMIT 1", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"} {"qid": "pool_0545", "split": "pool", "db_id": "flight_company", "question": "What is the velocity of the pilot named 'Thompson'?", "gold_sql": "SELECT avg(velocity) FROM flight WHERE pilot = 'Thompson'", "db_path": "databases/flight_company/flight_company.sqlite", "schema": "CREATE TABLE \"airport\" (\n\"id\" int,\n\"City\" text,\n\"Country\" text,\n\"IATA\" text,\n\"ICAO\" text,\n\"name\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"flight\" (\n\"id\" int,\n\"Vehicle_Flight_number\" text,\n\"Date\" text,\n\"Pilot\" text,\n\"Velocity\" real,\n\"Altitude\" real,\n\"airport_id\" int,\n\"company_id\" int,\nprimary key (\"id\"),\nforeign key (\"airport_id\") references `airport`(\"id\"),\nforeign key (\"company_id\") references `operate_company`(\"id\")\n);\nCREATE TABLE \"operate_company\" (\n\"id\" int,\n\"name\" text,\n\"Type\" text,\n\"Principal_activities\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0546", "split": "pool", "db_id": "device", "question": "List the open date of open year of the shop named \"Apple\".", "gold_sql": "SELECT Open_Date , Open_Year FROM shop WHERE Shop_Name = \"Apple\"", "db_path": "databases/device/device.sqlite", "schema": "CREATE TABLE \"device\" (\n\"Device_ID\" int,\n\"Device\" text,\n\"Carrier\" text,\n\"Package_Version\" text,\n\"Applications\" text,\n\"Software_Platform\" text,\nPRIMARY KEY (\"Device_ID\")\n);\nCREATE TABLE \"shop\" (\n\"Shop_ID\" int,\n\"Shop_Name\" text,\n\"Location\" text,\n\"Open_Date\" text,\n\"Open_Year\" int,\nPRIMARY KEY (\"Shop_ID\")\n);\nCREATE TABLE \"stock\" (\n\"Shop_ID\" int,\n\"Device_ID\" int,\n\"Quantity\" int,\nPRIMARY KEY (\"Shop_ID\",\"Device_ID\"),\nFOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`),\nFOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`)\n);"} {"qid": "pool_0547", "split": "pool", "db_id": "music_4", "question": "Return the categories of music festivals that have the result \"Awarded\".", "gold_sql": "SELECT Category FROM music_festival WHERE RESULT = \"Awarded\"", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0548", "split": "pool", "db_id": "college_3", "question": "Count the number of courses with more than 2 credits.", "gold_sql": "SELECT count(*) FROM COURSE WHERE Credits > 2", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0549", "split": "pool", "db_id": "company_employee", "question": "Show the names of employees that work for companies with sales bigger than 200.", "gold_sql": "SELECT 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 WHERE T3.Sales_in_Billion > 200", "db_path": "databases/company_employee/company_employee.sqlite", "schema": "CREATE TABLE \"company\" (\n \"Company_ID\" real,\n \"Name\" text,\n \"Headquarters\" text,\n \"Industry\" text,\n \"Sales_in_Billion\" real,\n \"Profits_in_Billion\" real,\n \"Assets_in_Billion\" real,\n \"Market_Value_in_Billion\" real,\n PRIMARY KEY (\"Company_ID\")\n);\nCREATE TABLE \"employment\" (\n \"Company_ID\" int,\n \"People_ID\" int,\n \"Year_working\" int,\n PRIMARY KEY (\"Company_ID\",\"People_ID\"),\n FOREIGN KEY (\"Company_ID\") REFERENCES `company`(\"Company_ID\"),\n FOREIGN KEY (\"People_ID\") REFERENCES `people`(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n \"People_ID\" int,\n \"Age\" int,\n \"Name\" text,\n \"Nationality\" text,\n \"Graduation_College\" text,\n PRIMARY KEY (\"People_ID\")\n);"} {"qid": "pool_0550", "split": "pool", "db_id": "scientist_1", "question": "What is the sum of hours for projects that scientists with the name Michael Rogers or Carol Smith are assigned to?", "gold_sql": "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'", "db_path": "databases/scientist_1/scientist_1.sqlite", "schema": "CREATE TABLE AssignedTo (\n Scientist int not null,\n Project char(4) not null,\n Primary Key (Scientist, Project),\n Foreign Key (Scientist) references Scientists (SSN),\n Foreign Key (Project) references Projects (Code)\n);\nCREATE TABLE Projects (\n Code Char(4),\n Name Char(50) not null,\n Hours int,\n Primary Key (Code)\n);\nCREATE TABLE Scientists (\n SSN int,\n Name Char(30) not null,\n Primary Key (SSN)\n);"} {"qid": "pool_0551", "split": "pool", "db_id": "game_injury", "question": "How many different kinds of information sources are there for injury accidents?", "gold_sql": "SELECT count(DISTINCT SOURCE) FROM injury_accident", "db_path": "databases/game_injury/game_injury.sqlite", "schema": "CREATE TABLE \"game\" (\n\"stadium_id\" int,\n\"id\" int,\n\"Season\" int,\n\"Date\" text,\n\"Home_team\" text,\n\"Away_team\" text,\n\"Score\" text,\n\"Competition\" text,\nprimary key (\"id\"),\nforeign key (\"stadium_id\") references `stadium`(\"id\")\n);\nCREATE TABLE \"injury_accident\" (\n\"game_id\" int,\n\"id\" int,\n\"Player\" text,\n\"Injury\" text,\n\"Number_of_matches\" text,\n\"Source\" text,\nprimary key (\"id\"),\nforeign key (\"game_id\") references `game`(\"id\")\n);\nCREATE TABLE \"stadium\" (\n\"id\" int,\n\"name\" text,\n\"Home_Games\" int,\n\"Average_Attendance\" real,\n\"Total_Attendance\" real,\n\"Capacity_Percentage\" real,\nprimary key (\"id\")\n);"} {"qid": "pool_0552", "split": "pool", "db_id": "voter_2", "question": "What are the first names and last names of the students who are 18 years old and have vice president votes.", "gold_sql": "SELECT DISTINCT T1.Fname , T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0553", "split": "pool", "db_id": "music_4", "question": "Return the issue dates of volumes that are by the artist named Gorgoroth.", "gold_sql": "SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = \"Gorgoroth\"", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0554", "split": "pool", "db_id": "e_learning", "question": "List all the subject names.", "gold_sql": "SELECT subject_name FROM SUBJECTS", "db_path": "databases/e_learning/e_learning.sqlite", "schema": "CREATE TABLE `Course_Authors_and_Tutors` (\n`author_id` INTEGER PRIMARY KEY,\n`author_tutor_ATB` VARCHAR(3),\n`login_name` VARCHAR(40),\n`password` VARCHAR(40),\n`personal_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`family_name` VARCHAR(80),\n`gender_mf` VARCHAR(1),\n`address_line_1` VARCHAR(80)\n);\nCREATE TABLE `Courses` (\n`course_id` INTEGER PRIMARY KEY,\n`author_id` INTEGER NOT NULL,\n`subject_id` INTEGER NOT NULL,\n`course_name` VARCHAR(120),\n`course_description` VARCHAR(255),\nFOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),\nFOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )\n);\nCREATE TABLE `Student_Course_Enrolment` (\n`registration_id` INTEGER PRIMARY KEY,\n`student_id` INTEGER NOT NULL,\n`course_id` INTEGER NOT NULL,\n`date_of_enrolment` DATETIME NOT NULL,\n`date_of_completion` DATETIME NOT NULL,\nFOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Student_Tests_Taken` (\n`registration_id` INTEGER NOT NULL,\n`date_test_taken` DATETIME NOT NULL,\n`test_result` VARCHAR(255),\nFOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`date_of_registration` DATETIME,\n`date_of_latest_logon` DATETIME,\n`login_name` VARCHAR(40),\n`password` VARCHAR(10),\n`personal_name` VARCHAR(40),\n`middle_name` VARCHAR(40),\n`family_name` VARCHAR(40)\n);\nCREATE TABLE `Subjects` (\n`subject_id` INTEGER PRIMARY KEY,\n`subject_name` VARCHAR(120)\n);"} {"qid": "pool_0555", "split": "pool", "db_id": "cre_Theme_park", "question": "Show the names and ids of tourist attractions that are visited at least two times.", "gold_sql": "SELECT T1.Name , T2.Tourist_Attraction_ID FROM Tourist_Attractions AS T1 JOIN VISITS AS T2 ON T1.Tourist_Attraction_ID = T2.Tourist_Attraction_ID GROUP BY T2.Tourist_Attraction_ID HAVING count(*) >= 2", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0556", "split": "pool", "db_id": "voter_2", "question": "What are the distinct registration dates and the election cycles?", "gold_sql": "SELECT DISTINCT Registration_Date , Election_Cycle FROM VOTING_RECORD", "db_path": "databases/voter_2/voter_2.sqlite", "schema": "CREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Voting_record (\n StuID \tINTEGER,\n Registration_Date\t\tVARCHAR(12),\n Election_Cycle\t\tVARCHAR(12),\n President_Vote\t\tINTEGER,\n Vice_President_Vote\t\tINTEGER,\n Secretary_Vote\t\tINTEGER,\n Treasurer_Vote\t\tINTEGER,\n Class_President_Vote\t\tINTEGER,\n Class_Senator_Vote\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID), \n FOREIGN KEY(President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Vice_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Secretary_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Treasurer_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_President_Vote) REFERENCES Student(StuID),\n FOREIGN KEY(Class_Senator_Vote) REFERENCES Student(StuID)\n);"} {"qid": "pool_0557", "split": "pool", "db_id": "cre_Drama_Workshop_Groups", "question": "What are the names of the clients who do not have any booking?", "gold_sql": "SELECT Customer_Name FROM Clients EXCEPT SELECT T2.Customer_Name FROM Bookings AS T1 JOIN Clients AS T2 ON T1.Customer_ID = T2.Client_ID", "db_path": "databases/cre_Drama_Workshop_Groups/cre_Drama_Workshop_Groups.sqlite", "schema": "CREATE TABLE Addresses (\nAddress_ID VARCHAR(100) NOT NULL,\nLine_1 VARCHAR(255),\nLine_2 VARCHAR(255),\nCity_Town VARCHAR(255),\nState_County VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Address_ID),\nUNIQUE (Address_ID)\n);\nCREATE TABLE Bookings (\nBooking_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nWorkshop_Group_ID VARCHAR(100) NOT NULL,\nStatus_Code CHAR(15) NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Booking_ID),\nUNIQUE (Booking_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID)\n);\nCREATE TABLE Bookings_Services (\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Product_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (Product_ID) REFERENCES Services (Service_ID)\n);\nCREATE TABLE Clients (\nClient_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Email_Address VARCHAR(255),\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Client_ID),\nUNIQUE (Client_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Customer_Orders (\nOrder_ID INTEGER NOT NULL ,\nCustomer_ID INTEGER NOT NULL,\nStore_ID INTEGER NOT NULL,\nOrder_Date DATETIME NOT NULL,\nPlanned_Delivery_Date DATETIME NOT NULL,\nActual_Delivery_Date DATETIME NOT NULL,\nOther_Order_Details VARCHAR(255),\nPRIMARY KEY (Order_ID),\nUNIQUE (Order_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Customer_ID),\nUNIQUE (Customer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Drama_Workshop_Groups (\nWorkshop_Group_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCurrency_Code CHAR(15) NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Workshop_Group_ID),\nUNIQUE (Workshop_Group_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Invoice_Items (\nInvoice_Item_ID INTEGER NOT NULL ,\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\nOrder_Item_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity INTEGER,\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Invoice_Item_ID),\nFOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID),\nFOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID),\nFOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID)\n);\nCREATE TABLE Invoices (\nInvoice_ID INTEGER NOT NULL,\nOrder_ID INTEGER NOT NULL,\npayment_method_code CHAR(15),\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nOrder_Item_ID INTEGER NOT NULL,\nPRIMARY KEY (Invoice_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID),\nFOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code)\n);\nCREATE TABLE Marketing_Regions (\nMarketing_Region_Code CHAR(15) NOT NULL,\nMarketing_Region_Name VARCHAR(255) NOT NULL,\nMarketing_Region_Descriptrion VARCHAR(255) NOT NULL,\nOther_Details VARCHAR(255),\nPRIMARY KEY (Marketing_Region_Code),\nUNIQUE (Marketing_Region_Code)\n);\nCREATE TABLE Order_Items (\nOrder_Item_ID INTEGER NOT NULL ,\nOrder_ID INTEGER NOT NULL,\nProduct_ID INTEGER NOT NULL,\nOrder_Quantity VARCHAR(288),\nOther_Item_Details VARCHAR(255),\nPRIMARY KEY (Order_Item_ID),\nFOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID),\nFOREIGN KEY (Product_ID) REFERENCES Products (Product_ID)\n);\nCREATE TABLE Performers (\nPerformer_ID INTEGER NOT NULL,\nAddress_ID INTEGER NOT NULL,\nCustomer_Name VARCHAR(255),\nCustomer_Phone VARCHAR(255),\nCustomer_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Performer_ID),\nUNIQUE (Performer_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID)\n);\nCREATE TABLE Performers_in_Bookings (\nOrder_ID INTEGER NOT NULL,\nPerformer_ID INTEGER NOT NULL,\nPRIMARY KEY (Order_ID, Performer_ID),\nFOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID),\nFOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID)\n);\nCREATE TABLE Products (\nProduct_ID VARCHAR(100) NOT NULL,\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nProduct_Description VARCHAR(255),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Product_ID),\nUNIQUE (Product_ID)\n);\nCREATE TABLE Ref_Payment_Methods (\npayment_method_code CHAR(10) NOT NULL,\npayment_method_description VARCHAR(80),\nPRIMARY KEY (payment_method_code),\nUNIQUE (payment_method_code)\n);\nCREATE TABLE Ref_Service_Types (\nService_Type_Code CHAR(15) NOT NULL,\nParent_Service_Type_Code CHAR(15),\nService_Type_Description VARCHAR(255),\nPRIMARY KEY (Service_Type_Code),\nUNIQUE (Service_Type_Code)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_Type_Code CHAR(15),\nWorkshop_Group_ID INTEGER NOT NULL,\nProduct_Description VARCHAR(255),\nProduct_Name VARCHAR(255),\nProduct_Price DECIMAL(20,4),\nOther_Product_Service_Details VARCHAR(255),\nPRIMARY KEY (Service_ID),\nUNIQUE (Service_ID),\nFOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID),\nFOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code)\n);\nCREATE TABLE Stores (\nStore_ID VARCHAR(100) NOT NULL,\nAddress_ID INTEGER NOT NULL,\nMarketing_Region_Code CHAR(15) NOT NULL,\nStore_Name VARCHAR(255),\nStore_Phone VARCHAR(255),\nStore_Email_Address VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Store_ID),\nUNIQUE (Store_ID),\nFOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID),\nFOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code)\n);"} {"qid": "pool_0558", "split": "pool", "db_id": "customers_and_invoices", "question": "How many different products correspond to each order id?", "gold_sql": "SELECT order_id , count(DISTINCT product_id) FROM Order_items GROUP BY order_id", "db_path": "databases/customers_and_invoices/customers_and_invoices.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_account_opened` DATETIME,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(50),\n`customer_middle_initial` VARCHAR(1),\n`customer_last_name` VARCHAR(50),\n`gender` VARCHAR(1),\n`email_address` VARCHAR(255),\n`login_name` VARCHAR(80),\n`login_password` VARCHAR(20),\n`phone_number` VARCHAR(255),\n`town_city` VARCHAR(50),\n`state_county_province` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`account_id` INTEGER NOT NULL,\n`invoice_number` INTEGER,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DECIMAL(19,4),\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);\nCREATE TABLE `Invoice_Line_Items` (\n`order_item_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_title` VARCHAR(80),\n`product_quantity` VARCHAR(50),\n`product_price` DECIMAL(19,4),\n`derived_product_cost` DECIMAL(19,4),\n`derived_vat_payable` DECIMAL(19,4),\n`derived_total_cost` DECIMAL(19,4),\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_date` DATETIME,\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`product_quantity` VARCHAR(50),\n`other_order_item_details` VARCHAR(255),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Product_Categories` (\n`production_type_code` VARCHAR(15) PRIMARY KEY,\n`product_type_description` VARCHAR(80),\n`vat_rating` DECIMAL(19,4)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`production_type_code` VARCHAR(15) NOT NULL,\n`unit_price` DECIMAL(19,4),\n`product_name` VARCHAR(80),\n`product_color` VARCHAR(20),\n`product_size` VARCHAR(20),\nFOREIGN KEY (`production_type_code` ) REFERENCES `Product_Categories`(`production_type_code` )\n);"} {"qid": "pool_0559", "split": "pool", "db_id": "chinook_1", "question": "Find the maximum and minimum durations of tracks in milliseconds.", "gold_sql": "SELECT max(Milliseconds) , min(Milliseconds) FROM TRACK", "db_path": "databases/chinook_1/chinook_1.sqlite", "schema": "CREATE TABLE `Album` (\n `AlbumId` integer NOT NULL\n, `Title` varchar(160) NOT NULL\n, `ArtistId` integer NOT NULL\n, PRIMARY KEY (`AlbumId`)\n, CONSTRAINT `FK_AlbumArtistId` FOREIGN KEY (`ArtistId`) REFERENCES `Artist` (`ArtistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Artist` (\n `ArtistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`ArtistId`)\n);\nCREATE TABLE `Customer` (\n `CustomerId` integer NOT NULL\n, `FirstName` varchar(40) NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `Company` varchar(80) DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) NOT NULL\n, `SupportRepId` integer DEFAULT NULL\n, PRIMARY KEY (`CustomerId`)\n, CONSTRAINT `FK_CustomerSupportRepId` FOREIGN KEY (`SupportRepId`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Employee` (\n `EmployeeId` integer NOT NULL\n, `LastName` varchar(20) NOT NULL\n, `FirstName` varchar(20) NOT NULL\n, `Title` varchar(30) DEFAULT NULL\n, `ReportsTo` integer DEFAULT NULL\n, `BirthDate` datetime DEFAULT NULL\n, `HireDate` datetime DEFAULT NULL\n, `Address` varchar(70) DEFAULT NULL\n, `City` varchar(40) DEFAULT NULL\n, `State` varchar(40) DEFAULT NULL\n, `Country` varchar(40) DEFAULT NULL\n, `PostalCode` varchar(10) DEFAULT NULL\n, `Phone` varchar(24) DEFAULT NULL\n, `Fax` varchar(24) DEFAULT NULL\n, `Email` varchar(60) DEFAULT NULL\n, PRIMARY KEY (`EmployeeId`)\n, CONSTRAINT `FK_EmployeeReportsTo` FOREIGN KEY (`ReportsTo`) REFERENCES `Employee` (`EmployeeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Genre` (\n `GenreId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`GenreId`)\n);\nCREATE TABLE `Invoice` (\n `InvoiceId` integer NOT NULL\n, `CustomerId` integer NOT NULL\n, `InvoiceDate` datetime NOT NULL\n, `BillingAddress` varchar(70) DEFAULT NULL\n, `BillingCity` varchar(40) DEFAULT NULL\n, `BillingState` varchar(40) DEFAULT NULL\n, `BillingCountry` varchar(40) DEFAULT NULL\n, `BillingPostalCode` varchar(10) DEFAULT NULL\n, `Total` decimal(10,2) NOT NULL\n, PRIMARY KEY (`InvoiceId`)\n, CONSTRAINT `FK_InvoiceCustomerId` FOREIGN KEY (`CustomerId`) REFERENCES `Customer` (`CustomerId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `InvoiceLine` (\n `InvoiceLineId` integer NOT NULL\n, `InvoiceId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, `Quantity` integer NOT NULL\n, PRIMARY KEY (`InvoiceLineId`)\n, CONSTRAINT `FK_InvoiceLineInvoiceId` FOREIGN KEY (`InvoiceId`) REFERENCES `Invoice` (`InvoiceId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_InvoiceLineTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `MediaType` (\n `MediaTypeId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`MediaTypeId`)\n);\nCREATE TABLE `Playlist` (\n `PlaylistId` integer NOT NULL\n, `Name` varchar(120) DEFAULT NULL\n, PRIMARY KEY (`PlaylistId`)\n);\nCREATE TABLE `PlaylistTrack` (\n `PlaylistId` integer NOT NULL\n, `TrackId` integer NOT NULL\n, PRIMARY KEY (`PlaylistId`,`TrackId`)\n, CONSTRAINT `FK_PlaylistTrackPlaylistId` FOREIGN KEY (`PlaylistId`) REFERENCES `Playlist` (`PlaylistId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_PlaylistTrackTrackId` FOREIGN KEY (`TrackId`) REFERENCES `Track` (`TrackId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE `Track` (\n `TrackId` integer NOT NULL\n, `Name` varchar(200) NOT NULL\n, `AlbumId` integer DEFAULT NULL\n, `MediaTypeId` integer NOT NULL\n, `GenreId` integer DEFAULT NULL\n, `Composer` varchar(220) DEFAULT NULL\n, `Milliseconds` integer NOT NULL\n, `Bytes` integer DEFAULT NULL\n, `UnitPrice` decimal(10,2) NOT NULL\n, PRIMARY KEY (`TrackId`)\n, CONSTRAINT `FK_TrackAlbumId` FOREIGN KEY (`AlbumId`) REFERENCES `Album` (`AlbumId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackGenreId` FOREIGN KEY (`GenreId`) REFERENCES `Genre` (`GenreId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n, CONSTRAINT `FK_TrackMediaTypeId` FOREIGN KEY (`MediaTypeId`) REFERENCES `MediaType` (`MediaTypeId`) ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0560", "split": "pool", "db_id": "architecture", "question": "show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.", "gold_sql": "SELECT t1.name FROM bridge AS t1 JOIN architect AS t2 ON t1.architect_id = t2.id WHERE t2.nationality = 'American' ORDER BY t1.length_feet", "db_path": "databases/architecture/architecture.sqlite", "schema": "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);\nCREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);\nCREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);"} {"qid": "pool_0561", "split": "pool", "db_id": "wrestler", "question": "What are the reigns and days held of all wrestlers?", "gold_sql": "SELECT Reign , Days_held FROM wrestler", "db_path": "databases/wrestler/wrestler.sqlite", "schema": "CREATE TABLE \"Elimination\" (\n\"Elimination_ID\" text,\n\"Wrestler_ID\" text,\n\"Team\" text,\n\"Eliminated_By\" text,\n\"Elimination_Move\" text,\n\"Time\" text,\nPRIMARY KEY (\"Elimination_ID\"),\nFOREIGN KEY (\"Wrestler_ID\") REFERENCES \"wrestler\"(\"Wrestler_ID\")\n);\nCREATE TABLE \"wrestler\" (\n\"Wrestler_ID\" int,\n\"Name\" text,\n\"Reign\" text,\n\"Days_held\" text,\n\"Location\" text,\n\"Event\" text,\nPRIMARY KEY (\"Wrestler_ID\")\n);"} {"qid": "pool_0562", "split": "pool", "db_id": "network_2", "question": "How many people are older than every engineer?", "gold_sql": "SELECT count(*) FROM Person WHERE age > (SELECT max(age) FROM person WHERE job = 'engineer')", "db_path": "databases/network_2/network_2.sqlite", "schema": "CREATE TABLE Person (\n name varchar(20) PRIMARY KEY,\n age INTEGER,\n city TEXT,\n gender TEXT,\n job TEXT\n);\nCREATE TABLE PersonFriend (\n name varchar(20),\n friend varchar(20),\n year INTEGER,\n FOREIGN KEY (name) REFERENCES Person(name),\n FOREIGN KEY (friend) REFERENCES Person(name)\n);"} {"qid": "pool_0563", "split": "pool", "db_id": "apartment_rentals", "question": "Show the most common apartment type code.", "gold_sql": "SELECT apt_type_code FROM Apartments GROUP BY apt_type_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0564", "split": "pool", "db_id": "allergy_1", "question": "Which major has most number of students?", "gold_sql": "SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0565", "split": "pool", "db_id": "wine_1", "question": "List the grape, winery and year of the wines whose price is bigger than 100 ordered by year.", "gold_sql": "SELECT Grape , Winery , YEAR FROM WINE WHERE Price > 100 ORDER BY YEAR", "db_path": "databases/wine_1/wine_1.sqlite", "schema": "CREATE TABLE \"appellations\" ( \n\t\"No\" INTEGER PRIMARY KEY, \n\t\"Appelation\" TEXT UNIQUE, \n\t\"County\" TEXT, \n\t\"State\" TEXT, \n\t\"Area\" TEXT, \n\t\"isAVA\" TEXT\n);\nCREATE TABLE \"grapes\" ( \n\t\"ID\" INTEGER PRIMARY KEY, \n\t\"Grape\" TEXT UNIQUE, \n\t\"Color\" TEXT \n);\nCREATE TABLE \"wine\" ( \n\t\"No\" INTEGER, \n\t\"Grape\" TEXT, \n\t\"Winery\" TEXT, \n\t\"Appelation\" TEXT, \n\t\"State\" TEXT, \n\t\"Name\" TEXT, \n\t\"Year\" INTEGER, \n\t\"Price\" INTEGER, \n\t\"Score\" INTEGER, \n\t\"Cases\" INTEGER, \n\t\"Drink\" TEXT,\n\tFOREIGN KEY (Grape) REFERENCES grapes(Grape),\n\tFOREIGN KEY (Appelation) REFERENCES appellations(Appelation)\n);"} {"qid": "pool_0566", "split": "pool", "db_id": "driving_school", "question": "How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn?", "gold_sql": "SELECT sum(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = \"Janessa\" AND T2.last_name = \"Sawayn\";", "db_path": "databases/driving_school/driving_school.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Customer_Payments` (\n`customer_id` INTEGER NOT NULL,\n`datetime_payment` DATETIME NOT NULL,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`amount_payment` DOUBLE NULL,\nPRIMARY KEY (`customer_id`,`datetime_payment`),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_address_id` INTEGER NOT NULL,\n`customer_status_code` VARCHAR(15) NOT NULL,\n`date_became_customer` DATETIME,\n`date_of_birth` DATETIME,\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`amount_outstanding` DOUBLE NULL,\n`email_address` VARCHAR(250),\n`phone_number` VARCHAR(255),\n`cell_mobile_phone_number` VARCHAR(255),\nFOREIGN KEY (`customer_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Lessons` (\n`lesson_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`lesson_status_code` VARCHAR(15) NOT NULL,\n`staff_id` INTEGER,\n`vehicle_id` INTEGER NOT NULL,\n`lesson_date` DATETIME,\n`lesson_time` VARCHAR(10),\n`price` DOUBLE NULL,\nFOREIGN KEY (`vehicle_id` ) REFERENCES `Vehicles`(`vehicle_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_address_id` INTEGER NOT NULL,\n`nickname` VARCHAR(80),\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`date_of_birth` DATETIME,\n`date_joined_staff` DATETIME,\n`date_left_staff` DATETIME,\nFOREIGN KEY (`staff_address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Vehicles` (\n`vehicle_id` INTEGER PRIMARY KEY,\n`vehicle_details` VARCHAR(255)\n);"} {"qid": "pool_0567", "split": "pool", "db_id": "match_season", "question": "What are the official languages of the countries of players from Maryland or Duke college?", "gold_sql": "SELECT T1.Official_native_language FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.College = \"Maryland\" OR T2.College = \"Duke\"", "db_path": "databases/match_season/match_season.sqlite", "schema": "CREATE TABLE \"country\" (\n \"Country_id\" int,\n \"Country_name\" text,\n \"Capital\" text,\n \"Official_native_language\" text,\n PRIMARY KEY (\"Country_id\")\n);\nCREATE TABLE \"match_season\" (\n \"Season\" real,\n \"Player\" text,\n \"Position\" text,\n \"Country\" int,\n \"Team\" int,\n \"Draft_Pick_Number\" int,\n \"Draft_Class\" text,\n \"College\" text,\n PRIMARY KEY (\"Season\"),\n FOREIGN KEY (`Country`) REFERENCES `country`(`Country_id`),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE \"player\" (\n \"Player_ID\" int,\n \"Player\" text,\n \"Years_Played\" text,\n \"Total_WL\" text,\n \"Singles_WL\" text,\n \"Doubles_WL\" text,\n \"Team\" int,\n PRIMARY KEY (\"Player_ID\"),\n FOREIGN KEY (`Team`) REFERENCES `team`(`Team_id`)\n);\nCREATE TABLE `team` (\n `Team_id` int,\n `Name` text,\n PRIMARY KEY (`Team_id`)\n);"} {"qid": "pool_0568", "split": "pool", "db_id": "college_2", "question": "Which department has the highest average instructor salary?", "gold_sql": "SELECT dept_name FROM instructor GROUP BY dept_name ORDER BY avg(salary) DESC LIMIT 1", "db_path": "databases/college_2/college_2.sqlite", "schema": "CREATE TABLE advisor\n\t(s_ID\t\t\tvarchar(5),\n\t i_ID\t\t\tvarchar(5),\n\t primary key (s_ID),\n\t foreign key (i_ID) references instructor (ID)\n\t\ton delete set null,\n\t foreign key (s_ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE classroom\n\t(building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t capacity\t\tnumeric(4,0),\n\t primary key (building, room_number)\n\t);\nCREATE TABLE course\n\t(course_id\t\tvarchar(8),\n\t title\t\t\tvarchar(50),\n\t dept_name\t\tvarchar(20) NULL,\n\t credits\t\tnumeric(2,0) check (credits > 0),\n\t primary key (course_id),\n FOREIGN KEY (dept_name)\n REFERENCES `department` (dept_name)\n ON DELETE SET NULL\n-- ON UPDATE NO ACTION\n-- foreign key (dept_name) references department\n-- on delete set null\n );\nCREATE TABLE department\n\t(dept_name\t\tvarchar(20),\n\t building\t\tvarchar(15),\n\t budget\t\t numeric(12,2) check (budget > 0),\n\t primary key (dept_name)\n\t);\nCREATE TABLE instructor\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t salary\t\t\tnumeric(8,2) check (salary > 29000),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE prereq\n\t(course_id\t\tvarchar(8),\n\t prereq_id\t\tvarchar(8),\n\t primary key (course_id, prereq_id),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (prereq_id) references course (course_id)\n\t);\nCREATE TABLE section\n\t(course_id\t\tvarchar(8),\n sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6)\n\t\tcheck (semester in ('Fall', 'Winter', 'Spring', 'Summer')),\n\t year\t\t\tnumeric(4,0) check (year > 1701 and year < 2100),\n\t building\t\tvarchar(15),\n\t room_number\t\tvarchar(7),\n\t time_slot_id\t\tvarchar(4),\n\t primary key (course_id, sec_id, semester, year),\n\t foreign key (course_id) references course (course_id)\n\t\ton delete cascade,\n\t foreign key (building, room_number) references classroom (building, room_number)\n\t\ton delete set null\n\t);\nCREATE TABLE student\n\t(ID\t\t\tvarchar(5),\n\t name\t\t\tvarchar(20) not null,\n\t dept_name\t\tvarchar(20),\n\t tot_cred\t\tnumeric(3,0) check (tot_cred >= 0),\n\t primary key (ID),\n\t foreign key (dept_name) references department (dept_name)\n\t\ton delete set null\n\t);\nCREATE TABLE takes\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t grade\t\t varchar(2),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references student (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE teaches\n\t(ID\t\t\tvarchar(5),\n\t course_id\t\tvarchar(8),\n\t sec_id\t\t\tvarchar(8),\n\t semester\t\tvarchar(6),\n\t year\t\t\tnumeric(4,0),\n\t primary key (ID, course_id, sec_id, semester, year),\n\t foreign key (course_id,sec_id, semester, year) references section (course_id, sec_id, semester, year)\n\t\ton delete cascade,\n\t foreign key (ID) references instructor (ID)\n\t\ton delete cascade\n\t);\nCREATE TABLE time_slot\n\t(time_slot_id\t\tvarchar(4),\n\t day\t\t\tvarchar(1),\n\t start_hr\t\tnumeric(2) check (start_hr >= 0 and start_hr < 24),\n\t start_min\t\tnumeric(2) check (start_min >= 0 and start_min < 60),\n\t end_hr\t\t\tnumeric(2) check (end_hr >= 0 and end_hr < 24),\n\t end_min\t\tnumeric(2) check (end_min >= 0 and end_min < 60),\n\t primary key (time_slot_id, day, start_hr, start_min)\n\t);"} {"qid": "pool_0569", "split": "pool", "db_id": "department_store", "question": "What are the distinct names and phone numbers for suppliers who have red jeans?", "gold_sql": "SELECT DISTINCT T1.supplier_name , T1.supplier_phone FROM suppliers AS T1 JOIN product_suppliers AS T2 ON T1.supplier_id = T2.supplier_id JOIN products AS T3 ON T2.product_id = T3.product_id WHERE T3.product_name = \"red jeans\"", "db_path": "databases/department_store/department_store.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`customer_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status_code` VARCHAR(10) NOT NULL,\n`order_date` DATETIME NOT NULL,\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(10) NOT NULL,\n`customer_code` VARCHAR(20),\n`customer_name` VARCHAR(80),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(80),\n`customer_email` VARCHAR(80)\n);\nCREATE TABLE `Department_Store_Chain` (\n`dept_store_chain_id` INTEGER PRIMARY KEY,\n`dept_store_chain_name` VARCHAR(80)\n);\nCREATE TABLE `Department_Stores` (\n`dept_store_id` INTEGER PRIMARY KEY,\n`dept_store_chain_id` INTEGER,\n`store_name` VARCHAR(80),\n`store_address` VARCHAR(255),\n`store_phone` VARCHAR(80),\n`store_email` VARCHAR(80),\nFOREIGN KEY (`dept_store_chain_id` ) REFERENCES `Department_Store_Chain`(`dept_store_chain_id` )\n);\nCREATE TABLE `Departments` (\n`department_id` INTEGER PRIMARY KEY,\n`dept_store_id` INTEGER NOT NULL,\n`department_name` VARCHAR(80),\nFOREIGN KEY (`dept_store_id` ) REFERENCES `Department_Stores`(`dept_store_id` )\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_id` ) REFERENCES `Customer_Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Product_Suppliers` (\n`product_id` INTEGER NOT NULL,\n`supplier_id` INTEGER NOT NULL,\n`date_supplied_from` DATETIME NOT NULL,\n`date_supplied_to` DATETIME,\n`total_amount_purchased` VARCHAR(80),\n`total_value_purchased` DECIMAL(19,4),\nPRIMARY KEY (`product_id`, `supplier_id`),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_type_code` VARCHAR(10) NOT NULL,\n`product_name` VARCHAR(80),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`staff_gender` VARCHAR(1),\n`staff_name` VARCHAR(80)\n);\nCREATE TABLE `Staff_Department_Assignments` (\n`staff_id` INTEGER NOT NULL,\n`department_id` INTEGER NOT NULL,\n`date_assigned_from` DATETIME NOT NULL,\n`job_title_code` VARCHAR(10) NOT NULL,\n`date_assigned_to` DATETIME,\nPRIMARY KEY (`staff_id`, `department_id`),\nFOREIGN KEY (`department_id` ) REFERENCES `Departments`(`department_id` ),\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` )\n);\nCREATE TABLE `Supplier_Addresses` (\n`supplier_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_from` DATETIME NOT NULL,\n`date_to` DATETIME,\nPRIMARY KEY (`supplier_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`supplier_id` ) REFERENCES `Suppliers`(`supplier_id` )\n);\nCREATE TABLE `Suppliers` (\n`supplier_id` INTEGER PRIMARY KEY,\n`supplier_name` VARCHAR(80),\n`supplier_phone` VARCHAR(80)\n);"} {"qid": "pool_0570", "split": "pool", "db_id": "flight_4", "question": "What is the number of routes that end at John F Kennedy International Airport?", "gold_sql": "SELECT count(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport'", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0571", "split": "pool", "db_id": "allergy_1", "question": "How old are the students with allergies to food and animal types on average?", "gold_sql": "SELECT avg(age) FROM Student WHERE StuID IN ( SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"food\" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = \"animal\")", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0572", "split": "pool", "db_id": "program_share", "question": "Find the name of the program that is broadcast most frequently.", "gold_sql": "SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/program_share/program_share.sqlite", "schema": "CREATE TABLE \"broadcast\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Time_of_day\" text,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"broadcast_share\" (\n\"Channel_ID\" int,\n\"Program_ID\" int,\n\"Date\" text,\n\"Share_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\",\"Program_ID\"),\nFOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),\nFOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)\n);\nCREATE TABLE \"channel\" (\n\"Channel_ID\" int,\n\"Name\" text,\n\"Owner\" text,\n\"Share_in_percent\" real,\n\"Rating_in_percent\" real,\nPRIMARY KEY (\"Channel_ID\")\n);\nCREATE TABLE \"program\" (\n\"Program_ID\" int,\n\"Name\" text,\n\"Origin\" text,\n\"Launch\" real,\n\"Owner\" text,\nPRIMARY KEY (\"Program_ID\")\n);"} {"qid": "pool_0573", "split": "pool", "db_id": "hospital_1", "question": "Which physician was trained in the procedure that costs the most.", "gold_sql": "SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0574", "split": "pool", "db_id": "e_government", "question": "What are the first, middle, and last names of all individuals, ordered by last name?", "gold_sql": "SELECT individual_first_name , individual_middle_name , individual_last_name FROM individuals ORDER BY individual_last_name", "db_path": "databases/e_government/e_government.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1_number_building` VARCHAR(80),\n`town_city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50)\n);\nCREATE TABLE `Forms` (\n`form_id` INTEGER PRIMARY KEY,\n`form_type_code` VARCHAR(15) NOT NULL,\n`service_id` INTEGER,\n`form_number` VARCHAR(50),\n`form_name` VARCHAR(80),\n`form_description` VARCHAR(255),\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` )\n);\nCREATE TABLE `Individuals` (\n`individual_id` INTEGER PRIMARY KEY,\n`individual_first_name` VARCHAR(80),\n`individual_middle_name` VARCHAR(80),\n`inidividual_phone` VARCHAR(80),\n`individual_email` VARCHAR(80),\n`individual_address` VARCHAR(255),\n`individual_last_name` VARCHAR(80)\n);\nCREATE TABLE `Organization_Contact_Individuals` (\n`individual_id` INTEGER NOT NULL,\n`organization_id` INTEGER NOT NULL,\n`date_contact_from` DATETIME NOT NULL,\n`date_contact_to` DATETIME,\nPRIMARY KEY (`individual_id`,`organization_id` ),\nFOREIGN KEY (`organization_id` ) REFERENCES `Organizations`(`organization_id` ),\nFOREIGN KEY (`individual_id` ) REFERENCES `Individuals`(`individual_id` )\n);\nCREATE TABLE `Organizations` (\n`organization_id` INTEGER PRIMARY KEY,\n`date_formed` DATETIME,\n`organization_name` VARCHAR(255),\n`uk_vat_number` VARCHAR(20)\n);\nCREATE TABLE `Parties` (\n`party_id` INTEGER PRIMARY KEY,\n`payment_method_code` VARCHAR(15) NOT NULL,\n`party_phone` VARCHAR(80),\n`party_email` VARCHAR(80)\n);\nCREATE TABLE `Party_Addresses` (\n`party_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type_code` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nPRIMARY KEY (`party_id`, `address_id`),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Party_Forms` (\n`party_id` INTEGER NOT NULL,\n`form_id` INTEGER NOT NULL,\n`date_completion_started` DATETIME NOT NULL,\n`form_status_code` VARCHAR(15) NOT NULL,\n`date_fully_completed` DATETIME,\nPRIMARY KEY (`party_id`, `form_id`),\nFOREIGN KEY (`party_id` ) REFERENCES `Parties`(`party_id` ),\nFOREIGN KEY (`form_id` ) REFERENCES `Forms`(`form_id` )\n);\nCREATE TABLE `Party_Services` (\n`booking_id` INTEGER NOT NULL ,\n`customer_id` INTEGER NOT NULL,\n`service_id` INTEGER NOT NULL,\n`service_datetime` DATETIME NOT NULL,\n`booking_made_date` DATETIME,\nFOREIGN KEY (`service_id` ) REFERENCES `Services`(`service_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Parties`(`party_id` )\n);\nCREATE TABLE `Services` (\n`service_id` INTEGER PRIMARY KEY,\n`service_type_code` VARCHAR(15) NOT NULL,\n`service_name` VARCHAR(80),\n`service_descriptio` VARCHAR(255)\n);"} {"qid": "pool_0575", "split": "pool", "db_id": "apartment_rentals", "question": "What is the minimum and maximum number of bathrooms of all the apartments?", "gold_sql": "SELECT min(bathroom_count) , max(bathroom_count) FROM Apartments", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0576", "split": "pool", "db_id": "hospital_1", "question": "List the physicians' employee ids together with their primary affiliation departments' ids.", "gold_sql": "SELECT physician , department FROM affiliated_with WHERE primaryaffiliation = 1", "db_path": "databases/hospital_1/hospital_1.sqlite", "schema": "CREATE TABLE Affiliated_With (\n Physician INTEGER NOT NULL,\n Department INTEGER NOT NULL,\n PrimaryAffiliation BOOLEAN NOT NULL,\n CONSTRAINT fk_Affiliated_With_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Affiliated_With_Department_DepartmentID FOREIGN KEY(Department) REFERENCES Department(DepartmentID),\n PRIMARY KEY(Physician, Department)\n);\nCREATE TABLE Appointment (\n AppointmentID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL, \n PrepNurse INTEGER,\n Physician INTEGER NOT NULL,\n Start DATETIME NOT NULL,\n End DATETIME NOT NULL,\n ExaminationRoom TEXT NOT NULL,\n CONSTRAINT fk_Appointment_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Appointment_Nurse_EmployeeID FOREIGN KEY(PrepNurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_Appointment_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Block (\n BlockFloor INTEGER NOT NULL,\n BlockCode INTEGER NOT NULL,\n PRIMARY KEY(BlockFloor, BlockCode)\n);\nCREATE TABLE Department (\n DepartmentID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Head INTEGER NOT NULL,\n CONSTRAINT pk_Department PRIMARY KEY(DepartmentID),\n CONSTRAINT fk_Department_Physician_EmployeeID FOREIGN KEY(Head) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Medication (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Brand VARCHAR(30) NOT NULL,\n Description VARCHAR(30) NOT NULL\n);\nCREATE TABLE Nurse (\n EmployeeID INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n Registered BOOLEAN NOT NULL,\n SSN INTEGER NOT NULL\n);\nCREATE TABLE On_Call (\n Nurse INTEGER NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL,\n OnCallStart DATETIME NOT NULL,\n OnCallEnd DATETIME NOT NULL,\n PRIMARY KEY(Nurse, BlockFloor, BlockCode, OnCallStart, OnCallEnd),\n CONSTRAINT fk_OnCall_Nurse_EmployeeID FOREIGN KEY(Nurse) REFERENCES Nurse(EmployeeID),\n CONSTRAINT fk_OnCall_Block_Floor FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode) \n);\nCREATE TABLE Patient (\n SSN INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Address VARCHAR(30) NOT NULL,\n Phone VARCHAR(30) NOT NULL,\n InsuranceID INTEGER NOT NULL,\n PCP INTEGER NOT NULL,\n CONSTRAINT fk_Patient_Physician_EmployeeID FOREIGN KEY(PCP) REFERENCES Physician(EmployeeID)\n);\nCREATE TABLE Physician (\n EmployeeID INTEGER NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Position VARCHAR(30) NOT NULL,\n SSN INTEGER NOT NULL,\n CONSTRAINT pk_physician PRIMARY KEY(EmployeeID)\n);\nCREATE TABLE Prescribes (\n Physician INTEGER NOT NULL,\n Patient INTEGER NOT NULL, \n Medication INTEGER NOT NULL, \n Date DATETIME NOT NULL,\n Appointment INTEGER, \n Dose VARCHAR(30) NOT NULL,\n PRIMARY KEY(Physician, Patient, Medication, Date),\n CONSTRAINT fk_Prescribes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Prescribes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Prescribes_Medication_Code FOREIGN KEY(Medication) REFERENCES Medication(Code),\n CONSTRAINT fk_Prescribes_Appointment_AppointmentID FOREIGN KEY(Appointment) REFERENCES Appointment(AppointmentID)\n);\nCREATE TABLE Procedures (\n Code INTEGER PRIMARY KEY NOT NULL,\n Name VARCHAR(30) NOT NULL,\n Cost REAL NOT NULL\n);\nCREATE TABLE Room (\n RoomNumber INTEGER PRIMARY KEY NOT NULL,\n RoomType VARCHAR(30) NOT NULL,\n BlockFloor INTEGER NOT NULL, \n BlockCode INTEGER NOT NULL, \n Unavailable BOOLEAN NOT NULL,\n CONSTRAINT fk_Room_Block_PK FOREIGN KEY(BlockFloor, BlockCode) REFERENCES Block(BlockFloor, BlockCode)\n);\nCREATE TABLE Stay (\n StayID INTEGER PRIMARY KEY NOT NULL,\n Patient INTEGER NOT NULL,\n Room INTEGER NOT NULL,\n StayStart DATETIME NOT NULL,\n StayEnd DATETIME NOT NULL,\n CONSTRAINT fk_Stay_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Stay_Room_Number FOREIGN KEY(Room) REFERENCES Room(RoomNumber)\n);\nCREATE TABLE Trained_In (\n Physician INTEGER NOT NULL,\n Treatment INTEGER NOT NULL,\n CertificationDate DATETIME NOT NULL,\n CertificationExpires DATETIME NOT NULL,\n CONSTRAINT fk_Trained_In_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Trained_In_Procedures_Code FOREIGN KEY(Treatment) REFERENCES Procedures(Code),\n PRIMARY KEY(Physician, Treatment)\n);\nCREATE TABLE Undergoes (\n Patient INTEGER NOT NULL,\n Procedures INTEGER NOT NULL,\n Stay INTEGER NOT NULL,\n DateUndergoes DATETIME NOT NULL,\n Physician INTEGER NOT NULL,\n AssistingNurse INTEGER,\n PRIMARY KEY(Patient, Procedures, Stay, DateUndergoes),\n CONSTRAINT fk_Undergoes_Patient_SSN FOREIGN KEY(Patient) REFERENCES Patient(SSN),\n CONSTRAINT fk_Undergoes_Procedures_Code FOREIGN KEY(Procedures) REFERENCES Procedures(Code),\n CONSTRAINT fk_Undergoes_Stay_StayID FOREIGN KEY(Stay) REFERENCES Stay(StayID),\n CONSTRAINT fk_Undergoes_Physician_EmployeeID FOREIGN KEY(Physician) REFERENCES Physician(EmployeeID),\n CONSTRAINT fk_Undergoes_Nurse_EmployeeID FOREIGN KEY(AssistingNurse) REFERENCES Nurse(EmployeeID)\n);"} {"qid": "pool_0577", "split": "pool", "db_id": "news_report", "question": "Show the different nationalities and the number of journalists of each nationality.", "gold_sql": "SELECT Nationality , COUNT(*) FROM journalist GROUP BY Nationality", "db_path": "databases/news_report/news_report.sqlite", "schema": "CREATE TABLE \"event\" (\n \"Event_ID\" int,\n \"Date\" text,\n \"Venue\" text,\n \"Name\" text,\n \"Event_Attendance\" int,\n PRIMARY KEY (\"Event_ID\")\n);\nCREATE TABLE \"journalist\" (\n \"journalist_ID\" int,\n \"Name\" text,\n \"Nationality\" text,\n \"Age\" text,\n \"Years_working\" int,\n PRIMARY KEY (\"journalist_ID\")\n);\nCREATE TABLE \"news_report\" (\n \"journalist_ID\" int,\n \"Event_ID\" int,\n \"Work_Type\" text,\n PRIMARY KEY (\"journalist_ID\",\"Event_ID\"),\n FOREIGN KEY (\"journalist_ID\") REFERENCES `journalist`(\"journalist_ID\"),\n FOREIGN KEY (\"Event_ID\") REFERENCES `event`(\"Event_ID\")\n);"} {"qid": "pool_0578", "split": "pool", "db_id": "aircraft", "question": "List the names of aircrafts and that won matches at least twice.", "gold_sql": "SELECT T1.Aircraft FROM aircraft AS T1 JOIN MATCH AS T2 ON T1.Aircraft_ID = T2.Winning_Aircraft GROUP BY T2.Winning_Aircraft HAVING COUNT(*) >= 2", "db_path": "databases/aircraft/aircraft.sqlite", "schema": "CREATE TABLE `aircraft` (\n \"Aircraft_ID\" int(11) NOT NULL,\n \"Aircraft\" varchar(50) NOT NULL,\n \"Description\" varchar(50) NOT NULL,\n \"Max_Gross_Weight\" varchar(50) NOT NULL,\n \"Total_disk_area\" varchar(50) NOT NULL,\n \"Max_disk_Loading\" varchar(50) NOT NULL,\n PRIMARY KEY (`Aircraft_ID`)\n);\nCREATE TABLE `airport` (\n\"Airport_ID\" int,\n\"Airport_Name\" text,\n\"Total_Passengers\" real,\n\"%_Change_2007\" text,\n\"International_Passengers\" real,\n\"Domestic_Passengers\" real,\n\"Transit_Passengers\" real,\n\"Aircraft_Movements\" real,\n\"Freight_Metric_Tonnes\" real,\nPRIMARY KEY (\"Airport_ID\")\n);\nCREATE TABLE `airport_aircraft` (\n\"ID\" int,\n\"Airport_ID\" int,\n\"Aircraft_ID\" int,\nPRIMARY KEY (\"Airport_ID\",\"Aircraft_ID\"),\nFOREIGN KEY (\"Airport_ID\") REFERENCES `airport`(`Airport_ID`),\nFOREIGN KEY (\"Aircraft_ID\") REFERENCES `aircraft`(`Aircraft_ID`)\n);\nCREATE TABLE `match` (\n\"Round\" real,\n\"Location\" text,\n\"Country\" text,\n\"Date\" text,\n\"Fastest_Qualifying\" text,\n\"Winning_Pilot\" text,\n\"Winning_Aircraft\" text,\nPRIMARY KEY (\"Round\"),\nFOREIGN KEY (`Winning_Aircraft`) REFERENCES `aircraft`(`Aircraft_ID`),\nFOREIGN KEY (`Winning_Pilot`) REFERENCES `pilot`(`Pilot_Id`)\n);\nCREATE TABLE `pilot` (\n `Pilot_Id` int(11) NOT NULL,\n `Name` varchar(50) NOT NULL,\n `Age` int(11) NOT NULL,\n PRIMARY KEY (`Pilot_Id`)\n);"} {"qid": "pool_0579", "split": "pool", "db_id": "flight_4", "question": "For each airport name, how many routes start at that airport?", "gold_sql": "SELECT count(*) , T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name", "db_path": "databases/flight_4/flight_4.sqlite", "schema": "CREATE TABLE airlines (\n alid integer PRIMARY KEY, -- Id of the airline\n name text, -- Name of the airline\n iata varchar(2), -- 2-letter IATA code. empty or null if not assigned/unknown \n icao varchar(3), -- 3-letter ICAO code. empty or null if not assigned\n callsign text, -- Airline callsign\n country text, -- Country or territory where airline is incorporated\n active varchar(2) -- \"Y\" if the airline is or has until recently been operational,\n);\nCREATE TABLE airports (\n apid integer PRIMARY KEY, -- Id of the airport\n name text NOT NULL, -- Name of airport\n city text, -- Main city served by airport\n country text, -- Country or territory where airport is located\n x real, -- Latitude of airport: Decimal degrees, usually to six\n -- significant digits. Negative is South, positive is North\n y real, -- Longitude of airport: Decimal degrees, usually to six \n -- significant digits. Negative is West, positive is East\n elevation bigint, -- Altitude of airport measured in feets\n iata character varchar(3), -- 3-letter IATA code. empty or null if not assigned/unknown\n icao character varchar(4) -- 4-letter ICAO code. empty or null if not assigned\n \n);\nCREATE TABLE routes (\n rid integer PRIMARY KEY,\n dst_apid integer, -- Id of destination airport\n dst_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the destination airport\n src_apid bigint, -- Id of source airport\n src_ap varchar(4), -- 3-letter (IATA) or 4-letter (ICAO) code of the source airport\n alid bigint, -- Id of airline\n airline varchar(4), -- 2-letter (IATA) or 3-letter (ICAO) code of the airline\n codeshare text, -- \"Y\" if this flight is a codeshare (that is, not operated by \n -- Airline, but another carrier), empty otherwise\n FOREIGN KEY(dst_apid) REFERENCES airports(apid),\n FOREIGN KEY(src_apid) REFERENCES airports(apid),\n FOREIGN KEY(alid) REFERENCES airlines(alid)\n);"} {"qid": "pool_0580", "split": "pool", "db_id": "apartment_rentals", "question": "Which apartment type has the largest number of total rooms? Return the apartment type code, its number of bathrooms and number of bedrooms.", "gold_sql": "SELECT apt_type_code , bathroom_count , bedroom_count FROM Apartments GROUP BY apt_type_code ORDER BY sum(room_count) DESC LIMIT 1", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0581", "split": "pool", "db_id": "activity_1", "question": "Show all the buildings along with the number of faculty members the buildings have.", "gold_sql": "SELECT building , count(*) FROM Faculty GROUP BY building", "db_path": "databases/activity_1/activity_1.sqlite", "schema": "CREATE TABLE Activity (\n actid INTEGER PRIMARY KEY,\n activity_name varchar(25)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Faculty_Participates_in (\n FacID INTEGER,\n actid INTEGER,\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Participates_in (\n stuid INTEGER,\n actid INTEGER,\n FOREIGN KEY(stuid) REFERENCES Student(StuID),\n FOREIGN KEY(actid) REFERENCES Activity(actid)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0582", "split": "pool", "db_id": "apartment_rentals", "question": "Tell me the booking status code for the apartment with number \"Suite 634\".", "gold_sql": "SELECT T1.booking_status_code FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.apt_number = \"Suite 634\"", "db_path": "databases/apartment_rentals/apartment_rentals.sqlite", "schema": "CREATE TABLE Apartment_Bookings (\napt_booking_id INTEGER NOT NULL,\napt_id INTEGER,\nguest_id INTEGER NOT NULL,\nbooking_status_code CHAR(15) NOT NULL,\nbooking_start_date DATETIME,\nbooking_end_date DATETIME,\nPRIMARY KEY (apt_booking_id),\nUNIQUE (apt_booking_id),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (guest_id) REFERENCES Guests (guest_id)\n);\nCREATE TABLE Apartment_Buildings (\nbuilding_id INTEGER NOT NULL,\nbuilding_short_name CHAR(15),\nbuilding_full_name VARCHAR(80),\nbuilding_description VARCHAR(255),\nbuilding_address VARCHAR(255),\nbuilding_manager VARCHAR(50),\nbuilding_phone VARCHAR(80),\nPRIMARY KEY (building_id),\nUNIQUE (building_id)\n);\nCREATE TABLE Apartment_Facilities (\napt_id INTEGER NOT NULL,\nfacility_code CHAR(15) NOT NULL,\nPRIMARY KEY (apt_id, facility_code),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id)\n);\nCREATE TABLE Apartments (\napt_id INTEGER NOT NULL ,\nbuilding_id INTEGER NOT NULL,\napt_type_code CHAR(15),\napt_number CHAR(10),\nbathroom_count INTEGER,\nbedroom_count INTEGER,\nroom_count CHAR(5),\nPRIMARY KEY (apt_id),\nUNIQUE (apt_id),\nFOREIGN KEY (building_id) REFERENCES Apartment_Buildings (building_id)\n);\nCREATE TABLE Guests (\nguest_id INTEGER NOT NULL ,\ngender_code CHAR(1),\nguest_first_name VARCHAR(80),\nguest_last_name VARCHAR(80),\ndate_of_birth DATETIME,\nPRIMARY KEY (guest_id),\nUNIQUE (guest_id)\n);\nCREATE TABLE View_Unit_Status (\napt_id INTEGER,\napt_booking_id INTEGER,\nstatus_date DATETIME NOT NULL,\navailable_yn BIT,\nPRIMARY KEY (status_date),\nFOREIGN KEY (apt_id) REFERENCES Apartments (apt_id),\nFOREIGN KEY (apt_booking_id) REFERENCES Apartment_Bookings (apt_booking_id)\n);"} {"qid": "pool_0583", "split": "pool", "db_id": "allergy_1", "question": "Show the student id of the oldest student.", "gold_sql": "SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)", "db_path": "databases/allergy_1/allergy_1.sqlite", "schema": "CREATE TABLE Allergy_Type (\n Allergy \t\t VARCHAR(20) PRIMARY KEY,\n AllergyType \t VARCHAR(20)\n);\nCREATE TABLE Has_Allergy (\n StuID \t\t INTEGER,\n Allergy \t\t VARCHAR(20),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(Allergy) REFERENCES Allergy_Type(Allergy)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0584", "split": "pool", "db_id": "workshop_paper", "question": "Which college has the most authors with submissions?", "gold_sql": "SELECT College FROM submission GROUP BY College ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/workshop_paper/workshop_paper.sqlite", "schema": "CREATE TABLE \"Acceptance\" (\n\"Submission_ID\" int,\n\"Workshop_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Submission_ID\",\"Workshop_ID\"),\nFOREIGN KEY (\"Submission_ID\") REFERENCES `submission`(\"Submission_ID\"),\nFOREIGN KEY (\"Workshop_ID\") REFERENCES `workshop`(\"Workshop_ID\")\n);\nCREATE TABLE \"submission\" (\n\"Submission_ID\" int,\n\"Scores\" real,\n\"Author\" text,\n\"College\" text,\nPRIMARY KEY (\"Submission_ID\")\n);\nCREATE TABLE \"workshop\" (\n\"Workshop_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Name\" text,\nPRIMARY KEY (\"Workshop_ID\")\n);"} {"qid": "pool_0585", "split": "pool", "db_id": "restaurant_1", "question": "At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.", "gold_sql": "SELECT Restaurant.ResName , sum(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY sum(Visits_Restaurant.Spent) ASC LIMIT 1;", "db_path": "databases/restaurant_1/restaurant_1.sqlite", "schema": "CREATE TABLE Restaurant (\n ResID INTEGER PRIMARY KEY,\n ResName VARCHAR(100),\n Address VARCHAR(100),\n Rating INTEGER\n);\nCREATE TABLE Restaurant_Type (\n ResTypeID INTEGER PRIMARY KEY,\n ResTypeName VARCHAR(40),\n ResTypeDescription VARCHAR(100)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );\nCREATE TABLE Type_Of_Restaurant (\n ResID INTEGER,\n ResTypeID INTEGER,\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID),\n FOREIGN KEY(ResTypeID) REFERENCES Restaurant_Type(ResTypeID)\n);\nCREATE TABLE Visits_Restaurant (\n StuID INTEGER,\n ResID INTEGER,\n Time TIMESTAMP,\n Spent FLOAT,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ResID) REFERENCES Restaurant(ResID)\n);"} {"qid": "pool_0586", "split": "pool", "db_id": "insurance_and_eClaims", "question": "Which customers have an insurance policy with the type code \"Deputy\" or \"Uniform\"? Return the customer details.", "gold_sql": "SELECT DISTINCT t2.customer_details FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t1.policy_type_code = \"Deputy\" OR t1.policy_type_code = \"Uniform\"", "db_path": "databases/insurance_and_eClaims/insurance_and_eClaims.sqlite", "schema": "CREATE TABLE Claim_Headers (\nClaim_Header_ID INTEGER NOT NULL,\nClaim_Status_Code CHAR(15) NOT NULL,\nClaim_Type_Code CHAR(15) NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_of_Claim DATETIME,\nDate_of_Settlement DATETIME,\nAmount_Claimed DECIMAL(20,4),\nAmount_Piad DECIMAL(20,4),\nPRIMARY KEY (Claim_Header_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Policies (Policy_ID)\n);\nCREATE TABLE Claims_Documents (\nClaim_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nCreated_by_Staff_ID INTEGER,\nCreated_Date INTEGER,\nPRIMARY KEY (Claim_ID, Document_Type_Code),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Created_by_Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing (\nClaim_Processing_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nClaim_Outcome_Code CHAR(15) NOT NULL,\nClaim_Stage_ID INTEGER NOT NULL,\nStaff_ID INTEGER,\nPRIMARY KEY (Claim_Processing_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claim_Headers (Claim_Header_ID),\nFOREIGN KEY (Staff_ID) REFERENCES Staff (Staff_ID)\n);\nCREATE TABLE Claims_Processing_Stages (\nClaim_Stage_ID INTEGER NOT NULL,\nNext_Claim_Stage_ID INTEGER,\nClaim_Status_Name VARCHAR(255) NOT NULL,\nClaim_Status_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Claim_Stage_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATETIME,\nEnd_Date DATETIME,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nStaff_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Staff_ID)\n);"} {"qid": "pool_0587", "split": "pool", "db_id": "cre_Theme_park", "question": "What is the detail of the location UK Gallery?", "gold_sql": "SELECT Other_Details FROM LOCATIONS WHERE Location_Name = \"UK Gallery\"", "db_path": "databases/cre_Theme_park/cre_Theme_park.sqlite", "schema": "CREATE TABLE Features (\nFeature_ID INTEGER NOT NULL,\nFeature_Details VARCHAR(255),\nPRIMARY KEY (Feature_ID)\n);\nCREATE TABLE Hotels (\nhotel_id INTEGER NOT NULL,\nstar_rating_code CHAR(15) NOT NULL,\npets_allowed_yn CHAR(1),\nprice_range real,\nother_hotel_details VARCHAR(255),\nPRIMARY KEY (hotel_id),\nFOREIGN KEY (star_rating_code) REFERENCES Ref_Hotel_Star_Ratings (star_rating_code)\n);\nCREATE TABLE Locations (\nLocation_ID INTEGER NOT NULL,\nLocation_Name VARCHAR(255),\nAddress VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Location_ID)\n);\nCREATE TABLE Museums (\nMuseum_ID INTEGER NOT NULL,\nMuseum_Details VARCHAR(255),\nPRIMARY KEY (Museum_ID),\nFOREIGN KEY (Museum_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Photos (\nPhoto_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(255),\nDescription VARCHAR(255),\nFilename VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Photo_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Ref_Attraction_Types (\nAttraction_Type_Code CHAR(15) NOT NULL,\nAttraction_Type_Description VARCHAR(255),\nPRIMARY KEY (Attraction_Type_Code),\nUNIQUE (Attraction_Type_Code)\n);\nCREATE TABLE Ref_Hotel_Star_Ratings (\nstar_rating_code CHAR(15) NOT NULL,\nstar_rating_description VARCHAR(80),\nPRIMARY KEY (star_rating_code),\nUNIQUE (star_rating_code)\n);\nCREATE TABLE Royal_Family (\nRoyal_Family_ID INTEGER NOT NULL,\nRoyal_Family_Details VARCHAR(255),\nPRIMARY KEY (Royal_Family_ID),\nFOREIGN KEY (Royal_Family_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Shops (\nShop_ID INTEGER NOT NULL,\nShop_Details VARCHAR(255),\nPRIMARY KEY (Shop_ID),\nFOREIGN KEY (Shop_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Staff (\nStaff_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nName VARCHAR(40),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Staff_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Street_Markets (\nMarket_ID INTEGER NOT NULL,\nMarket_Details VARCHAR(255),\nPRIMARY KEY (Market_ID),\nFOREIGN KEY (Market_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Theme_Parks (\nTheme_Park_ID INTEGER NOT NULL,\nTheme_Park_Details VARCHAR(255),\nPRIMARY KEY (Theme_Park_ID),\nFOREIGN KEY (Theme_Park_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID)\n);\nCREATE TABLE Tourist_Attraction_Features (\nTourist_Attraction_ID INTEGER NOT NULL,\nFeature_ID INTEGER NOT NULL,\nPRIMARY KEY (Tourist_Attraction_ID, Feature_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Feature_ID) REFERENCES Features (Feature_ID)\n);\nCREATE TABLE Tourist_Attractions (\nTourist_Attraction_ID INTEGER NOT NULL,\nAttraction_Type_Code CHAR(15) NOT NULL,\nLocation_ID INTEGER NOT NULL,\nHow_to_Get_There VARCHAR(255),\nName VARCHAR(255),\nDescription VARCHAR(255),\nOpening_Hours VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Tourist_Attraction_ID),\nFOREIGN KEY (Location_ID) REFERENCES Locations (Location_ID),\nFOREIGN KEY (Attraction_Type_Code) REFERENCES Ref_Attraction_Types (Attraction_Type_Code)\n);\nCREATE TABLE Visitors (\nTourist_ID INTEGER NOT NULL,\nTourist_Details VARCHAR(255),\nPRIMARY KEY (Tourist_ID),\nUNIQUE (Tourist_ID)\n);\nCREATE TABLE Visits (\nVisit_ID INTEGER NOT NULL,\nTourist_Attraction_ID INTEGER NOT NULL,\nTourist_ID INTEGER NOT NULL,\nVisit_Date DATETIME NOT NULL,\nVisit_Details VARCHAR(40) NOT NULL,\nPRIMARY KEY (Visit_ID),\nFOREIGN KEY (Tourist_Attraction_ID) REFERENCES Tourist_Attractions (Tourist_Attraction_ID),\nFOREIGN KEY (Tourist_ID) REFERENCES Visitors (Tourist_ID)\n);"} {"qid": "pool_0588", "split": "pool", "db_id": "workshop_paper", "question": "Which authors with submissions are from college \"Florida\" or \"Temple\"?", "gold_sql": "SELECT Author FROM submission WHERE College = \"Florida\" OR College = \"Temple\"", "db_path": "databases/workshop_paper/workshop_paper.sqlite", "schema": "CREATE TABLE \"Acceptance\" (\n\"Submission_ID\" int,\n\"Workshop_ID\" int,\n\"Result\" text,\nPRIMARY KEY (\"Submission_ID\",\"Workshop_ID\"),\nFOREIGN KEY (\"Submission_ID\") REFERENCES `submission`(\"Submission_ID\"),\nFOREIGN KEY (\"Workshop_ID\") REFERENCES `workshop`(\"Workshop_ID\")\n);\nCREATE TABLE \"submission\" (\n\"Submission_ID\" int,\n\"Scores\" real,\n\"Author\" text,\n\"College\" text,\nPRIMARY KEY (\"Submission_ID\")\n);\nCREATE TABLE \"workshop\" (\n\"Workshop_ID\" int,\n\"Date\" text,\n\"Venue\" text,\n\"Name\" text,\nPRIMARY KEY (\"Workshop_ID\")\n);"} {"qid": "pool_0589", "split": "pool", "db_id": "music_4", "question": "What are the issue dates of volumes associated with the artist \"Gorgoroth\"?", "gold_sql": "SELECT T2.Issue_Date FROM artist AS T1 JOIN volume AS T2 ON T1.Artist_ID = T2.Artist_ID WHERE T1.Artist = \"Gorgoroth\"", "db_path": "databases/music_4/music_4.sqlite", "schema": "CREATE TABLE \"artist\" (\n \"Artist_ID\" int,\n \"Artist\" text,\n \"Age\" int,\n \"Famous_Title\" text,\n \"Famous_Release_date\" text,\n PRIMARY KEY (\"Artist_ID\")\n);\nCREATE TABLE \"music_festival\" (\n \"ID\" int,\n \"Music_Festival\" text,\n \"Date_of_ceremony\" text,\n \"Category\" text,\n \"Volume\" int,\n \"Result\" text,\n PRIMARY KEY (`ID`),\n FOREIGN KEY (`Volume`) REFERENCES `volume`(`Volume_ID`)\n);\nCREATE TABLE \"volume\" (\n \"Volume_ID\" int,\n \"Volume_Issue\" text,\n \"Issue_Date\" text,\n \"Weeks_on_Top\" real,\n \"Song\" text,\n \"Artist_ID\" int,\n PRIMARY KEY (\"Volume_ID\"),\n FOREIGN KEY (`Artist_ID`) REFERENCES `artist`(`Artist_ID`)\n);"} {"qid": "pool_0590", "split": "pool", "db_id": "soccer_2", "question": "What are the names of all the players who received a yes during tryouts, and also what are the names of their colleges?", "gold_sql": "SELECT T1.pName , T2.cName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'", "db_path": "databases/soccer_2/soccer_2.sqlite", "schema": "CREATE TABLE College \n ( cName \tvarchar(20) NOT NULL,\n state \tvarchar(2),\n enr \tnumeric(5,0),\n PRIMARY KEY (cName)\n );\nCREATE TABLE Player\n ( pID\t\t\tnumeric(5,0) NOT NULL,\n \tpName \tvarchar(20),\n yCard \tvarchar(3),\n HS \tnumeric(5,0),\n PRIMARY KEY (pID)\n );\nCREATE TABLE Tryout\n ( pID\t\t\tnumeric(5,0),\n \tcName \tvarchar(20),\n pPos \tvarchar(8),\n decision varchar(3),\n PRIMARY KEY (pID, cName),\n FOREIGN KEY (pID) REFERENCES Player(pID),\n FOREIGN KEY (cName) REFERENCES College(cName)\n );"} {"qid": "pool_0591", "split": "pool", "db_id": "swimming", "question": "Find the name of the swimmer who has at least 2 records.", "gold_sql": "SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id HAVING count(*) >= 2", "db_path": "databases/swimming/swimming.sqlite", "schema": "CREATE TABLE \"event\" (\n\"ID\" int,\n\"Name\" text,\n\"Stadium_ID\" int,\n\"Year\" text,\nPRIMARY KEY (\"ID\"),\nFOREIGN KEY (`Stadium_ID`) REFERENCES `stadium`(`ID`)\n);\nCREATE TABLE \"record\" (\n\"ID\" int,\n\"Result\" text,\n\"Swimmer_ID\" int,\n\"Event_ID\" int,\nPRIMARY KEY (\"Swimmer_ID\",\"Event_ID\"),\nFOREIGN KEY (`Event_ID`) REFERENCES `event`(`ID`),\nFOREIGN KEY (`Swimmer_ID`) REFERENCES `swimmer`(`ID`)\n);\nCREATE TABLE \"stadium\" (\n\"ID\" int,\n\"name\" text,\n\"Capacity\" int,\n\"City\" text,\n\"Country\" text,\n\"Opening_year\" int,\nPRIMARY KEY (\"ID\")\n);\nCREATE TABLE \"swimmer\" (\n\"ID\" int,\n\"name\" text,\n\"Nationality\" text,\n\"meter_100\" real,\n\"meter_200\" text,\n\"meter_300\" text,\n\"meter_400\" text,\n\"meter_500\" text,\n\"meter_600\" text,\n\"meter_700\" text,\n\"Time\" text,\nPRIMARY KEY (\"ID\")\n);"} {"qid": "pool_0592", "split": "pool", "db_id": "college_1", "question": "What is the first name of the student whose last name starts with the letter S and is taking ACCT-211?", "gold_sql": "SELECT T1.stu_fname 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 WHERE T3.crs_code = 'ACCT-211' AND T1.stu_lname LIKE 'S%'", "db_path": "databases/college_1/college_1.sqlite", "schema": "CREATE TABLE CLASS (\nCLASS_CODE varchar(5) PRIMARY KEY,\nCRS_CODE varchar(10),\nCLASS_SECTION varchar(2),\nCLASS_TIME varchar(20),\nCLASS_ROOM varchar(8),\nPROF_NUM int,\nFOREIGN KEY (CRS_CODE) REFERENCES COURSE(CRS_CODE)\nFOREIGN KEY (PROF_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE COURSE (\nCRS_CODE varchar(10) PRIMARY KEY,\nDEPT_CODE varchar(10),\nCRS_DESCRIPTION varchar(35),\nCRS_CREDIT float(8),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE DEPARTMENT (\nDEPT_CODE varchar(10) PRIMARY KEY,\nDEPT_NAME varchar(30),\nSCHOOL_CODE varchar(8),\nEMP_NUM int,\nDEPT_ADDRESS varchar(20),\nDEPT_EXTENSION varchar(4),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM)\n);\nCREATE TABLE EMPLOYEE (\nEMP_NUM int PRIMARY KEY,\nEMP_LNAME varchar(15),\nEMP_FNAME varchar(12),\nEMP_INITIAL varchar(1),\nEMP_JOBCODE varchar(5),\nEMP_HIREDATE datetime,\nEMP_DOB datetime\n);\nCREATE TABLE ENROLL (\nCLASS_CODE varchar(5),\nSTU_NUM int,\nENROLL_GRADE varchar(50),\nFOREIGN KEY (CLASS_CODE) REFERENCES CLASS(CLASS_CODE)\nFOREIGN KEY (STU_NUM) REFERENCES STUDENT(STU_NUM)\n);\nCREATE TABLE PROFESSOR (\nEMP_NUM int,\nDEPT_CODE varchar(10),\nPROF_OFFICE varchar(50),\nPROF_EXTENSION varchar(4),\nPROF_HIGH_DEGREE varchar(5),\nFOREIGN KEY (EMP_NUM) REFERENCES EMPLOYEE(EMP_NUM),\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);\nCREATE TABLE STUDENT (\nSTU_NUM int PRIMARY KEY,\nSTU_LNAME varchar(15),\nSTU_FNAME varchar(15),\nSTU_INIT varchar(1),\nSTU_DOB datetime,\nSTU_HRS int,\nSTU_CLASS varchar(2),\nSTU_GPA float(8),\nSTU_TRANSFER numeric,\nDEPT_CODE varchar(18),\nSTU_PHONE varchar(4),\nPROF_NUM int,\nFOREIGN KEY (DEPT_CODE) REFERENCES DEPARTMENT(DEPT_CODE)\n);"} {"qid": "pool_0593", "split": "pool", "db_id": "college_3", "question": "What are the full names of the 3 instructors who teach the most courses?", "gold_sql": "SELECT T2.Fname , T2.Lname FROM COURSE AS T1 JOIN FACULTY AS T2 ON T1.Instructor = T2.FacID GROUP BY T1.Instructor ORDER BY count(*) DESC LIMIT 3", "db_path": "databases/college_3/college_3.sqlite", "schema": "CREATE TABLE Course (\n CID \t \tVARCHAR(7) PRIMARY KEY,\n CName\t\tVARCHAR(40),\n Credits\t\tINTEGER,\n Instructor\tINTEGER,\n Days\t\tVARCHAR(5),\n Hours\t\tVARCHAR(11),\n DNO\t\tINTEGER,\n FOREIGN KEY(Instructor) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Department (\n DNO \t\tINTEGER PRIMARY KEY,\n Division\t\tVARCHAR(2),\n DName\t\tVARCHAR(25),\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13),\n DPhone\t\tINTEGER\n);\nCREATE TABLE Enrolled_in (\n StuID \t\t INTEGER,\n CID\t\tVARCHAR(7),\n Grade\t\tVARCHAR(2),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(CID) REFERENCES Course(CID),\n FOREIGN KEY(Grade) REFERENCES Gradeconversion(lettergrade)\n);\nCREATE TABLE Faculty (\n FacID \t INTEGER PRIMARY KEY,\n Lname\t\tVARCHAR(15),\n Fname\t\tVARCHAR(15),\n Rank\t\tVARCHAR(15),\n Sex\t\tVARCHAR(1),\n Phone\t\tINTEGER,\n Room\t\tVARCHAR(5),\n Building\t\tVARCHAR(13)\n);\nCREATE TABLE Gradeconversion (\n lettergrade\t VARCHAR(2) PRIMARY KEY,\n gradepoint\t FLOAT\n);\nCREATE TABLE Member_of (\n FacID \t INTEGER,\n DNO\t INTEGER,\n Appt_Type VARCHAR(15),\n FOREIGN KEY(FacID) REFERENCES Faculty(FacID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Minor_in (\n StuID \t INTEGER,\n DNO\t\tINTEGER,\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(DNO) REFERENCES Department(DNO)\n);\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n );"} {"qid": "pool_0594", "split": "pool", "db_id": "tracking_grants_for_research", "question": "For each project id, how many staff does it have? List them in increasing order.", "gold_sql": "SELECT T1.project_id , count(*) FROM Project_Staff AS T1 JOIN Projects AS T2 ON T1.project_id = T2.project_id GROUP BY T1.project_id ORDER BY count(*) ASC", "db_path": "databases/tracking_grants_for_research/tracking_grants_for_research.sqlite", "schema": "CREATE TABLE `Document_Types` (\n`document_type_code` VARCHAR(10) PRIMARY KEY,\n`document_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Documents` (\n`document_id` INTEGER PRIMARY KEY,\n`document_type_code` VARCHAR(10),\n`grant_id` INTEGER NOT NULL,\n`sent_date` DATETIME NOT NULL,\n`response_received_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`document_type_code` ) REFERENCES `Document_Types`(`document_type_code` ),\nFOREIGN KEY (`grant_id` ) REFERENCES `Grants`(`grant_id` )\n);\nCREATE TABLE `Grants` (\n`grant_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`grant_amount` DECIMAL(19,4) NOT NULL DEFAULT 0,\n`grant_start_date` DATETIME NOT NULL,\n`grant_end_date` DATETIME NOT NULL,\n`other_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Organisation_Types` (\n`organisation_type` VARCHAR(10) PRIMARY KEY,\n`organisation_type_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Organisations` (\n`organisation_id` INTEGER PRIMARY KEY,\n`organisation_type` VARCHAR(10) NOT NULL,\n`organisation_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_type` ) REFERENCES `Organisation_Types`(`organisation_type` )\n);\nCREATE TABLE `Project_Outcomes` (\n`project_id` INTEGER NOT NULL,\n`outcome_code` VARCHAR(10) NOT NULL,\n`outcome_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`outcome_code` ) REFERENCES `Research_Outcomes`(`outcome_code` )\n);\nCREATE TABLE `Project_Staff` (\n`staff_id` DOUBLE PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`role_code` VARCHAR(10) NOT NULL,\n`date_from` DATETIME,\n`date_to` DATETIME,\n`other_details` VARCHAR(255),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` ),FOREIGN KEY (`role_code` ) REFERENCES `Staff_Roles`(`role_code` )\n);\nCREATE TABLE `Projects` (\n`project_id` INTEGER PRIMARY KEY,\n`organisation_id` INTEGER NOT NULL,\n`project_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Research_Outcomes` (\n`outcome_code` VARCHAR(10) PRIMARY KEY,\n`outcome_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Research_Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`employer_organisation_id` INTEGER NOT NULL,\n`staff_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`employer_organisation_id` ) REFERENCES `Organisations`(`organisation_id` )\n);\nCREATE TABLE `Staff_Roles` (\n`role_code` VARCHAR(10) PRIMARY KEY,\n`role_description` VARCHAR(255) NOT NULL\n);\nCREATE TABLE `Tasks` (\n`task_id` INTEGER PRIMARY KEY,\n`project_id` INTEGER NOT NULL,\n`task_details` VARCHAR(255) NOT NULL,\n`eg Agree Objectives` VARCHAR(1),\nFOREIGN KEY (`project_id` ) REFERENCES `Projects`(`project_id` )\n);"} {"qid": "pool_0595", "split": "pool", "db_id": "cre_Docs_and_Epenses", "question": "What are the names and dates for documents corresponding to project that has the details 'Graph Database project'?", "gold_sql": "SELECT document_name , document_date FROM Documents AS T1 JOIN projects AS T2 ON T1.project_id = T2.project_id WHERE T2.project_details = 'Graph Database project'", "db_path": "databases/cre_Docs_and_Epenses/cre_Docs_and_Epenses.sqlite", "schema": "CREATE TABLE Accounts (\nAccount_ID INTEGER NOT NULL,\nStatement_ID INTEGER NOT NULL,\nAccount_Details VARCHAR(255),\nPRIMARY KEY (Account_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Statements (Statement_ID)\n);\nCREATE TABLE Documents (\nDocument_ID INTEGER NOT NULL,\nDocument_Type_Code CHAR(15) NOT NULL,\nProject_ID INTEGER NOT NULL,\nDocument_Date DATETIME,\nDocument_Name VARCHAR(255),\nDocument_Description VARCHAR(255),\nOther_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),\nFOREIGN KEY (Project_ID) REFERENCES Projects (Project_ID)\n);\nCREATE TABLE Documents_with_Expenses (\nDocument_ID INTEGER NOT NULL,\nBudget_Type_Code CHAR(15) NOT NULL,\nDocument_Details VARCHAR(255),\nPRIMARY KEY (Document_ID),\nFOREIGN KEY (Budget_Type_Code) REFERENCES Ref_Budget_Codes (Budget_Type_Code),\nFOREIGN KEY (Document_ID) REFERENCES Documents (Document_ID)\n);\nCREATE TABLE Projects (\nProject_ID INTEGER NOT NULL,\nProject_Details VARCHAR(255),\nPRIMARY KEY (Project_ID)\n);\nCREATE TABLE Ref_Budget_Codes (\nBudget_Type_Code CHAR(15) NOT NULL,\nBudget_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Budget_Type_Code)\n);\nCREATE TABLE Ref_Document_Types (\nDocument_Type_Code CHAR(15) NOT NULL,\nDocument_Type_Name VARCHAR(255) NOT NULL,\nDocument_Type_Description VARCHAR(255) NOT NULL,\nPRIMARY KEY (Document_Type_Code)\n);\nCREATE TABLE Statements (\nStatement_ID INTEGER NOT NULL,\nStatement_Details VARCHAR(255),\nPRIMARY KEY (Statement_ID),\nFOREIGN KEY (Statement_ID) REFERENCES Documents (Document_ID)\n);"} {"qid": "pool_0596", "split": "pool", "db_id": "csu_1", "question": "What is the average fee on a CSU campus in 2005?", "gold_sql": "SELECT avg(campusfee) FROM csu_fees WHERE YEAR = 2005", "db_path": "databases/csu_1/csu_1.sqlite", "schema": "CREATE TABLE \"Campuses\" (\n\t\"Id\" INTEGER PRIMARY KEY, \n\t\"Campus\" TEXT, \n\t\"Location\" TEXT, \n\t\"County\" TEXT, \n\t\"Year\" INTEGER \n);\nCREATE TABLE \"csu_fees\" ( \n\t\"Campus\" INTEGER PRIMARY KEY, \n\t\"Year\" INTEGER, \n\t\"CampusFee\" INTEGER,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"degrees\" ( \n\t\"Year\" INTEGER,\n\t\"Campus\" INTEGER, \n\t\"Degrees\" INTEGER,\n\tPRIMARY KEY (Year, Campus),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"discipline_enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Discipline\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Undergraduate\" INTEGER, \n\t\"Graduate\" INTEGER,\n\tPRIMARY KEY (Campus, Discipline),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"enrollments\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"TotalEnrollment_AY\" INTEGER, \n\t\"FTE_AY\" INTEGER,\n\tPRIMARY KEY(Campus, Year),\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id)\n);\nCREATE TABLE \"faculty\" ( \n\t\"Campus\" INTEGER, \n\t\"Year\" INTEGER, \n\t\"Faculty\" REAL,\n\tFOREIGN KEY (Campus) REFERENCES Campuses(Id) \n);"} {"qid": "pool_0597", "split": "pool", "db_id": "student_assessment", "question": "What are the names of the courses in alphabetical order?", "gold_sql": "SELECT course_name FROM courses ORDER BY course_name", "db_path": "databases/student_assessment/student_assessment.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\nline_1 VARCHAR(80),\nline_2 VARCHAR(80),\ncity VARCHAR(50),\nzip_postcode CHAR(20),\nstate_province_county VARCHAR(50),\ncountry VARCHAR(50),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Candidate_Assessments (\ncandidate_id INTEGER NOT NULL,\nqualification CHAR(15) NOT NULL,\nassessment_date DATETIME NOT NULL,\nasessment_outcome_code CHAR(15) NOT NULL,\nPRIMARY KEY (candidate_id, qualification),\nFOREIGN KEY (candidate_id) REFERENCES Candidates (candidate_id)\n);\nCREATE TABLE Candidates (\ncandidate_id INTEGER NOT NULL ,\ncandidate_details VARCHAR(255),\nPRIMARY KEY (candidate_id),\nFOREIGN KEY (candidate_id) REFERENCES People (person_id)\n);\nCREATE TABLE Courses (\ncourse_id VARCHAR(100) NOT NULL,\ncourse_name VARCHAR(120),\ncourse_description VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (course_id)\n);\nCREATE TABLE People (\nperson_id INTEGER NOT NULL,\nfirst_name VARCHAR(255),\nmiddle_name VARCHAR(255),\nlast_name VARCHAR(255),\ncell_mobile_number VARCHAR(40),\nemail_address VARCHAR(40),\nlogin_name VARCHAR(40),\npassword VARCHAR(40),\nPRIMARY KEY (person_id)\n);\nCREATE TABLE People_Addresses (\nperson_address_id INTEGER NOT NULL,\nperson_id INTEGER NOT NULL,\naddress_id INTEGER NOT NULL,\ndate_from DATETIME,\ndate_to DATETIME,\nPRIMARY KEY (person_address_id),\nFOREIGN KEY (person_id) REFERENCES People (person_id),\nFOREIGN KEY (address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Student_Course_Attendance (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\ndate_of_attendance DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id, course_id) REFERENCES Student_Course_Registrations (student_id,course_id)\n);\nCREATE TABLE Student_Course_Registrations (\nstudent_id INTEGER NOT NULL,\ncourse_id INTEGER NOT NULL,\nregistration_date DATETIME NOT NULL,\nPRIMARY KEY (student_id, course_id),\nFOREIGN KEY (student_id) REFERENCES Students (student_id),\nFOREIGN KEY (course_id) REFERENCES Courses (course_id)\n);\nCREATE TABLE Students (\nstudent_id INTEGER NOT NULL,\nstudent_details VARCHAR(255),\nPRIMARY KEY (student_id),\nFOREIGN KEY (student_id) REFERENCES People (person_id)\n);"} {"qid": "pool_0598", "split": "pool", "db_id": "store_1", "question": "What is the title, phone and hire date of Nancy Edwards?", "gold_sql": "SELECT title , phone , hire_date FROM employees WHERE first_name = \"Nancy\" AND last_name = \"Edwards\";", "db_path": "databases/store_1/store_1.sqlite", "schema": "CREATE TABLE albums\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n title VARCHAR(160) NOT NULL,\n artist_id INTEGER NOT NULL,\n FOREIGN KEY (artist_id) REFERENCES artists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE artists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE customers\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n first_name VARCHAR(40) NOT NULL,\n last_name VARCHAR(20) NOT NULL,\n company VARCHAR(80),\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60) NOT NULL,\n support_rep_id INTEGER,\n FOREIGN KEY (support_rep_id) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE employees\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n last_name VARCHAR(20) NOT NULL,\n first_name VARCHAR(20) NOT NULL,\n title VARCHAR(30),\n reports_to INTEGER,\n birth_date TIMESTAMP,\n hire_date TIMESTAMP,\n address VARCHAR(70),\n city VARCHAR(40),\n state VARCHAR(40),\n country VARCHAR(40),\n postal_code VARCHAR(10),\n phone VARCHAR(24),\n fax VARCHAR(24),\n email VARCHAR(60),\n FOREIGN KEY (reports_to) REFERENCES employees (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE genres\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE invoice_lines\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n invoice_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n unit_price NUMERIC(10,2) NOT NULL,\n quantity INTEGER NOT NULL,\n FOREIGN KEY (invoice_id) REFERENCES invoices (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE invoices\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n customer_id INTEGER NOT NULL,\n invoice_date TIMESTAMP NOT NULL,\n billing_address VARCHAR(70),\n billing_city VARCHAR(40),\n billing_state VARCHAR(40),\n billing_country VARCHAR(40),\n billing_postal_code VARCHAR(10),\n total NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (customer_id) REFERENCES customers (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE media_types\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE playlist_tracks\n(\n playlist_id INTEGER NOT NULL,\n track_id INTEGER NOT NULL,\n CONSTRAINT PK_PlaylistTrack PRIMARY KEY (playlist_id, track_id),\n FOREIGN KEY (playlist_id) REFERENCES playlists (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (track_id) REFERENCES tracks (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);\nCREATE TABLE playlists\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(120)\n);\nCREATE TABLE sqlite_sequence(name,seq);\nCREATE TABLE tracks\n(\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name VARCHAR(200) NOT NULL,\n album_id INTEGER,\n media_type_id INTEGER NOT NULL,\n genre_id INTEGER,\n composer VARCHAR(220),\n milliseconds INTEGER NOT NULL,\n bytes INTEGER,\n unit_price NUMERIC(10,2) NOT NULL,\n FOREIGN KEY (album_id) REFERENCES albums (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (genre_id) REFERENCES genres (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION,\n FOREIGN KEY (media_type_id) REFERENCES media_types (id)\n ON DELETE NO ACTION ON UPDATE NO ACTION\n);"} {"qid": "pool_0599", "split": "pool", "db_id": "flight_1", "question": "What are the numbers of the shortest flights?", "gold_sql": "SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3", "db_path": "databases/flight_1/flight_1.sqlite", "schema": "CREATE TABLE aircraft(\n\taid number(9,0) primary key,\n\tname varchar2(30),\n\tdistance number(6,0));\nCREATE TABLE certificate(\n\teid number(9,0),\n\taid number(9,0),\n\tprimary key(eid,aid),\n\tforeign key(\"eid\") references `employee`(\"eid\"),\n\tforeign key(\"aid\") references `aircraft`(\"aid\"));\nCREATE TABLE employee(\n\teid number(9,0) primary key,\n\tname varchar2(30),\n\tsalary number(10,2));\nCREATE TABLE flight(\n\tflno number(4,0) primary key,\n\torigin varchar2(20),\n\tdestination varchar2(20),\n\tdistance number(6,0),\n\tdeparture_date date,\n\tarrival_date date,\n\tprice number(7,2),\n aid number(9,0),\n foreign key(\"aid\") references `aircraft`(\"aid\"));"}