{"qid": "gate_0000", "split": "gate_large", "db_id": "hr_1", "question": "Find the first name and last name and department id for those employees who earn such amount of salary which is the smallest salary of any of the departments.", "gold_sql": "SELECT first_name , last_name , department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0001", "split": "gate_large", "db_id": "culture_company", "question": "Show publishers with a book published in 1989 and a book in 1990.", "gold_sql": "SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990", "db_path": "databases/culture_company/culture_company.sqlite", "schema": "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);\nCREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);\nCREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);"} {"qid": "gate_0002", "split": "gate_large", "db_id": "insurance_fnol", "question": "Find the phone numbers of customers using the most common policy type among the available policies.", "gold_sql": "SELECT customer_phone FROM available_policies WHERE policy_type_code = (SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY count(*) DESC LIMIT 1)", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0003", "split": "gate_large", "db_id": "student_1", "question": "Count the number of students the teacher LORIA ONDERSMA teaches.", "gold_sql": "SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"LORIA\" AND T2.lastname = \"ONDERSMA\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0004", "split": "gate_large", "db_id": "cre_Doc_Control_Systems", "question": "What address was the document with id 4 mailed to?", "gold_sql": "SELECT Addresses.address_details FROM Addresses JOIN Documents_Mailed ON Documents_Mailed.mailed_to_address_id = Addresses.address_id WHERE document_id = 4;", "db_path": "databases/cre_Doc_Control_Systems/cre_Doc_Control_Systems.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\naddress_details VARCHAR(255),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Circulation_History (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nemployee_id INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number, employee_id),\nFOREIGN KEY (document_id, draft_number, copy_number) REFERENCES Draft_Copies (document_id,draft_number,copy_number),\nFOREIGN KEY (employee_id) REFERENCES Employees (employee_id)\n);\nCREATE TABLE Document_Drafts (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ndraft_details VARCHAR(255),\nPRIMARY KEY (document_id, draft_number),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id)\n);\nCREATE TABLE Documents (\ndocument_id INTEGER NOT NULL,\ndocument_status_code CHAR(15) NOT NULL,\ndocument_type_code CHAR(15) NOT NULL,\nshipping_agent_code CHAR(15),\nreceipt_date DATETIME,\nreceipt_number VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (document_id),\nFOREIGN KEY (document_type_code) REFERENCES Ref_Document_Types (document_type_code),\nFOREIGN KEY (document_status_code) REFERENCES Ref_Document_Status (document_status_code),\nFOREIGN KEY (shipping_agent_code) REFERENCES Ref_Shipping_Agents (shipping_agent_code)\n);\nCREATE TABLE Documents_Mailed (\ndocument_id INTEGER NOT NULL,\nmailed_to_address_id INTEGER NOT NULL,\nmailing_date DATETIME,\nPRIMARY KEY (document_id, mailed_to_address_id),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id),\nFOREIGN KEY (mailed_to_address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Draft_Copies (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number),\nFOREIGN KEY (document_id, draft_number) REFERENCES Document_Drafts (document_id,draft_number)\n);\nCREATE TABLE Employees (\nemployee_id INTEGER NOT NULL,\nrole_code CHAR(15) NOT NULL,\nemployee_name VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (employee_id),\nFOREIGN KEY (role_code) REFERENCES Roles (role_code)\n);\nCREATE TABLE Ref_Document_Status (\ndocument_status_code CHAR(15) NOT NULL,\ndocument_status_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_status_code)\n);\nCREATE TABLE Ref_Document_Types (\ndocument_type_code CHAR(15) NOT NULL,\ndocument_type_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_type_code)\n);\nCREATE TABLE Ref_Shipping_Agents (\nshipping_agent_code CHAR(15) NOT NULL,\nshipping_agent_name VARCHAR(255) NOT NULL,\nshipping_agent_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (shipping_agent_code)\n);\nCREATE TABLE Roles (\nrole_code CHAR(15) NOT NULL,\nrole_description VARCHAR(255),\nPRIMARY KEY (role_code)\n);"} {"qid": "gate_0005", "split": "gate_large", "db_id": "game_1", "question": "How many different types of sports do we offer?", "gold_sql": "SELECT count(DISTINCT sportname) FROM Sportsinfo", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0006", "split": "gate_large", "db_id": "insurance_fnol", "question": "Which customer uses the most policies? Give me the customer name.", "gold_sql": "SELECT t1.customer_name FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_name ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0007", "split": "gate_large", "db_id": "twitter_1", "question": "What is the partition id of the user named \"Iron Man\".", "gold_sql": "SELECT partitionid FROM user_profiles WHERE name = 'Iron Man'", "db_path": "databases/twitter_1/twitter_1.sqlite", "schema": "CREATE TABLE `follows` (\n `f1` int(11) NOT NULL,\n `f2` int(11) NOT NULL,\n PRIMARY KEY (`f1`,`f2`),\n FOREIGN KEY (`f1`) REFERENCES `user_profiles`(`uid`),\n FOREIGN KEY (`f2`) REFERENCES `user_profiles`(`uid`)\n\n);\nCREATE TABLE `tweets` (\n `id` bigint(20) NOT NULL,\n `uid` int(11) NOT NULL,\n `text` char(140) NOT NULL,\n `createdate` datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (`id`),\n FOREIGN KEY (`uid`) REFERENCES `user_profiles`(`uid`)\n);\nCREATE TABLE \"user_profiles\" (`uid` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `partitionid` int(11) DEFAULT NULL, `followers` int(11) DEFAULT NULL, PRIMARY KEY (`uid`));"} {"qid": "gate_0008", "split": "gate_large", "db_id": "school_bus", "question": "Show the school name and type for schools without a school bus.", "gold_sql": "SELECT school , TYPE FROM school WHERE school_id NOT IN (SELECT school_id FROM school_bus)", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0009", "split": "gate_large", "db_id": "race_track", "question": "What are the names, classes, and dates for all races?", "gold_sql": "SELECT name , CLASS , date FROM race", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0010", "split": "gate_large", "db_id": "club_1", "question": "Tell me the location of the club \"Hopkins Student Enterprises\".", "gold_sql": "SELECT clublocation FROM club WHERE clubname = \"Hopkins Student Enterprises\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0011", "split": "gate_large", "db_id": "party_people", "question": "Return the minister who left office at the latest time.", "gold_sql": "SELECT minister FROM party ORDER BY left_office DESC LIMIT 1", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0012", "split": "gate_large", "db_id": "candidate_poll", "question": "Find the name of the candidates whose oppose percentage is the lowest for each sex.", "gold_sql": "SELECT t1.name , t1.sex , min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0013", "split": "gate_large", "db_id": "manufactory_1", "question": "How many products are there for each manufacturer?", "gold_sql": "SELECT count(*) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0014", "split": "gate_large", "db_id": "race_track", "question": "Give the names of tracks that do not have a race in the class 'GT'.", "gold_sql": "SELECT name FROM track EXCEPT SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id WHERE T1.class = 'GT'", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0015", "split": "gate_large", "db_id": "game_1", "question": "What are the average, minimum, and max ages for each of the different majors?", "gold_sql": "SELECT major , avg(age) , min(age) , max(age) FROM Student GROUP BY major", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0016", "split": "gate_large", "db_id": "soccer_1", "question": "Of all players with an overall rating greater than 80, how many are right-footed and left-footed?", "gold_sql": "SELECT preferred_foot , count(*) FROM Player_Attributes WHERE overall_rating > 80 GROUP BY preferred_foot", "db_path": "databases/soccer_1/soccer_1.sqlite", "schema": "CREATE TABLE `Country` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`name`\tTEXT UNIQUE\n);\nCREATE TABLE `League` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`country_id`\tINTEGER,\n\t`name`\tTEXT UNIQUE,\n\tFOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)\n);\nCREATE TABLE `Player` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_api_id`\tINTEGER UNIQUE,\n\t`player_name`\tTEXT,\n\t`player_fifa_api_id`\tINTEGER UNIQUE,\n\t`birthday`\tTEXT,\n\t`height`\tINTEGER,\n\t`weight`\tINTEGER\n);\nCREATE TABLE \"Player_Attributes\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_fifa_api_id`\tINTEGER,\n\t`player_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`overall_rating`\tINTEGER,\n\t`potential`\tINTEGER,\n\t`preferred_foot`\tTEXT,\n\t`attacking_work_rate`\tTEXT,\n\t`defensive_work_rate`\tTEXT,\n\t`crossing`\tINTEGER,\n\t`finishing`\tINTEGER,\n\t`heading_accuracy`\tINTEGER,\n\t`short_passing`\tINTEGER,\n\t`volleys`\tINTEGER,\n\t`dribbling`\tINTEGER,\n\t`curve`\tINTEGER,\n\t`free_kick_accuracy`\tINTEGER,\n\t`long_passing`\tINTEGER,\n\t`ball_control`\tINTEGER,\n\t`acceleration`\tINTEGER,\n\t`sprint_speed`\tINTEGER,\n\t`agility`\tINTEGER,\n\t`reactions`\tINTEGER,\n\t`balance`\tINTEGER,\n\t`shot_power`\tINTEGER,\n\t`jumping`\tINTEGER,\n\t`stamina`\tINTEGER,\n\t`strength`\tINTEGER,\n\t`long_shots`\tINTEGER,\n\t`aggression`\tINTEGER,\n\t`interceptions`\tINTEGER,\n\t`positioning`\tINTEGER,\n\t`vision`\tINTEGER,\n\t`penalties`\tINTEGER,\n\t`marking`\tINTEGER,\n\t`standing_tackle`\tINTEGER,\n\t`sliding_tackle`\tINTEGER,\n\t`gk_diving`\tINTEGER,\n\t`gk_handling`\tINTEGER,\n\t`gk_kicking`\tINTEGER,\n\t`gk_positioning`\tINTEGER,\n\t`gk_reflexes`\tINTEGER,\n\tFOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),\n\tFOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)\n);\nCREATE TABLE \"Team\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_api_id`\tINTEGER UNIQUE,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_long_name`\tTEXT,\n\t`team_short_name`\tTEXT\n);\nCREATE TABLE `Team_Attributes` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`buildUpPlaySpeed`\tINTEGER,\n\t`buildUpPlaySpeedClass`\tTEXT,\n\t`buildUpPlayDribbling`\tINTEGER,\n\t`buildUpPlayDribblingClass`\tTEXT,\n\t`buildUpPlayPassing`\tINTEGER,\n\t`buildUpPlayPassingClass`\tTEXT,\n\t`buildUpPlayPositioningClass`\tTEXT,\n\t`chanceCreationPassing`\tINTEGER,\n\t`chanceCreationPassingClass`\tTEXT,\n\t`chanceCreationCrossing`\tINTEGER,\n\t`chanceCreationCrossingClass`\tTEXT,\n\t`chanceCreationShooting`\tINTEGER,\n\t`chanceCreationShootingClass`\tTEXT,\n\t`chanceCreationPositioningClass`\tTEXT,\n\t`defencePressure`\tINTEGER,\n\t`defencePressureClass`\tTEXT,\n\t`defenceAggression`\tINTEGER,\n\t`defenceAggressionClass`\tTEXT,\n\t`defenceTeamWidth`\tINTEGER,\n\t`defenceTeamWidthClass`\tTEXT,\n\t`defenceDefenderLineClass`\tTEXT,\n\tFOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),\n\tFOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)\n);\nCREATE TABLE sqlite_sequence(name,seq);"} {"qid": "gate_0017", "split": "gate_large", "db_id": "party_people", "question": "Who are the ministers and what parties do they belong to, listed descending by the times they took office?", "gold_sql": "SELECT minister , party_name FROM party ORDER BY took_office DESC", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0018", "split": "gate_large", "db_id": "product_catalog", "question": "Find the entry names of the catalog with the attribute that have the most entries.", "gold_sql": "SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.attribute_value = (SELECT attribute_value FROM Catalog_Contents_Additional_Attributes GROUP BY attribute_value ORDER BY count(*) DESC LIMIT 1)", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0019", "split": "gate_large", "db_id": "formula_1", "question": "What is the first and last name of all the German drivers?", "gold_sql": "SELECT forename , surname FROM drivers WHERE nationality = \"German\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0020", "split": "gate_large", "db_id": "store_product", "question": "What city is the headquarter of the store Blackville?", "gold_sql": "SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t1.store_name = \"Blackville\"", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0021", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.", "gold_sql": "SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0022", "split": "gate_large", "db_id": "candidate_poll", "question": "Find the average and minimum weight for each gender.", "gold_sql": "SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0023", "split": "gate_large", "db_id": "inn_1", "question": "What are the name of rooms booked by customers whose first name has \"ROY\" in part?", "gold_sql": "SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0024", "split": "gate_large", "db_id": "perpetrator", "question": "What is the total kills of the perpetrators with height more than 1.84.", "gold_sql": "SELECT sum(T2.Killed) FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Height > 1.84", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0025", "split": "gate_large", "db_id": "inn_1", "question": "Find the number of rooms for each bed type.", "gold_sql": "SELECT bedType , count(*) FROM Rooms GROUP BY bedType;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0026", "split": "gate_large", "db_id": "formula_1", "question": "What are the average fastest lap speed in races held after 2004 grouped by race name and ordered by year?", "gold_sql": "SELECT avg(T2.fastestlapspeed) , T1.name , T1.year FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year > 2014 GROUP BY T1.name ORDER BY T1.year", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0027", "split": "gate_large", "db_id": "formula_1", "question": "Find the distinct names of all races held between 2014 and 2017?", "gold_sql": "SELECT DISTINCT name FROM races WHERE YEAR BETWEEN 2014 AND 2017", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0028", "split": "gate_large", "db_id": "insurance_fnol", "question": "Find the maximum and minimum settlement amount.", "gold_sql": "SELECT max(settlement_amount) , min(settlement_amount) FROM settlements", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0029", "split": "gate_large", "db_id": "hr_1", "question": "What are the department names, cities, and state provinces for each department?", "gold_sql": "SELECT T1.department_name , T2.city , T2.state_province FROM departments AS T1 JOIN locations AS T2 ON T2.location_id = T1.location_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0030", "split": "gate_large", "db_id": "product_catalog", "question": "Name all the products with next entry ID greater than 8.", "gold_sql": "SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0031", "split": "gate_large", "db_id": "inn_1", "question": "How many king beds are there?", "gold_sql": "SELECT sum(beds) FROM Rooms WHERE bedtype = 'King';", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0032", "split": "gate_large", "db_id": "club_1", "question": "How many students are there?", "gold_sql": "SELECT count(*) FROM student", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0033", "split": "gate_large", "db_id": "tracking_orders", "question": "What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?", "gold_sql": "SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < \"1989-09-03\" OR invoice_date > \"2007-12-25\"", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0034", "split": "gate_large", "db_id": "student_1", "question": "Find the number of students in total.", "gold_sql": "SELECT count(*) FROM list", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0035", "split": "gate_large", "db_id": "behavior_monitoring", "question": "Find all information about student addresses, and sort by monthly rental in descending order.", "gold_sql": "SELECT * FROM Student_Addresses ORDER BY monthly_rental DESC", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0036", "split": "gate_large", "db_id": "cre_Doc_Control_Systems", "question": "For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees.", "gold_sql": "SELECT document_id , count(DISTINCT employee_id) FROM Circulation_History GROUP BY document_id;", "db_path": "databases/cre_Doc_Control_Systems/cre_Doc_Control_Systems.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\naddress_details VARCHAR(255),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Circulation_History (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nemployee_id INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number, employee_id),\nFOREIGN KEY (document_id, draft_number, copy_number) REFERENCES Draft_Copies (document_id,draft_number,copy_number),\nFOREIGN KEY (employee_id) REFERENCES Employees (employee_id)\n);\nCREATE TABLE Document_Drafts (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ndraft_details VARCHAR(255),\nPRIMARY KEY (document_id, draft_number),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id)\n);\nCREATE TABLE Documents (\ndocument_id INTEGER NOT NULL,\ndocument_status_code CHAR(15) NOT NULL,\ndocument_type_code CHAR(15) NOT NULL,\nshipping_agent_code CHAR(15),\nreceipt_date DATETIME,\nreceipt_number VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (document_id),\nFOREIGN KEY (document_type_code) REFERENCES Ref_Document_Types (document_type_code),\nFOREIGN KEY (document_status_code) REFERENCES Ref_Document_Status (document_status_code),\nFOREIGN KEY (shipping_agent_code) REFERENCES Ref_Shipping_Agents (shipping_agent_code)\n);\nCREATE TABLE Documents_Mailed (\ndocument_id INTEGER NOT NULL,\nmailed_to_address_id INTEGER NOT NULL,\nmailing_date DATETIME,\nPRIMARY KEY (document_id, mailed_to_address_id),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id),\nFOREIGN KEY (mailed_to_address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Draft_Copies (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number),\nFOREIGN KEY (document_id, draft_number) REFERENCES Document_Drafts (document_id,draft_number)\n);\nCREATE TABLE Employees (\nemployee_id INTEGER NOT NULL,\nrole_code CHAR(15) NOT NULL,\nemployee_name VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (employee_id),\nFOREIGN KEY (role_code) REFERENCES Roles (role_code)\n);\nCREATE TABLE Ref_Document_Status (\ndocument_status_code CHAR(15) NOT NULL,\ndocument_status_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_status_code)\n);\nCREATE TABLE Ref_Document_Types (\ndocument_type_code CHAR(15) NOT NULL,\ndocument_type_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_type_code)\n);\nCREATE TABLE Ref_Shipping_Agents (\nshipping_agent_code CHAR(15) NOT NULL,\nshipping_agent_name VARCHAR(255) NOT NULL,\nshipping_agent_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (shipping_agent_code)\n);\nCREATE TABLE Roles (\nrole_code CHAR(15) NOT NULL,\nrole_description VARCHAR(255),\nPRIMARY KEY (role_code)\n);"} {"qid": "gate_0037", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Return the channel code and contact number of the customer contact channel whose active duration was the longest.", "gold_sql": "SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0038", "split": "gate_large", "db_id": "formula_1", "question": "What are the unique names of races that held after 2000 and the circuits were in Spain?", "gold_sql": "SELECT DISTINCT T1.name FROM races AS T1 JOIN circuits AS T2 ON T1.circuitid = T2.circuitid WHERE T2.country = \"Spain\" AND T1.year > 2000", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0039", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the average amount of transactions for different lots, ordered by average amount of transactions.", "gold_sql": "SELECT T2.lot_id , avg(amount_of_transaction) FROM TRANSACTIONS AS T1 JOIN Transactions_Lots AS T2 ON T1.transaction_id = T2.transaction_id GROUP BY T2.lot_id ORDER BY avg(amount_of_transaction)", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0040", "split": "gate_large", "db_id": "game_1", "question": "What are the first names for all students who are from the major numbered 600?", "gold_sql": "SELECT Fname FROM Student WHERE Major = 600", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0041", "split": "gate_large", "db_id": "customers_card_transactions", "question": "What are the ids and first names of customers who do not hold a credit card?", "gold_sql": "SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = \"Credit\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0042", "split": "gate_large", "db_id": "ship_1", "question": "List all ship names in the order of built year and class.", "gold_sql": "SELECT name FROM ship ORDER BY built_year , CLASS", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0043", "split": "gate_large", "db_id": "behavior_monitoring", "question": "Find the id and city of the student address with the highest average monthly rental.", "gold_sql": "SELECT T2.address_id , T1.city FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id ORDER BY AVG(monthly_rental) DESC LIMIT 1", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0044", "split": "gate_large", "db_id": "hr_1", "question": "What the full names, ids of each employee and the name of the country they are in?", "gold_sql": "SELECT T1.first_name , T1.last_name , T1.employee_id , T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0045", "split": "gate_large", "db_id": "student_1", "question": "Which teachers teach in classroom 110? Give me their first names.", "gold_sql": "SELECT firstname FROM teachers WHERE classroom = 110", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0046", "split": "gate_large", "db_id": "university_basketball", "question": "How many universities have a location that contains NY?", "gold_sql": "SELECT count(*) FROM university WHERE LOCATION LIKE \"%NY%\"", "db_path": "databases/university_basketball/university_basketball.sqlite", "schema": "CREATE TABLE \"basketball_match\" (\n\"Team_ID\" int,\n\"School_ID\" int,\n\"Team_Name\" text,\n\"ACC_Regular_Season\" text,\n\"ACC_Percent\" text,\n\"ACC_Home\" text,\n\"ACC_Road\" text,\n\"All_Games\" text,\n\"All_Games_Percent\" int,\n\"All_Home\" text,\n\"All_Road\" text,\n\"All_Neutral\" text,\nPRIMARY KEY (\"Team_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)\n);\nCREATE TABLE \"university\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Affiliation\" text,\n\"Enrollment\" real,\n\"Nickname\" text,\n\"Primary_conference\" text,\nPRIMARY KEY (\"School_ID\")\n);"} {"qid": "gate_0047", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the \"active to date\" of the latest contact channel used by \"Tillman Ernser\"?", "gold_sql": "SELECT max(t2.active_to_date) FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Tillman Ernser\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0048", "split": "gate_large", "db_id": "university_basketball", "question": "Count the number of different affiliation types.", "gold_sql": "SELECT count(DISTINCT affiliation) FROM university", "db_path": "databases/university_basketball/university_basketball.sqlite", "schema": "CREATE TABLE \"basketball_match\" (\n\"Team_ID\" int,\n\"School_ID\" int,\n\"Team_Name\" text,\n\"ACC_Regular_Season\" text,\n\"ACC_Percent\" text,\n\"ACC_Home\" text,\n\"ACC_Road\" text,\n\"All_Games\" text,\n\"All_Games_Percent\" int,\n\"All_Home\" text,\n\"All_Road\" text,\n\"All_Neutral\" text,\nPRIMARY KEY (\"Team_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)\n);\nCREATE TABLE \"university\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Affiliation\" text,\n\"Enrollment\" real,\n\"Nickname\" text,\n\"Primary_conference\" text,\nPRIMARY KEY (\"School_ID\")\n);"} {"qid": "gate_0049", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Give the full name and customer id of the customer with the fewest accounts.", "gold_sql": "SELECT T2.customer_first_name , T2.customer_last_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0050", "split": "gate_large", "db_id": "insurance_policies", "question": "Count the total number of settlements made.", "gold_sql": "SELECT count(*) FROM Settlements", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0051", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What are the names of enzymes that include the string 'ALA'?", "gold_sql": "SELECT name FROM enzyme WHERE name LIKE \"%ALA%\"", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0052", "split": "gate_large", "db_id": "student_1", "question": "Which students in third grade are not taught by teacher COVIN JEROME? Give me the last names of the students.", "gold_sql": "SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname != \"COVIN\" AND T2.lastname != \"JEROME\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0053", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "What are the details of all sales and purchases?", "gold_sql": "SELECT sales_details FROM sales UNION SELECT purchase_details FROM purchases", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0054", "split": "gate_large", "db_id": "inn_1", "question": "What is the decor of room Recluse and defiance?", "gold_sql": "SELECT decor FROM Rooms WHERE roomName = \"Recluse and defiance\";", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0055", "split": "gate_large", "db_id": "inn_1", "question": "Find the name of rooms whose price is higher than the average price.", "gold_sql": "SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0056", "split": "gate_large", "db_id": "small_bank_1", "question": "Find the name, checking balance and savings balance of all accounts in the bank sorted by their total checking and savings balance in descending order.", "gold_sql": "SELECT T2.balance , T3.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T2.balance + T3.balance DESC", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0057", "split": "gate_large", "db_id": "tracking_orders", "question": "List the ids of all distinct orders ordered by placed date.", "gold_sql": "SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0058", "split": "gate_large", "db_id": "inn_1", "question": "What are the name of rooms that cost more than the average.", "gold_sql": "SELECT roomName FROM Rooms WHERE basePrice > ( SELECT avg(basePrice) FROM Rooms );", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0059", "split": "gate_large", "db_id": "machine_repair", "question": "What is the team and starting year for each technician?", "gold_sql": "SELECT Team , Starting_Year FROM technician", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0060", "split": "gate_large", "db_id": "club_1", "question": "Find the location of the club \"Pen and Paper Gaming\".", "gold_sql": "SELECT clublocation FROM club WHERE clubname = \"Pen and Paper Gaming\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0061", "split": "gate_large", "db_id": "inn_1", "question": "How many rooms have a king bed?", "gold_sql": "SELECT count(*) FROM Rooms WHERE bedType = \"King\";", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0062", "split": "gate_large", "db_id": "race_track", "question": "Give the different locations of tracks.", "gold_sql": "SELECT DISTINCT LOCATION FROM track", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0063", "split": "gate_large", "db_id": "store_product", "question": "What is the city with the most number of flagship stores?", "gold_sql": "SELECT t3.headquartered_city FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0064", "split": "gate_large", "db_id": "wedding", "question": "Show the name and opening year for three churches that opened most recently.", "gold_sql": "SELECT name , open_date FROM church ORDER BY open_date DESC LIMIT 3", "db_path": "databases/wedding/wedding.sqlite", "schema": "CREATE TABLE \"church\" (\n\"Church_ID\" int,\n\"Name\" text,\n\"Organized_by\" text,\n\"Open_Date\" int,\n\"Continuation_of\" text,\nPRIMARY KEY (\"Church_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Is_Male\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"wedding\" (\n\"Church_ID\" int,\n\"Male_ID\" int,\n\"Female_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Church_ID\",\"Male_ID\",\"Female_ID\"),\nFOREIGN KEY (\"Church_ID\") REFERENCES `church`(\"Church_ID\"),\nFOREIGN KEY (\"Male_ID\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Female_ID\") REFERENCES `people`(\"People_ID\")\n);"} {"qid": "gate_0065", "split": "gate_large", "db_id": "formula_1", "question": "How many drivers did not participate in the races held in 2009?", "gold_sql": "SELECT count(DISTINCT driverId) FROM results WHERE raceId NOT IN( SELECT raceId FROM races WHERE YEAR != 2009 )", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0066", "split": "gate_large", "db_id": "train_station", "question": "Show the station name and number of trains in each station.", "gold_sql": "SELECT T2.name , count(*) FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0067", "split": "gate_large", "db_id": "candidate_poll", "question": "What are the average height and weight across males (sex is M)?", "gold_sql": "SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M'", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0068", "split": "gate_large", "db_id": "department_management", "question": "Which department has more than 1 head at a time? List the id, name and the number of heads.", "gold_sql": "SELECT T1.department_id , T1.name , count(*) FROM management AS T2 JOIN department AS T1 ON T1.department_id = T2.department_id GROUP BY T1.department_id HAVING count(*) > 1", "db_path": "databases/department_management/department_management.sqlite", "schema": "CREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name\" text,\n\"Creation\" text,\n\"Ranking\" int,\n\"Budget_in_Billions\" real,\n\"Num_Employees\" real,\nPRIMARY KEY (\"Department_ID\")\n);\nCREATE TABLE \"head\" (\n\"head_ID\" int,\n\"name\" text,\n\"born_state\" text,\n\"age\" real,\nPRIMARY KEY (\"head_ID\")\n);\nCREATE TABLE \"management\" (\n\"department_ID\" int,\n\"head_ID\" int,\n\"temporary_acting\" text,\nPRIMARY KEY (\"Department_ID\",\"head_ID\"),\nFOREIGN KEY (\"Department_ID\") REFERENCES `department`(\"Department_ID\"),\nFOREIGN KEY (\"head_ID\") REFERENCES `head`(\"head_ID\")\n);"} {"qid": "gate_0069", "split": "gate_large", "db_id": "insurance_policies", "question": "How many settlements are there in total?", "gold_sql": "SELECT count(*) FROM Settlements", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0070", "split": "gate_large", "db_id": "ship_1", "question": "Find the name, type, and flag of the ship that is built in the most recent year.", "gold_sql": "SELECT name , TYPE , flag FROM ship ORDER BY built_year DESC LIMIT 1", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0071", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the maximum amount of transaction.", "gold_sql": "SELECT max(amount_of_transaction) FROM TRANSACTIONS", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0072", "split": "gate_large", "db_id": "perpetrator", "question": "List the number of people injured by perpetrators in ascending order.", "gold_sql": "SELECT Injured FROM perpetrator ORDER BY Injured ASC", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0073", "split": "gate_large", "db_id": "candidate_poll", "question": "What are the names of candidates who have a lower support rate than oppose rate?", "gold_sql": "SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0074", "split": "gate_large", "db_id": "wedding", "question": "How many weddings are there in year 2016?", "gold_sql": "SELECT count(*) FROM wedding WHERE YEAR = 2016", "db_path": "databases/wedding/wedding.sqlite", "schema": "CREATE TABLE \"church\" (\n\"Church_ID\" int,\n\"Name\" text,\n\"Organized_by\" text,\n\"Open_Date\" int,\n\"Continuation_of\" text,\nPRIMARY KEY (\"Church_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Is_Male\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"wedding\" (\n\"Church_ID\" int,\n\"Male_ID\" int,\n\"Female_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Church_ID\",\"Male_ID\",\"Female_ID\"),\nFOREIGN KEY (\"Church_ID\") REFERENCES `church`(\"Church_ID\"),\nFOREIGN KEY (\"Male_ID\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Female_ID\") REFERENCES `people`(\"People_ID\")\n);"} {"qid": "gate_0075", "split": "gate_large", "db_id": "insurance_policies", "question": "List the date the claim was made, the date it was settled and the amount settled for all the claims which had exactly one settlement.", "gold_sql": "SELECT T1.claim_id , T1.date_claim_made , T1.Date_Claim_Settled FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.claim_id HAVING count(*) = 1", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0076", "split": "gate_large", "db_id": "film_rank", "question": "What are the titles of films that do not have a film market estimation?", "gold_sql": "SELECT Title FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation)", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0077", "split": "gate_large", "db_id": "club_1", "question": "What is the location of the club named \"Tennis Club\"?", "gold_sql": "SELECT clublocation FROM club WHERE clubname = \"Tennis Club\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0078", "split": "gate_large", "db_id": "game_1", "question": "Count the number of video games with Massively multiplayer online game type .", "gold_sql": "SELECT count(*) FROM Video_games WHERE gtype = \"Massively multiplayer online game\"", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0079", "split": "gate_large", "db_id": "store_product", "question": "For each type of store, how many of them are there?", "gold_sql": "SELECT TYPE , count(*) FROM store GROUP BY TYPE", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0080", "split": "gate_large", "db_id": "candidate_poll", "question": "Please list support, consider, and oppose rates for each candidate in ascending order by unsure rate.", "gold_sql": "SELECT Support_rate , Consider_rate , Oppose_rate FROM candidate ORDER BY unsure_rate", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0081", "split": "gate_large", "db_id": "soccer_1", "question": "List all of the ids for left-footed players with a height between 180cm and 190cm.", "gold_sql": "SELECT player_api_id FROM Player WHERE height >= 180 AND height <= 190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot = \"left\"", "db_path": "databases/soccer_1/soccer_1.sqlite", "schema": "CREATE TABLE `Country` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`name`\tTEXT UNIQUE\n);\nCREATE TABLE `League` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`country_id`\tINTEGER,\n\t`name`\tTEXT UNIQUE,\n\tFOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)\n);\nCREATE TABLE `Player` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_api_id`\tINTEGER UNIQUE,\n\t`player_name`\tTEXT,\n\t`player_fifa_api_id`\tINTEGER UNIQUE,\n\t`birthday`\tTEXT,\n\t`height`\tINTEGER,\n\t`weight`\tINTEGER\n);\nCREATE TABLE \"Player_Attributes\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_fifa_api_id`\tINTEGER,\n\t`player_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`overall_rating`\tINTEGER,\n\t`potential`\tINTEGER,\n\t`preferred_foot`\tTEXT,\n\t`attacking_work_rate`\tTEXT,\n\t`defensive_work_rate`\tTEXT,\n\t`crossing`\tINTEGER,\n\t`finishing`\tINTEGER,\n\t`heading_accuracy`\tINTEGER,\n\t`short_passing`\tINTEGER,\n\t`volleys`\tINTEGER,\n\t`dribbling`\tINTEGER,\n\t`curve`\tINTEGER,\n\t`free_kick_accuracy`\tINTEGER,\n\t`long_passing`\tINTEGER,\n\t`ball_control`\tINTEGER,\n\t`acceleration`\tINTEGER,\n\t`sprint_speed`\tINTEGER,\n\t`agility`\tINTEGER,\n\t`reactions`\tINTEGER,\n\t`balance`\tINTEGER,\n\t`shot_power`\tINTEGER,\n\t`jumping`\tINTEGER,\n\t`stamina`\tINTEGER,\n\t`strength`\tINTEGER,\n\t`long_shots`\tINTEGER,\n\t`aggression`\tINTEGER,\n\t`interceptions`\tINTEGER,\n\t`positioning`\tINTEGER,\n\t`vision`\tINTEGER,\n\t`penalties`\tINTEGER,\n\t`marking`\tINTEGER,\n\t`standing_tackle`\tINTEGER,\n\t`sliding_tackle`\tINTEGER,\n\t`gk_diving`\tINTEGER,\n\t`gk_handling`\tINTEGER,\n\t`gk_kicking`\tINTEGER,\n\t`gk_positioning`\tINTEGER,\n\t`gk_reflexes`\tINTEGER,\n\tFOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),\n\tFOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)\n);\nCREATE TABLE \"Team\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_api_id`\tINTEGER UNIQUE,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_long_name`\tTEXT,\n\t`team_short_name`\tTEXT\n);\nCREATE TABLE `Team_Attributes` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`buildUpPlaySpeed`\tINTEGER,\n\t`buildUpPlaySpeedClass`\tTEXT,\n\t`buildUpPlayDribbling`\tINTEGER,\n\t`buildUpPlayDribblingClass`\tTEXT,\n\t`buildUpPlayPassing`\tINTEGER,\n\t`buildUpPlayPassingClass`\tTEXT,\n\t`buildUpPlayPositioningClass`\tTEXT,\n\t`chanceCreationPassing`\tINTEGER,\n\t`chanceCreationPassingClass`\tTEXT,\n\t`chanceCreationCrossing`\tINTEGER,\n\t`chanceCreationCrossingClass`\tTEXT,\n\t`chanceCreationShooting`\tINTEGER,\n\t`chanceCreationShootingClass`\tTEXT,\n\t`chanceCreationPositioningClass`\tTEXT,\n\t`defencePressure`\tINTEGER,\n\t`defencePressureClass`\tTEXT,\n\t`defenceAggression`\tINTEGER,\n\t`defenceAggressionClass`\tTEXT,\n\t`defenceTeamWidth`\tINTEGER,\n\t`defenceTeamWidthClass`\tTEXT,\n\t`defenceDefenderLineClass`\tTEXT,\n\tFOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),\n\tFOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)\n);\nCREATE TABLE sqlite_sequence(name,seq);"} {"qid": "gate_0082", "split": "gate_large", "db_id": "twitter_1", "question": "Find the emails of the user named \"Mary\".", "gold_sql": "SELECT email FROM user_profiles WHERE name = 'Mary'", "db_path": "databases/twitter_1/twitter_1.sqlite", "schema": "CREATE TABLE `follows` (\n `f1` int(11) NOT NULL,\n `f2` int(11) NOT NULL,\n PRIMARY KEY (`f1`,`f2`),\n FOREIGN KEY (`f1`) REFERENCES `user_profiles`(`uid`),\n FOREIGN KEY (`f2`) REFERENCES `user_profiles`(`uid`)\n\n);\nCREATE TABLE `tweets` (\n `id` bigint(20) NOT NULL,\n `uid` int(11) NOT NULL,\n `text` char(140) NOT NULL,\n `createdate` datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (`id`),\n FOREIGN KEY (`uid`) REFERENCES `user_profiles`(`uid`)\n);\nCREATE TABLE \"user_profiles\" (`uid` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `partitionid` int(11) DEFAULT NULL, `followers` int(11) DEFAULT NULL, PRIMARY KEY (`uid`));"} {"qid": "gate_0083", "split": "gate_large", "db_id": "sakila_1", "question": "Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name.", "gold_sql": "SELECT T2.first_name , T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING count(*) > 30", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0084", "split": "gate_large", "db_id": "pilot_record", "question": "What is the joined year of the pilot of the highest rank?", "gold_sql": "SELECT Join_Year FROM pilot ORDER BY Rank ASC LIMIT 1", "db_path": "databases/pilot_record/pilot_record.sqlite", "schema": "CREATE TABLE \"aircraft\" (\n\"Aircraft_ID\" int,\n\"Order_Year\" int,\n\"Manufacturer\" text,\n\"Model\" text,\n\"Fleet_Series\" text,\n\"Powertrain\" text,\n\"Fuel_Propulsion\" text,\nPRIMARY KEY (\"Aircraft_ID\")\n);\nCREATE TABLE \"pilot\" (\n\"Pilot_ID\" int,\n\"Pilot_name\" text,\n\"Rank\" int,\n\"Age\" int,\n\"Nationality\" text,\n\"Position\" text,\n\"Join_Year\" int,\n\"Team\" text,\nPRIMARY KEY (\"Pilot_ID\")\n);\nCREATE TABLE \"pilot_record\" (\n\"Record_ID\" int,\n\"Pilot_ID\" int,\n\"Aircraft_ID\" int,\n\"Date\" text,\nPRIMARY KEY (\"Pilot_ID\", \"Aircraft_ID\", \"Date\"),\nFOREIGN KEY (`Pilot_ID`) REFERENCES `pilot`(`Pilot_ID`),\nFOREIGN KEY (`Aircraft_ID`) REFERENCES `aircraft`(`Aircraft_ID`)\n);"} {"qid": "gate_0085", "split": "gate_large", "db_id": "product_catalog", "question": "What are the attribute data types with more than 3 attribute definitions?", "gold_sql": "SELECT attribute_data_type FROM Attribute_Definitions GROUP BY attribute_data_type HAVING count(*) > 3", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0086", "split": "gate_large", "db_id": "race_track", "question": "What is the name of the track that has had the greatest number of races?", "gold_sql": "SELECT T2.name FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0087", "split": "gate_large", "db_id": "train_station", "question": "Show the station name with at least two trains.", "gold_sql": "SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id GROUP BY T1.station_id HAVING count(*) >= 2", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0088", "split": "gate_large", "db_id": "pilot_record", "question": "List the names of pilots in ascending order of rank.", "gold_sql": "SELECT Pilot_name FROM pilot ORDER BY Rank ASC", "db_path": "databases/pilot_record/pilot_record.sqlite", "schema": "CREATE TABLE \"aircraft\" (\n\"Aircraft_ID\" int,\n\"Order_Year\" int,\n\"Manufacturer\" text,\n\"Model\" text,\n\"Fleet_Series\" text,\n\"Powertrain\" text,\n\"Fuel_Propulsion\" text,\nPRIMARY KEY (\"Aircraft_ID\")\n);\nCREATE TABLE \"pilot\" (\n\"Pilot_ID\" int,\n\"Pilot_name\" text,\n\"Rank\" int,\n\"Age\" int,\n\"Nationality\" text,\n\"Position\" text,\n\"Join_Year\" int,\n\"Team\" text,\nPRIMARY KEY (\"Pilot_ID\")\n);\nCREATE TABLE \"pilot_record\" (\n\"Record_ID\" int,\n\"Pilot_ID\" int,\n\"Aircraft_ID\" int,\n\"Date\" text,\nPRIMARY KEY (\"Pilot_ID\", \"Aircraft_ID\", \"Date\"),\nFOREIGN KEY (`Pilot_ID`) REFERENCES `pilot`(`Pilot_ID`),\nFOREIGN KEY (`Aircraft_ID`) REFERENCES `aircraft`(`Aircraft_ID`)\n);"} {"qid": "gate_0089", "split": "gate_large", "db_id": "club_1", "question": "Find the average age of the members in the club \"Bootup Baltimore\".", "gold_sql": "SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = \"Bootup Baltimore\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0090", "split": "gate_large", "db_id": "cre_Doc_Control_Systems", "question": "What document type codes do we have?", "gold_sql": "SELECT document_type_code FROM Ref_Document_Types;", "db_path": "databases/cre_Doc_Control_Systems/cre_Doc_Control_Systems.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\naddress_details VARCHAR(255),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Circulation_History (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nemployee_id INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number, employee_id),\nFOREIGN KEY (document_id, draft_number, copy_number) REFERENCES Draft_Copies (document_id,draft_number,copy_number),\nFOREIGN KEY (employee_id) REFERENCES Employees (employee_id)\n);\nCREATE TABLE Document_Drafts (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ndraft_details VARCHAR(255),\nPRIMARY KEY (document_id, draft_number),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id)\n);\nCREATE TABLE Documents (\ndocument_id INTEGER NOT NULL,\ndocument_status_code CHAR(15) NOT NULL,\ndocument_type_code CHAR(15) NOT NULL,\nshipping_agent_code CHAR(15),\nreceipt_date DATETIME,\nreceipt_number VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (document_id),\nFOREIGN KEY (document_type_code) REFERENCES Ref_Document_Types (document_type_code),\nFOREIGN KEY (document_status_code) REFERENCES Ref_Document_Status (document_status_code),\nFOREIGN KEY (shipping_agent_code) REFERENCES Ref_Shipping_Agents (shipping_agent_code)\n);\nCREATE TABLE Documents_Mailed (\ndocument_id INTEGER NOT NULL,\nmailed_to_address_id INTEGER NOT NULL,\nmailing_date DATETIME,\nPRIMARY KEY (document_id, mailed_to_address_id),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id),\nFOREIGN KEY (mailed_to_address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Draft_Copies (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number),\nFOREIGN KEY (document_id, draft_number) REFERENCES Document_Drafts (document_id,draft_number)\n);\nCREATE TABLE Employees (\nemployee_id INTEGER NOT NULL,\nrole_code CHAR(15) NOT NULL,\nemployee_name VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (employee_id),\nFOREIGN KEY (role_code) REFERENCES Roles (role_code)\n);\nCREATE TABLE Ref_Document_Status (\ndocument_status_code CHAR(15) NOT NULL,\ndocument_status_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_status_code)\n);\nCREATE TABLE Ref_Document_Types (\ndocument_type_code CHAR(15) NOT NULL,\ndocument_type_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_type_code)\n);\nCREATE TABLE Ref_Shipping_Agents (\nshipping_agent_code CHAR(15) NOT NULL,\nshipping_agent_name VARCHAR(255) NOT NULL,\nshipping_agent_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (shipping_agent_code)\n);\nCREATE TABLE Roles (\nrole_code CHAR(15) NOT NULL,\nrole_description VARCHAR(255),\nPRIMARY KEY (role_code)\n);"} {"qid": "gate_0091", "split": "gate_large", "db_id": "student_1", "question": "Find the number of students taught by TARRING LEIA.", "gold_sql": "SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"TARRING\" AND T2.lastname = \"LEIA\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0092", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the average share count of transactions for different investors.", "gold_sql": "SELECT investor_id , avg(share_count) FROM TRANSACTIONS GROUP BY investor_id", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0093", "split": "gate_large", "db_id": "race_track", "question": "Return the names of tracks that have no had any races.", "gold_sql": "SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0094", "split": "gate_large", "db_id": "farm", "question": "Give the years and official names of the cities of each competition.", "gold_sql": "SELECT T2.Year , T1.Official_Name FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0095", "split": "gate_large", "db_id": "product_catalog", "question": "Find the name and capacity of products with price greater than 700 (in USD).", "gold_sql": "SELECT catalog_entry_name , capacity FROM Catalog_Contents WHERE price_in_dollars > 700", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0096", "split": "gate_large", "db_id": "customer_complaints", "question": "What are lines 1 and 2 of the addressed of the customer with the email \"vbogisich@example.org\"?", "gold_sql": "SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = \"vbogisich@example.org\"", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0097", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Return the id and full name of the customer who has the fewest accounts.", "gold_sql": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) ASC LIMIT 1", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0098", "split": "gate_large", "db_id": "manufacturer", "question": "what is the average number of factories and maximum number of shops for manufacturers that opened before 1990.", "gold_sql": "SELECT max(num_of_shops) , avg(Num_of_Factories) FROM manufacturer WHERE open_year < 1990", "db_path": "databases/manufacturer/manufacturer.sqlite", "schema": "CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);\nCREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);\nCREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);"} {"qid": "gate_0099", "split": "gate_large", "db_id": "manufactory_1", "question": "What is the headquarter of the company whose founder is James?", "gold_sql": "SELECT headquarter FROM manufacturers WHERE founder = 'James'", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0100", "split": "gate_large", "db_id": "store_product", "question": "Find all types of store and number of them.", "gold_sql": "SELECT TYPE , count(*) FROM store GROUP BY TYPE", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0101", "split": "gate_large", "db_id": "candidate_poll", "question": "Which poll resource provided the most number of candidate information?", "gold_sql": "SELECT poll_source FROM candidate GROUP BY poll_source ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0102", "split": "gate_large", "db_id": "machine_repair", "question": "What are the teams with the most technicians?", "gold_sql": "SELECT Team FROM technician GROUP BY Team ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0103", "split": "gate_large", "db_id": "student_1", "question": "Report the first name and last name of all the students.", "gold_sql": "SELECT DISTINCT firstname , lastname FROM list", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0104", "split": "gate_large", "db_id": "customers_card_transactions", "question": "What is the average and total transaction amount?", "gold_sql": "SELECT avg(transaction_amount) , sum(transaction_amount) FROM Financial_transactions", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0105", "split": "gate_large", "db_id": "student_1", "question": "Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names.", "gold_sql": "SELECT DISTINCT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname , T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"OTHA\" AND T2.lastname = \"MOYER\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0106", "split": "gate_large", "db_id": "film_rank", "question": "How many markets have number of cities smaller than 300?", "gold_sql": "SELECT count(*) FROM market WHERE Number_cities < 300", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0107", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the transaction type code that occurs the fewest times.", "gold_sql": "SELECT transaction_type_code FROM TRANSACTIONS GROUP BY transaction_type_code ORDER BY COUNT(*) ASC LIMIT 1", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0108", "split": "gate_large", "db_id": "student_1", "question": "For each classroom, show the classroom number and count the number of distinct grades that use the room.", "gold_sql": "SELECT classroom , count(DISTINCT grade) FROM list GROUP BY classroom", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0109", "split": "gate_large", "db_id": "student_1", "question": "Find the number of teachers who teach the student called MADLOCK RAY.", "gold_sql": "SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"MADLOCK\" AND T1.lastname = \"RAY\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0110", "split": "gate_large", "db_id": "hr_1", "question": "display all the details from Employees table for those employees who was hired before 2002-06-21.", "gold_sql": "SELECT * FROM employees WHERE hire_date < '2002-06-21'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0111", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What are the different names, locations, and products of the enzymes that are capable inhibitor interactions?", "gold_sql": "SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0112", "split": "gate_large", "db_id": "game_1", "question": "Show ids of students who play video game and play sports.", "gold_sql": "SELECT StuID FROM Sportsinfo INTERSECT SELECT StuID FROM Plays_games", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0113", "split": "gate_large", "db_id": "club_1", "question": "Find the number of clubs where \"Tracy Kim\" is a member.", "gold_sql": "SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = \"Tracy\" AND t3.lname = \"Kim\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0114", "split": "gate_large", "db_id": "inn_1", "question": "Return the name, rate, check in and check out date for the room with the highest rate.", "gold_sql": "SELECT T2.roomName , T1.Rate , T1.CheckIn , T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0115", "split": "gate_large", "db_id": "club_1", "question": "Retrieve the average age of members of the club \"Tennis Club\".", "gold_sql": "SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = \"Tennis Club\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0116", "split": "gate_large", "db_id": "culture_company", "question": "How many movie directors are there?", "gold_sql": "SELECT COUNT (DISTINCT director) FROM movie", "db_path": "databases/culture_company/culture_company.sqlite", "schema": "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);\nCREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);\nCREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);"} {"qid": "gate_0117", "split": "gate_large", "db_id": "game_1", "question": "What type of game is Call of Destiny?", "gold_sql": "SELECT gtype FROM Video_games WHERE gname = \"Call of Destiny\"", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0118", "split": "gate_large", "db_id": "machine_repair", "question": "List the names of technicians in ascending order of age.", "gold_sql": "SELECT Name FROM technician ORDER BY Age ASC", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0119", "split": "gate_large", "db_id": "ship_1", "question": "What are the ranks of captains that are both in the Cutter and Armed schooner classes?", "gold_sql": "SELECT rank FROM captain WHERE CLASS = 'Cutter' INTERSECT SELECT rank FROM captain WHERE CLASS = 'Armed schooner'", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0120", "split": "gate_large", "db_id": "school_bus", "question": "Show the school name and driver name for all school buses.", "gold_sql": "SELECT T2.school , T3.name FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id JOIN driver AS T3 ON T1.driver_id = T3.driver_id", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0121", "split": "gate_large", "db_id": "sakila_1", "question": "How many stores are there?", "gold_sql": "SELECT count(*) FROM store", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0122", "split": "gate_large", "db_id": "inn_1", "question": "Find the name of rooms booked by some customers whose first name contains ROY.", "gold_sql": "SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0123", "split": "gate_large", "db_id": "formula_1", "question": "Find the forename and surname of drivers whose nationality is German?", "gold_sql": "SELECT forename , surname FROM drivers WHERE nationality = \"German\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0124", "split": "gate_large", "db_id": "small_bank_1", "question": "Find the number of accounts with a savings balance that is higher than the average savings balance.", "gold_sql": "SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings)", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0125", "split": "gate_large", "db_id": "candidate_poll", "question": "list all female (sex is F) candidate names in the alphabetical order.", "gold_sql": "SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0126", "split": "gate_large", "db_id": "manufactory_1", "question": "What is all the information of all the products that have a price between 60 and 120?", "gold_sql": "SELECT * FROM products WHERE price BETWEEN 60 AND 120", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0127", "split": "gate_large", "db_id": "ship_1", "question": "How many captains are in each rank?", "gold_sql": "SELECT count(*) , rank FROM captain GROUP BY rank", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0128", "split": "gate_large", "db_id": "store_product", "question": "What is the maximum page size for everything that has more than 3 products listed?", "gold_sql": "SELECT max_page_size FROM product GROUP BY max_page_size HAVING count(*) > 3", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0129", "split": "gate_large", "db_id": "customers_card_transactions", "question": "How many accounts does the customer with first name Art and last name Turcotte have?", "gold_sql": "SELECT count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Art\" AND T2.customer_last_name = \"Turcotte\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0130", "split": "gate_large", "db_id": "formula_1", "question": "What is the maximum fastest lap speed in the Monaco Grand Prix in 2008?", "gold_sql": "SELECT max(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = \"Monaco Grand Prix\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0131", "split": "gate_large", "db_id": "machine_repair", "question": "What are the team and starting year of technicians?", "gold_sql": "SELECT Team , Starting_Year FROM technician", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0132", "split": "gate_large", "db_id": "perpetrator", "question": "In which year did the most recent crime happen?", "gold_sql": "SELECT max(YEAR) FROM perpetrator;", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0133", "split": "gate_large", "db_id": "small_bank_1", "question": "Find the name and total checking and savings balance of the accounts whose savings balance is lower than corresponding checking balance.", "gold_sql": "SELECT T1.name , T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0134", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Tell me the number of orders with \"Second time\" as order detail.", "gold_sql": "SELECT count(*) FROM customer_orders WHERE order_details = \"Second time\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0135", "split": "gate_large", "db_id": "hr_1", "question": "What are the full names and salaries for any employees earning less than 6000?", "gold_sql": "SELECT first_name , last_name , salary FROM employees WHERE salary < 6000", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0136", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show the number of card types.", "gold_sql": "SELECT count(DISTINCT card_type_code) FROM Customers_Cards", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0137", "split": "gate_large", "db_id": "customers_and_addresses", "question": "How many customers are living in city \"Lake Geovannyton\"?", "gold_sql": "SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = \"Lake Geovannyton\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0138", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What are the names and trade names of the medicines which has 'Yes' value in the FDA record?", "gold_sql": "SELECT name , trade_name FROM medicine WHERE FDA_approved = 'Yes'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0139", "split": "gate_large", "db_id": "store_product", "question": "Find the names of all stores in Khanewal District.", "gold_sql": "SELECT t1.store_name FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id WHERE t3.district_name = \"Khanewal District\"", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0140", "split": "gate_large", "db_id": "small_bank_1", "question": "What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?", "gold_sql": "SELECT T1.name , T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0141", "split": "gate_large", "db_id": "race_track", "question": "Count the number of tracks.", "gold_sql": "SELECT count(*) FROM track", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0142", "split": "gate_large", "db_id": "pilot_record", "question": "List the names of pilots that do not have any record.", "gold_sql": "SELECT Pilot_name FROM pilot WHERE Pilot_ID NOT IN (SELECT Pilot_ID FROM pilot_record)", "db_path": "databases/pilot_record/pilot_record.sqlite", "schema": "CREATE TABLE \"aircraft\" (\n\"Aircraft_ID\" int,\n\"Order_Year\" int,\n\"Manufacturer\" text,\n\"Model\" text,\n\"Fleet_Series\" text,\n\"Powertrain\" text,\n\"Fuel_Propulsion\" text,\nPRIMARY KEY (\"Aircraft_ID\")\n);\nCREATE TABLE \"pilot\" (\n\"Pilot_ID\" int,\n\"Pilot_name\" text,\n\"Rank\" int,\n\"Age\" int,\n\"Nationality\" text,\n\"Position\" text,\n\"Join_Year\" int,\n\"Team\" text,\nPRIMARY KEY (\"Pilot_ID\")\n);\nCREATE TABLE \"pilot_record\" (\n\"Record_ID\" int,\n\"Pilot_ID\" int,\n\"Aircraft_ID\" int,\n\"Date\" text,\nPRIMARY KEY (\"Pilot_ID\", \"Aircraft_ID\", \"Date\"),\nFOREIGN KEY (`Pilot_ID`) REFERENCES `pilot`(`Pilot_ID`),\nFOREIGN KEY (`Aircraft_ID`) REFERENCES `aircraft`(`Aircraft_ID`)\n);"} {"qid": "gate_0143", "split": "gate_large", "db_id": "race_track", "question": "Show all track names that have had no races.", "gold_sql": "SELECT name FROM track WHERE track_id NOT IN (SELECT track_id FROM race)", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0144", "split": "gate_large", "db_id": "soccer_1", "question": "Who are the top 3 players in terms of overall rating?", "gold_sql": "SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id ORDER BY overall_rating DESC LIMIT 3", "db_path": "databases/soccer_1/soccer_1.sqlite", "schema": "CREATE TABLE `Country` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`name`\tTEXT UNIQUE\n);\nCREATE TABLE `League` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`country_id`\tINTEGER,\n\t`name`\tTEXT UNIQUE,\n\tFOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)\n);\nCREATE TABLE `Player` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_api_id`\tINTEGER UNIQUE,\n\t`player_name`\tTEXT,\n\t`player_fifa_api_id`\tINTEGER UNIQUE,\n\t`birthday`\tTEXT,\n\t`height`\tINTEGER,\n\t`weight`\tINTEGER\n);\nCREATE TABLE \"Player_Attributes\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_fifa_api_id`\tINTEGER,\n\t`player_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`overall_rating`\tINTEGER,\n\t`potential`\tINTEGER,\n\t`preferred_foot`\tTEXT,\n\t`attacking_work_rate`\tTEXT,\n\t`defensive_work_rate`\tTEXT,\n\t`crossing`\tINTEGER,\n\t`finishing`\tINTEGER,\n\t`heading_accuracy`\tINTEGER,\n\t`short_passing`\tINTEGER,\n\t`volleys`\tINTEGER,\n\t`dribbling`\tINTEGER,\n\t`curve`\tINTEGER,\n\t`free_kick_accuracy`\tINTEGER,\n\t`long_passing`\tINTEGER,\n\t`ball_control`\tINTEGER,\n\t`acceleration`\tINTEGER,\n\t`sprint_speed`\tINTEGER,\n\t`agility`\tINTEGER,\n\t`reactions`\tINTEGER,\n\t`balance`\tINTEGER,\n\t`shot_power`\tINTEGER,\n\t`jumping`\tINTEGER,\n\t`stamina`\tINTEGER,\n\t`strength`\tINTEGER,\n\t`long_shots`\tINTEGER,\n\t`aggression`\tINTEGER,\n\t`interceptions`\tINTEGER,\n\t`positioning`\tINTEGER,\n\t`vision`\tINTEGER,\n\t`penalties`\tINTEGER,\n\t`marking`\tINTEGER,\n\t`standing_tackle`\tINTEGER,\n\t`sliding_tackle`\tINTEGER,\n\t`gk_diving`\tINTEGER,\n\t`gk_handling`\tINTEGER,\n\t`gk_kicking`\tINTEGER,\n\t`gk_positioning`\tINTEGER,\n\t`gk_reflexes`\tINTEGER,\n\tFOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),\n\tFOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)\n);\nCREATE TABLE \"Team\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_api_id`\tINTEGER UNIQUE,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_long_name`\tTEXT,\n\t`team_short_name`\tTEXT\n);\nCREATE TABLE `Team_Attributes` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`buildUpPlaySpeed`\tINTEGER,\n\t`buildUpPlaySpeedClass`\tTEXT,\n\t`buildUpPlayDribbling`\tINTEGER,\n\t`buildUpPlayDribblingClass`\tTEXT,\n\t`buildUpPlayPassing`\tINTEGER,\n\t`buildUpPlayPassingClass`\tTEXT,\n\t`buildUpPlayPositioningClass`\tTEXT,\n\t`chanceCreationPassing`\tINTEGER,\n\t`chanceCreationPassingClass`\tTEXT,\n\t`chanceCreationCrossing`\tINTEGER,\n\t`chanceCreationCrossingClass`\tTEXT,\n\t`chanceCreationShooting`\tINTEGER,\n\t`chanceCreationShootingClass`\tTEXT,\n\t`chanceCreationPositioningClass`\tTEXT,\n\t`defencePressure`\tINTEGER,\n\t`defencePressureClass`\tTEXT,\n\t`defenceAggression`\tINTEGER,\n\t`defenceAggressionClass`\tTEXT,\n\t`defenceTeamWidth`\tINTEGER,\n\t`defenceTeamWidthClass`\tTEXT,\n\t`defenceDefenderLineClass`\tTEXT,\n\tFOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),\n\tFOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)\n);\nCREATE TABLE sqlite_sequence(name,seq);"} {"qid": "gate_0145", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Who made the latest order?", "gold_sql": "SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.order_date DESC LIMIT 1", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0146", "split": "gate_large", "db_id": "customer_complaints", "question": "What is the last name of the staff member in charge of the complaint on the product with the lowest price?", "gold_sql": "SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0147", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What are all the payment methods?", "gold_sql": "SELECT DISTINCT payment_method FROM customers", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0148", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Find the names of customers who never placed an order.", "gold_sql": "SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0149", "split": "gate_large", "db_id": "manufacturer", "question": "Find the market shares and names of furnitures which no any company is producing in our records.", "gold_sql": "SELECT Market_Rate , name FROM furniture WHERE Furniture_ID NOT IN (SELECT Furniture_ID FROM furniture_manufacte)", "db_path": "databases/manufacturer/manufacturer.sqlite", "schema": "CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);\nCREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);\nCREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);"} {"qid": "gate_0150", "split": "gate_large", "db_id": "party_people", "question": "Count the number of Annual Meeting events that took place in the region of the United Kingdom.", "gold_sql": "SELECT count(*) FROM region AS t1 JOIN party AS t2 ON t1.region_id = t2.region_id JOIN party_events AS t3 ON t2.party_id = t3.party_id WHERE t1.region_name = \"United Kingdom\" AND t3.Event_Name = \"Annaual Meeting\"", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0151", "split": "gate_large", "db_id": "school_bus", "question": "How many drivers are from Hartford city or younger than 40?", "gold_sql": "SELECT count(*) FROM driver WHERE home_city = 'Hartford' OR age < 40", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0152", "split": "gate_large", "db_id": "train_station", "question": "Show all locations with only 1 station.", "gold_sql": "SELECT LOCATION FROM station GROUP BY LOCATION HAVING count(*) = 1", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0153", "split": "gate_large", "db_id": "film_rank", "question": "List the studios of each film and the number of films produced by that studio.", "gold_sql": "SELECT Studio , COUNT(*) FROM film GROUP BY Studio", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0154", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?", "gold_sql": "SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0155", "split": "gate_large", "db_id": "candidate_poll", "question": "How many candidates are there?", "gold_sql": "SELECT count(*) FROM candidate", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0156", "split": "gate_large", "db_id": "student_1", "question": "Find the number of teachers who teach the student called CHRISSY NABOZNY.", "gold_sql": "SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = \"CHRISSY\" AND T1.lastname = \"NABOZNY\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0157", "split": "gate_large", "db_id": "sakila_1", "question": "Return the full name of the customer who made the first rental.", "gold_sql": "SELECT T1.first_name , T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0158", "split": "gate_large", "db_id": "party_people", "question": "Show the ministers and the time they took and left office, listed by the time they left office.", "gold_sql": "SELECT minister , took_office , left_office FROM party ORDER BY left_office", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0159", "split": "gate_large", "db_id": "sakila_1", "question": "What was the date of the earliest payment?", "gold_sql": "SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0160", "split": "gate_large", "db_id": "wedding", "question": "How many female people are older than 30 in our record?", "gold_sql": "SELECT count(*) FROM people WHERE is_male = 'F' AND age > 30", "db_path": "databases/wedding/wedding.sqlite", "schema": "CREATE TABLE \"church\" (\n\"Church_ID\" int,\n\"Name\" text,\n\"Organized_by\" text,\n\"Open_Date\" int,\n\"Continuation_of\" text,\nPRIMARY KEY (\"Church_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Is_Male\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"wedding\" (\n\"Church_ID\" int,\n\"Male_ID\" int,\n\"Female_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Church_ID\",\"Male_ID\",\"Female_ID\"),\nFOREIGN KEY (\"Church_ID\") REFERENCES `church`(\"Church_ID\"),\nFOREIGN KEY (\"Male_ID\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Female_ID\") REFERENCES `people`(\"People_ID\")\n);"} {"qid": "gate_0161", "split": "gate_large", "db_id": "insurance_fnol", "question": "Find the names of customers who have used either the service \"Close a policy\" or the service \"Upgrade a policy\".", "gold_sql": "SELECT t1.customer_name FROM customers AS t1 JOIN first_notification_of_loss AS t2 ON t1.customer_id = t2.customer_id JOIN services AS t3 ON t2.service_id = t3.service_id WHERE t3.service_name = \"Close a policy\" OR t3.service_name = \"Upgrade a policy\"", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0162", "split": "gate_large", "db_id": "ship_1", "question": "What are the different ship flags, and how many ships have each?", "gold_sql": "SELECT count(*) , flag FROM ship GROUP BY flag", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0163", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Which payment method is used by most customers?", "gold_sql": "SELECT payment_method FROM customers GROUP BY payment_method ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0164", "split": "gate_large", "db_id": "manufacturer", "question": "Find the name and component amount of the least popular furniture.", "gold_sql": "SELECT name , Num_of_Component FROM furniture ORDER BY market_rate LIMIT 1", "db_path": "databases/manufacturer/manufacturer.sqlite", "schema": "CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);\nCREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);\nCREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);"} {"qid": "gate_0165", "split": "gate_large", "db_id": "customer_complaints", "question": "Find the last name of the staff member who processed the complaint of the cheapest product.", "gold_sql": "SELECT t1.last_name FROM staff AS t1 JOIN complaints AS t2 ON t1.staff_id = t2.staff_id JOIN products AS t3 ON t2.product_id = t3.product_id ORDER BY t3.product_price LIMIT 1", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0166", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What is the type of interaction for the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?", "gold_sql": "SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0167", "split": "gate_large", "db_id": "insurance_fnol", "question": "What are the open and close dates of all the policies used by the customer who have \"Diana\" in part of their names?", "gold_sql": "SELECT t2.date_opened , t2.date_closed FROM customers AS t1 JOIN customers_policies AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name LIKE \"%Diana%\"", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0168", "split": "gate_large", "db_id": "student_1", "question": "Report the number of students in each classroom.", "gold_sql": "SELECT classroom , count(*) FROM list GROUP BY classroom", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0169", "split": "gate_large", "db_id": "race_track", "question": "What are the names of different tracks, and how many races has each had?", "gold_sql": "SELECT T2.name , count(*) FROM race AS T1 JOIN track AS T2 ON T1.track_id = T2.track_id GROUP BY T1.track_id", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0170", "split": "gate_large", "db_id": "perpetrator", "question": "What are the countries of perpetrators? Show each country and the corresponding number of perpetrators there.", "gold_sql": "SELECT Country , COUNT(*) FROM perpetrator GROUP BY Country", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0171", "split": "gate_large", "db_id": "race_track", "question": "Show names and seatings, ordered by seating for all tracks opened after 2000.", "gold_sql": "SELECT name , seating FROM track WHERE year_opened > 2000 ORDER BY seating", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0172", "split": "gate_large", "db_id": "farm", "question": "What is the official name and status of the city with the most residents?", "gold_sql": "SELECT Official_Name , Status FROM city ORDER BY Population DESC LIMIT 1", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0173", "split": "gate_large", "db_id": "university_basketball", "question": "What is the total and minimum enrollment of all schools?", "gold_sql": "SELECT sum(enrollment) , min(enrollment) FROM university", "db_path": "databases/university_basketball/university_basketball.sqlite", "schema": "CREATE TABLE \"basketball_match\" (\n\"Team_ID\" int,\n\"School_ID\" int,\n\"Team_Name\" text,\n\"ACC_Regular_Season\" text,\n\"ACC_Percent\" text,\n\"ACC_Home\" text,\n\"ACC_Road\" text,\n\"All_Games\" text,\n\"All_Games_Percent\" int,\n\"All_Home\" text,\n\"All_Road\" text,\n\"All_Neutral\" text,\nPRIMARY KEY (\"Team_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)\n);\nCREATE TABLE \"university\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Affiliation\" text,\n\"Enrollment\" real,\n\"Nickname\" text,\n\"Primary_conference\" text,\nPRIMARY KEY (\"School_ID\")\n);"} {"qid": "gate_0174", "split": "gate_large", "db_id": "twitter_1", "question": "Find the id of users who are followed by Mary or Susan.", "gold_sql": "SELECT T2.f1 FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f2 WHERE T1.name = \"Mary\" OR T1.name = \"Susan\"", "db_path": "databases/twitter_1/twitter_1.sqlite", "schema": "CREATE TABLE `follows` (\n `f1` int(11) NOT NULL,\n `f2` int(11) NOT NULL,\n PRIMARY KEY (`f1`,`f2`),\n FOREIGN KEY (`f1`) REFERENCES `user_profiles`(`uid`),\n FOREIGN KEY (`f2`) REFERENCES `user_profiles`(`uid`)\n\n);\nCREATE TABLE `tweets` (\n `id` bigint(20) NOT NULL,\n `uid` int(11) NOT NULL,\n `text` char(140) NOT NULL,\n `createdate` datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (`id`),\n FOREIGN KEY (`uid`) REFERENCES `user_profiles`(`uid`)\n);\nCREATE TABLE \"user_profiles\" (`uid` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `partitionid` int(11) DEFAULT NULL, `followers` int(11) DEFAULT NULL, PRIMARY KEY (`uid`));"} {"qid": "gate_0175", "split": "gate_large", "db_id": "customer_complaints", "question": "Find the address line 1 and 2 of the customer with email \"vbogisich@example.org\".", "gold_sql": "SELECT address_line_1 , address_line_2 FROM customers WHERE email_address = \"vbogisich@example.org\"", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0176", "split": "gate_large", "db_id": "inn_1", "question": "Find the number of kids staying in the rooms reserved by a person called ROY SWEAZ.", "gold_sql": "SELECT kids FROM Reservations WHERE FirstName = \"ROY\" AND LastName = \"SWEAZY\";", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0177", "split": "gate_large", "db_id": "hr_1", "question": "What are the full names, departments, cities, and state provinces for each employee?", "gold_sql": "SELECT T1.first_name , T1.last_name , T2.department_name , T3.city , T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0178", "split": "gate_large", "db_id": "tracking_orders", "question": "Find the name of the customers who have at most two orders.", "gold_sql": "SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*) <= 2", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0179", "split": "gate_large", "db_id": "hr_1", "question": "What is the first name and job id for all employees in the Finance department?", "gold_sql": "SELECT T1.first_name , T1.job_id FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T2.department_name = 'Finance'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0180", "split": "gate_large", "db_id": "hr_1", "question": "What are all the employee ids and the names of the countries in which they work?", "gold_sql": "SELECT T1.employee_id , T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0181", "split": "gate_large", "db_id": "hr_1", "question": "display those employees who joined after 7th September, 1987.", "gold_sql": "SELECT * FROM employees WHERE hire_date > '1987-09-07'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0182", "split": "gate_large", "db_id": "sakila_1", "question": "Return the most common full name among all actors.", "gold_sql": "SELECT first_name , last_name FROM actor GROUP BY first_name , last_name ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0183", "split": "gate_large", "db_id": "product_catalog", "question": "Find the names of catalog entries with level number 8.", "gold_sql": "SELECT t1.catalog_entry_name FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = \"8\"", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0184", "split": "gate_large", "db_id": "ship_1", "question": "What are the names, classes, and ranks of all captains?", "gold_sql": "SELECT name , CLASS , rank FROM captain", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0185", "split": "gate_large", "db_id": "game_1", "question": "What are the ids of all students along with how many sports and games did they play?", "gold_sql": "SELECT StuID , count(*) , sum(gamesplayed) FROM Sportsinfo GROUP BY StuID", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0186", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Find the number of customers who live in the city called Lake Geovannyton.", "gold_sql": "SELECT count(*) FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.city = \"Lake Geovannyton\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0187", "split": "gate_large", "db_id": "small_bank_1", "question": "Find the total saving balance for each account name.", "gold_sql": "SELECT sum(T2.balance) , T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid GROUP BY T1.name", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0188", "split": "gate_large", "db_id": "sakila_1", "question": "Return the titles of any movies with an R rating.", "gold_sql": "SELECT title FROM film WHERE rating = 'R'", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0189", "split": "gate_large", "db_id": "soccer_1", "question": "List all of the player ids with a height of at least 180cm and an overall rating higher than 85.", "gold_sql": "SELECT player_api_id FROM Player WHERE height >= 180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating > 85", "db_path": "databases/soccer_1/soccer_1.sqlite", "schema": "CREATE TABLE `Country` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`name`\tTEXT UNIQUE\n);\nCREATE TABLE `League` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`country_id`\tINTEGER,\n\t`name`\tTEXT UNIQUE,\n\tFOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)\n);\nCREATE TABLE `Player` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_api_id`\tINTEGER UNIQUE,\n\t`player_name`\tTEXT,\n\t`player_fifa_api_id`\tINTEGER UNIQUE,\n\t`birthday`\tTEXT,\n\t`height`\tINTEGER,\n\t`weight`\tINTEGER\n);\nCREATE TABLE \"Player_Attributes\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_fifa_api_id`\tINTEGER,\n\t`player_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`overall_rating`\tINTEGER,\n\t`potential`\tINTEGER,\n\t`preferred_foot`\tTEXT,\n\t`attacking_work_rate`\tTEXT,\n\t`defensive_work_rate`\tTEXT,\n\t`crossing`\tINTEGER,\n\t`finishing`\tINTEGER,\n\t`heading_accuracy`\tINTEGER,\n\t`short_passing`\tINTEGER,\n\t`volleys`\tINTEGER,\n\t`dribbling`\tINTEGER,\n\t`curve`\tINTEGER,\n\t`free_kick_accuracy`\tINTEGER,\n\t`long_passing`\tINTEGER,\n\t`ball_control`\tINTEGER,\n\t`acceleration`\tINTEGER,\n\t`sprint_speed`\tINTEGER,\n\t`agility`\tINTEGER,\n\t`reactions`\tINTEGER,\n\t`balance`\tINTEGER,\n\t`shot_power`\tINTEGER,\n\t`jumping`\tINTEGER,\n\t`stamina`\tINTEGER,\n\t`strength`\tINTEGER,\n\t`long_shots`\tINTEGER,\n\t`aggression`\tINTEGER,\n\t`interceptions`\tINTEGER,\n\t`positioning`\tINTEGER,\n\t`vision`\tINTEGER,\n\t`penalties`\tINTEGER,\n\t`marking`\tINTEGER,\n\t`standing_tackle`\tINTEGER,\n\t`sliding_tackle`\tINTEGER,\n\t`gk_diving`\tINTEGER,\n\t`gk_handling`\tINTEGER,\n\t`gk_kicking`\tINTEGER,\n\t`gk_positioning`\tINTEGER,\n\t`gk_reflexes`\tINTEGER,\n\tFOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),\n\tFOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)\n);\nCREATE TABLE \"Team\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_api_id`\tINTEGER UNIQUE,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_long_name`\tTEXT,\n\t`team_short_name`\tTEXT\n);\nCREATE TABLE `Team_Attributes` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`buildUpPlaySpeed`\tINTEGER,\n\t`buildUpPlaySpeedClass`\tTEXT,\n\t`buildUpPlayDribbling`\tINTEGER,\n\t`buildUpPlayDribblingClass`\tTEXT,\n\t`buildUpPlayPassing`\tINTEGER,\n\t`buildUpPlayPassingClass`\tTEXT,\n\t`buildUpPlayPositioningClass`\tTEXT,\n\t`chanceCreationPassing`\tINTEGER,\n\t`chanceCreationPassingClass`\tTEXT,\n\t`chanceCreationCrossing`\tINTEGER,\n\t`chanceCreationCrossingClass`\tTEXT,\n\t`chanceCreationShooting`\tINTEGER,\n\t`chanceCreationShootingClass`\tTEXT,\n\t`chanceCreationPositioningClass`\tTEXT,\n\t`defencePressure`\tINTEGER,\n\t`defencePressureClass`\tTEXT,\n\t`defenceAggression`\tINTEGER,\n\t`defenceAggressionClass`\tTEXT,\n\t`defenceTeamWidth`\tINTEGER,\n\t`defenceTeamWidthClass`\tTEXT,\n\t`defenceDefenderLineClass`\tTEXT,\n\tFOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),\n\tFOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)\n);\nCREATE TABLE sqlite_sequence(name,seq);"} {"qid": "gate_0190", "split": "gate_large", "db_id": "farm", "question": "Count the number of farms.", "gold_sql": "SELECT count(*) FROM farm", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0191", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the most frequently ordered product? Tell me the detail of the product", "gold_sql": "SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0192", "split": "gate_large", "db_id": "train_station", "question": "What are the names of the stations which serve both \"Ananthapuri Express\" and \"Guruvayur Express\" trains?", "gold_sql": "SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = \"Ananthapuri Express\" INTERSECT SELECT T2.name FROM train_station AS T1 JOIN station AS T2 ON T1.station_id = T2.station_id JOIN train AS T3 ON T3.train_id = T1.train_id WHERE T3.Name = \"Guruvayur Express\"", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0193", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "How many different FDA approval statuses exist for medicines?", "gold_sql": "SELECT count(DISTINCT FDA_approved) FROM medicine", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0194", "split": "gate_large", "db_id": "culture_company", "question": "What is the title and director for the movie with highest worldwide gross in the year 2000 or before?", "gold_sql": "SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1", "db_path": "databases/culture_company/culture_company.sqlite", "schema": "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);\nCREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);\nCREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);"} {"qid": "gate_0195", "split": "gate_large", "db_id": "perpetrator", "question": "What are the names of perpetrators whose country is not \"China\"?", "gold_sql": "SELECT T1.Name FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Country != \"China\"", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0196", "split": "gate_large", "db_id": "party_people", "question": "How many events are there for each party?", "gold_sql": "SELECT T2.party_name , count(*) FROM party_events AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id GROUP BY T1.party_id", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0197", "split": "gate_large", "db_id": "game_1", "question": "What are the different types of video games?", "gold_sql": "SELECT DISTINCT gtype FROM Video_games", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0198", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What are the customer name and date of the orders whose status is \"Delivered\".", "gold_sql": "SELECT t1.customer_name , t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id WHERE order_status = \"Delivered\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0199", "split": "gate_large", "db_id": "club_1", "question": "Compute the average age of the members in the club \"Tennis Club\".", "gold_sql": "SELECT avg(t3.age) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = \"Tennis Club\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0200", "split": "gate_large", "db_id": "insurance_policies", "question": "Among all the claims, which settlements have a claimed amount that is no more than the average? List the claim start date.", "gold_sql": "SELECT Date_Claim_Made FROM Claims WHERE Amount_Settled <= ( SELECT avg(Amount_Settled) FROM Claims )", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0201", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show all investor details.", "gold_sql": "SELECT Investor_details FROM INVESTORS", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0202", "split": "gate_large", "db_id": "train_station", "question": "Show the name, time, and service for all trains.", "gold_sql": "SELECT name , TIME , service FROM train", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0203", "split": "gate_large", "db_id": "club_1", "question": "Find each student's first name.", "gold_sql": "SELECT DISTINCT fname FROM student", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0204", "split": "gate_large", "db_id": "party_people", "question": "Show all party names and their region names.", "gold_sql": "SELECT T1.party_name , T2.region_name FROM party AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id", "db_path": "databases/party_people/party_people.sqlite", "schema": "CREATE TABLE \"member\" (\n\"Member_ID\" int,\n\"Member_Name\" text,\n\"Party_ID\" text,\n\"In_office\" text,\nPRIMARY KEY (\"Member_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`)\n);\nCREATE TABLE \"party\" (\n\"Party_ID\" int,\n\"Minister\" text,\n\"Took_office\" text,\n\"Left_office\" text,\n\"Region_ID\" int,\n\"Party_name\" text,\nPRIMARY KEY (\"Party_ID\"),\nFOREIGN KEY (`Region_ID`) REFERENCES `region`(`Region_ID`)\n);\nCREATE TABLE \"party_events\" (\n\"Event_ID\" int,\n\"Event_Name\" text,\n\"Party_ID\" int,\n\"Member_in_charge_ID\" int,\nPRIMARY KEY (\"Event_ID\"),\nFOREIGN KEY (`Party_ID`) REFERENCES `party`(`Party_ID`),\nFOREIGN KEY (`Member_in_charge_ID`) REFERENCES `member`(`Member_ID`)\n);\nCREATE TABLE \"region\" (\n\"Region_ID\" int,\n\"Region_name\" text,\n\"Date\" text,\n\"Label\" text,\n\"Format\" text,\n\"Catalogue\" text,\nPRIMARY KEY (\"Region_ID\")\n);"} {"qid": "gate_0205", "split": "gate_large", "db_id": "school_bus", "question": "Show the type of school and the number of buses for each type.", "gold_sql": "SELECT T2.type , count(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.school_id = T2.school_id GROUP BY T2.type", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0206", "split": "gate_large", "db_id": "customer_complaints", "question": "What are the emails and phone numbers of custoemrs who have never filed a complaint?", "gold_sql": "SELECT email_address , phone_number FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM complaints)", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0207", "split": "gate_large", "db_id": "insurance_policies", "question": "What is the payment method that were used the least often?", "gold_sql": "SELECT Payment_Method_Code FROM Payments GROUP BY Payment_Method_Code ORDER BY count(*) ASC LIMIT 1", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0208", "split": "gate_large", "db_id": "product_catalog", "question": "Find all the catalog publishers whose name contains \"Murray\"", "gold_sql": "SELECT distinct(catalog_publisher) FROM catalogs WHERE catalog_publisher LIKE \"%Murray%\"", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0209", "split": "gate_large", "db_id": "product_catalog", "question": "Which catalog content has the highest height? Give me the catalog entry name.", "gold_sql": "SELECT catalog_entry_name FROM catalog_contents ORDER BY height DESC LIMIT 1", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0210", "split": "gate_large", "db_id": "university_basketball", "question": "When was the school with the largest enrollment founded?", "gold_sql": "SELECT founded FROM university ORDER BY enrollment DESC LIMIT 1", "db_path": "databases/university_basketball/university_basketball.sqlite", "schema": "CREATE TABLE \"basketball_match\" (\n\"Team_ID\" int,\n\"School_ID\" int,\n\"Team_Name\" text,\n\"ACC_Regular_Season\" text,\n\"ACC_Percent\" text,\n\"ACC_Home\" text,\n\"ACC_Road\" text,\n\"All_Games\" text,\n\"All_Games_Percent\" int,\n\"All_Home\" text,\n\"All_Road\" text,\n\"All_Neutral\" text,\nPRIMARY KEY (\"Team_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)\n);\nCREATE TABLE \"university\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Affiliation\" text,\n\"Enrollment\" real,\n\"Nickname\" text,\n\"Primary_conference\" text,\nPRIMARY KEY (\"School_ID\")\n);"} {"qid": "gate_0211", "split": "gate_large", "db_id": "manufactory_1", "question": "Find the number of products for each manufacturer, showing the name of each company.", "gold_sql": "SELECT count(*) , T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code GROUP BY T2.name", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0212", "split": "gate_large", "db_id": "product_catalog", "question": "What are the catalog entry names of the products with next entry ID above 8?", "gold_sql": "SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0213", "split": "gate_large", "db_id": "student_1", "question": "Find the grade studying in room 105.", "gold_sql": "SELECT DISTINCT grade FROM list WHERE classroom = 105", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0214", "split": "gate_large", "db_id": "train_station", "question": "What is the average and maximum number of total passengers for train stations in London or Glasgow?", "gold_sql": "SELECT avg(total_passengers) , max(total_passengers) FROM station WHERE LOCATION = 'London' OR LOCATION = 'Glasgow'", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0215", "split": "gate_large", "db_id": "department_management", "question": "What are the distinct ages of the heads who are acting?", "gold_sql": "SELECT DISTINCT T1.age FROM management AS T2 JOIN head AS T1 ON T1.head_id = T2.head_id WHERE T2.temporary_acting = 'Yes'", "db_path": "databases/department_management/department_management.sqlite", "schema": "CREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name\" text,\n\"Creation\" text,\n\"Ranking\" int,\n\"Budget_in_Billions\" real,\n\"Num_Employees\" real,\nPRIMARY KEY (\"Department_ID\")\n);\nCREATE TABLE \"head\" (\n\"head_ID\" int,\n\"name\" text,\n\"born_state\" text,\n\"age\" real,\nPRIMARY KEY (\"head_ID\")\n);\nCREATE TABLE \"management\" (\n\"department_ID\" int,\n\"head_ID\" int,\n\"temporary_acting\" text,\nPRIMARY KEY (\"Department_ID\",\"head_ID\"),\nFOREIGN KEY (\"Department_ID\") REFERENCES `department`(\"Department_ID\"),\nFOREIGN KEY (\"head_ID\") REFERENCES `head`(\"head_ID\")\n);"} {"qid": "gate_0216", "split": "gate_large", "db_id": "hr_1", "question": "display the employee ID and job name for all those jobs in department 80.", "gold_sql": "SELECT T1.employee_id , T2.job_title FROM employees AS T1 JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.department_id = 80", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0217", "split": "gate_large", "db_id": "game_1", "question": "What are the names of all games played by Linda Smith?", "gold_sql": "SELECT Gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid JOIN Student AS T3 ON T3.Stuid = T1.Stuid WHERE T3.Lname = \"Smith\" AND T3.Fname = \"Linda\"", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0218", "split": "gate_large", "db_id": "manufactory_1", "question": "Find the total revenue of companies of each founder.", "gold_sql": "SELECT sum(revenue) , founder FROM manufacturers GROUP BY founder", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0219", "split": "gate_large", "db_id": "machine_repair", "question": "Show names of technicians who are assigned to repair machines with value point more than 70.", "gold_sql": "SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID WHERE T2.value_points > 70", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0220", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What are the ids and trade names of the medicine that can interact with at least 3 enzymes?", "gold_sql": "SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0221", "split": "gate_large", "db_id": "club_1", "question": "How many clubs are located at \"HHH\"?", "gold_sql": "SELECT count(*) FROM club WHERE clublocation = \"HHH\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0222", "split": "gate_large", "db_id": "candidate_poll", "question": "What are the names of people who are shorter than average?", "gold_sql": "SELECT name FROM people WHERE height < (SELECT avg(height) FROM people)", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0223", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the channel code and contact number of the customer contact channel that was active for the longest time?", "gold_sql": "SELECT channel_code , contact_number FROM customer_contact_channels WHERE active_to_date - active_from_date = (SELECT active_to_date - active_from_date FROM customer_contact_channels ORDER BY (active_to_date - active_from_date) DESC LIMIT 1)", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0224", "split": "gate_large", "db_id": "farm", "question": "What are the census rankings of cities that do not have the status \"Village\"?", "gold_sql": "SELECT Census_Ranking FROM city WHERE Status != \"Village\"", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0225", "split": "gate_large", "db_id": "formula_1", "question": "Find the names of Japanese constructors that have once earned more than 5 points?", "gold_sql": "SELECT T1.name FROM constructors AS T1 JOIN constructorstandings AS T2 ON T1.constructorid = T2.constructorid WHERE T1.nationality = \"Japanese\" AND T2.points > 5", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0226", "split": "gate_large", "db_id": "formula_1", "question": "What is the average fastest lap speed in race named 'Monaco Grand Prix' in 2008 ?", "gold_sql": "SELECT avg(T2.fastestlapspeed) FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid WHERE T1.year = 2008 AND T1.name = \"Monaco Grand Prix\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0227", "split": "gate_large", "db_id": "ship_1", "question": "Return the rank for which there are the fewest captains.", "gold_sql": "SELECT rank FROM captain GROUP BY rank ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0228", "split": "gate_large", "db_id": "pilot_record", "question": "Show the most common nationality of pilots.", "gold_sql": "SELECT Nationality FROM pilot GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/pilot_record/pilot_record.sqlite", "schema": "CREATE TABLE \"aircraft\" (\n\"Aircraft_ID\" int,\n\"Order_Year\" int,\n\"Manufacturer\" text,\n\"Model\" text,\n\"Fleet_Series\" text,\n\"Powertrain\" text,\n\"Fuel_Propulsion\" text,\nPRIMARY KEY (\"Aircraft_ID\")\n);\nCREATE TABLE \"pilot\" (\n\"Pilot_ID\" int,\n\"Pilot_name\" text,\n\"Rank\" int,\n\"Age\" int,\n\"Nationality\" text,\n\"Position\" text,\n\"Join_Year\" int,\n\"Team\" text,\nPRIMARY KEY (\"Pilot_ID\")\n);\nCREATE TABLE \"pilot_record\" (\n\"Record_ID\" int,\n\"Pilot_ID\" int,\n\"Aircraft_ID\" int,\n\"Date\" text,\nPRIMARY KEY (\"Pilot_ID\", \"Aircraft_ID\", \"Date\"),\nFOREIGN KEY (`Pilot_ID`) REFERENCES `pilot`(`Pilot_ID`),\nFOREIGN KEY (`Aircraft_ID`) REFERENCES `aircraft`(`Aircraft_ID`)\n);"} {"qid": "gate_0229", "split": "gate_large", "db_id": "hr_1", "question": "display the employee name ( first name and last name ) and hire date for all employees in the same department as Clara excluding Clara.", "gold_sql": "SELECT first_name , last_name , hire_date FROM employees WHERE department_id = ( SELECT department_id FROM employees WHERE first_name = \"Clara\") AND first_name != \"Clara\"", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0230", "split": "gate_large", "db_id": "sakila_1", "question": "Return the address and email of the customer with the first name Linda.", "gold_sql": "SELECT T2.address , T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0231", "split": "gate_large", "db_id": "hr_1", "question": "display the department id and the total salary for those departments which contains at least two employees.", "gold_sql": "SELECT department_id , SUM(salary) FROM employees GROUP BY department_id HAVING count(*) >= 2", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0232", "split": "gate_large", "db_id": "film_rank", "question": "What are the names of studios that have made two or more films?", "gold_sql": "SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0233", "split": "gate_large", "db_id": "train_station", "question": "Find the names of the trains that do not pass any station located in London.", "gold_sql": "SELECT T2.name FROM train_station AS T1 JOIN train AS T2 ON T1.train_id = T2.train_id WHERE T1.station_id NOT IN (SELECT T4.station_id FROM train_station AS T3 JOIN station AS T4 ON T3.station_id = T4.station_id WHERE t4.location = \"London\")", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0234", "split": "gate_large", "db_id": "manufactory_1", "question": "Select the name and price of the cheapest product.", "gold_sql": "SELECT name , price FROM Products ORDER BY price ASC LIMIT 1", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0235", "split": "gate_large", "db_id": "inn_1", "question": "What are the names of modern rooms that have a base price lower than $160 and two beds.", "gold_sql": "SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern';", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0236", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Find the number of investors in total.", "gold_sql": "SELECT count(*) FROM INVESTORS", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0237", "split": "gate_large", "db_id": "store_product", "question": "What are the district names and city populations for all districts that between 200,000 and 2,000,000 residents?", "gold_sql": "SELECT District_name , City_Population FROM district WHERE City_Population BETWEEN 200000 AND 2000000", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0238", "split": "gate_large", "db_id": "inn_1", "question": "For each room, find its name and the number of times reservations were made for it.", "gold_sql": "SELECT T2.roomName , count(*) , T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0239", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Which product's detail contains the word \"Latte\" or \"Americano\"? Return the full detail.", "gold_sql": "SELECT product_details FROM products WHERE product_details LIKE \"%Latte%\" OR product_details LIKE \"%Americano%\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0240", "split": "gate_large", "db_id": "manufactory_1", "question": "Select the average price of each manufacturer's products, showing the manufacturer's name.", "gold_sql": "SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0241", "split": "gate_large", "db_id": "store_product", "question": "Find the name all districts with city area greater than 10 or population larger than 100000", "gold_sql": "SELECT district_name FROM district WHERE city_area > 10 OR City_Population > 100000", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0242", "split": "gate_large", "db_id": "behavior_monitoring", "question": "How many distinct students have been in detention?", "gold_sql": "SELECT count(DISTINCT student_id) FROM Students_in_Detention", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0243", "split": "gate_large", "db_id": "student_1", "question": "Find the grade taught in classroom 103.", "gold_sql": "SELECT DISTINCT grade FROM list WHERE classroom = 103", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0244", "split": "gate_large", "db_id": "sakila_1", "question": "What are the title and id of the film which has a rental rate of 0.99 and an inventory of below 3?", "gold_sql": "SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING count(*) < 3", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0245", "split": "gate_large", "db_id": "university_basketball", "question": "Count the number of universities that do not participate in the baketball match.", "gold_sql": "SELECT count(*) FROM university WHERE school_id NOT IN (SELECT school_id FROM basketball_match)", "db_path": "databases/university_basketball/university_basketball.sqlite", "schema": "CREATE TABLE \"basketball_match\" (\n\"Team_ID\" int,\n\"School_ID\" int,\n\"Team_Name\" text,\n\"ACC_Regular_Season\" text,\n\"ACC_Percent\" text,\n\"ACC_Home\" text,\n\"ACC_Road\" text,\n\"All_Games\" text,\n\"All_Games_Percent\" int,\n\"All_Home\" text,\n\"All_Road\" text,\n\"All_Neutral\" text,\nPRIMARY KEY (\"Team_ID\"),\nFOREIGN KEY (`School_ID`) REFERENCES `university`(`School_ID`)\n);\nCREATE TABLE \"university\" (\n\"School_ID\" int,\n\"School\" text,\n\"Location\" text,\n\"Founded\" real,\n\"Affiliation\" text,\n\"Enrollment\" real,\n\"Nickname\" text,\n\"Primary_conference\" text,\nPRIMARY KEY (\"School_ID\")\n);"} {"qid": "gate_0246", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show the card type codes and the number of transactions.", "gold_sql": "SELECT T2.card_type_code , count(*) FROM Financial_transactions AS T1 JOIN Customers_cards AS T2 ON T1.card_id = T2.card_id GROUP BY T2.card_type_code", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0247", "split": "gate_large", "db_id": "machine_repair", "question": "Show the starting years shared by technicians from team \"CLE\" and \"CWS\".", "gold_sql": "SELECT Starting_Year FROM technician WHERE Team = \"CLE\" INTERSECT SELECT Starting_Year FROM technician WHERE Team = \"CWS\"", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0248", "split": "gate_large", "db_id": "customer_complaints", "question": "How many distinct complaint type codes are there in the database?", "gold_sql": "SELECT count(DISTINCT complaint_type_code) FROM complaints", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0249", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Retrieve the list of all cities.", "gold_sql": "SELECT DISTINCT city FROM addresses", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0250", "split": "gate_large", "db_id": "machine_repair", "question": "List the name of technicians whose team is not \"NYY\".", "gold_sql": "SELECT Name FROM technician WHERE Team != \"NYY\"", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0251", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Return the address content for the customer whose name is \"Maudie Kertzmann\".", "gold_sql": "SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = \"Maudie Kertzmann\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0252", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the name of the customer that made the order with the largest quantity?", "gold_sql": "SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id = t2.customer_id JOIN order_items AS t3 ON t2.order_id = t3.order_id WHERE t3.order_quantity = ( SELECT max(order_quantity) FROM order_items)", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0253", "split": "gate_large", "db_id": "insurance_policies", "question": "Find the total claimed amount of all the claims.", "gold_sql": "SELECT sum(Amount_Claimed) FROM Claims", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0254", "split": "gate_large", "db_id": "customer_complaints", "question": "Find the emails and phone numbers of all the customers, ordered by email address and phone number.", "gold_sql": "SELECT email_address , phone_number FROM customers ORDER BY email_address , phone_number", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0255", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Count the number of credit cards that the customer with first name Blanche and last name Huels has.", "gold_sql": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Blanche\" AND T2.customer_last_name = \"Huels\" AND T1.card_type_code = \"Credit\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0256", "split": "gate_large", "db_id": "manufactory_1", "question": "Select the names of manufacturer whose products have an average price higher than or equal to $150.", "gold_sql": "SELECT avg(T1.Price) , T2.name FROM products AS T1 JOIN Manufacturers AS T2 ON T1.manufacturer = T2.code GROUP BY T2.name HAVING avg(T1.price) >= 150", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0257", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show other account details for account with name 338.", "gold_sql": "SELECT other_account_details FROM Accounts WHERE account_name = \"338\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0258", "split": "gate_large", "db_id": "hr_1", "question": "What are the full name, hire data, salary and department id for employees without the letter M in their first name, ordered by ascending department id?", "gold_sql": "SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%' ORDER BY department_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0259", "split": "gate_large", "db_id": "manufactory_1", "question": "Find the name, headquarter and revenue of all manufacturers sorted by their revenue in the descending order.", "gold_sql": "SELECT name , headquarter , revenue FROM manufacturers ORDER BY revenue DESC", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0260", "split": "gate_large", "db_id": "inn_1", "question": "Find the id and name of the most expensive base price room.", "gold_sql": "SELECT RoomId , roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0261", "split": "gate_large", "db_id": "ship_1", "question": "what are the names and classes of the ships that do not have any captain yet?", "gold_sql": "SELECT name , CLASS FROM ship WHERE ship_id NOT IN (SELECT ship_id FROM captain)", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0262", "split": "gate_large", "db_id": "game_1", "question": "What is the total number of hours per work and number of games played by David Shieber?", "gold_sql": "SELECT sum(hoursperweek) , sum(gamesplayed) FROM Sportsinfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.Fname = \"David\" AND T2.Lname = \"Shieber\"", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0263", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What are the state and country of all the cities that have post codes starting with 4.\\", "gold_sql": "SELECT state_province_county , country FROM addresses WHERE zip_postcode LIKE \"4%\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0264", "split": "gate_large", "db_id": "tracking_orders", "question": "Which order has the most recent shipment? Give me the order id.", "gold_sql": "SELECT order_id FROM shipments WHERE shipment_date = (SELECT max(shipment_date) FROM shipments)", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0265", "split": "gate_large", "db_id": "inn_1", "question": "How many rooms have not had any reservation yet?", "gold_sql": "SELECT count(*) FROM rooms WHERE roomid NOT IN (SELECT DISTINCT room FROM reservations)", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0266", "split": "gate_large", "db_id": "hr_1", "question": "Display the first and last name, and salary for those employees whose first name is ending with the letter m.", "gold_sql": "SELECT first_name , last_name , salary FROM employees WHERE first_name LIKE '%m'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0267", "split": "gate_large", "db_id": "tracking_orders", "question": "What are the distinct customers who have orders with status \"On Road\"? Give me the customer details?", "gold_sql": "SELECT DISTINCT T1.customer_details FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = \"On Road\"", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0268", "split": "gate_large", "db_id": "perpetrator", "question": "What is the average number of people injured by all perpetrators?", "gold_sql": "SELECT avg(Injured) FROM perpetrator", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0269", "split": "gate_large", "db_id": "department_management", "question": "How many heads of the departments are older than 56 ?", "gold_sql": "SELECT count(*) FROM head WHERE age > 56", "db_path": "databases/department_management/department_management.sqlite", "schema": "CREATE TABLE \"department\" (\n\"Department_ID\" int,\n\"Name\" text,\n\"Creation\" text,\n\"Ranking\" int,\n\"Budget_in_Billions\" real,\n\"Num_Employees\" real,\nPRIMARY KEY (\"Department_ID\")\n);\nCREATE TABLE \"head\" (\n\"head_ID\" int,\n\"name\" text,\n\"born_state\" text,\n\"age\" real,\nPRIMARY KEY (\"head_ID\")\n);\nCREATE TABLE \"management\" (\n\"department_ID\" int,\n\"head_ID\" int,\n\"temporary_acting\" text,\nPRIMARY KEY (\"Department_ID\",\"head_ID\"),\nFOREIGN KEY (\"Department_ID\") REFERENCES `department`(\"Department_ID\"),\nFOREIGN KEY (\"head_ID\") REFERENCES `head`(\"head_ID\")\n);"} {"qid": "gate_0270", "split": "gate_large", "db_id": "customers_card_transactions", "question": "What are the ids and full names of customers who hold two or more cards?", "gold_sql": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0271", "split": "gate_large", "db_id": "film_rank", "question": "What are the maximum and minimum number of cities in all markets.", "gold_sql": "SELECT max(Number_cities) , min(Number_cities) FROM market", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0272", "split": "gate_large", "db_id": "sakila_1", "question": "What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'?", "gold_sql": "SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date > '2005-08-23 02:06:01' )", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0273", "split": "gate_large", "db_id": "culture_company", "question": "What are the titles, years, and directors of all movies, ordered by budget in millions?", "gold_sql": "SELECT title , YEAR , director FROM movie ORDER BY budget_million", "db_path": "databases/culture_company/culture_company.sqlite", "schema": "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);\nCREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);\nCREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);"} {"qid": "gate_0274", "split": "gate_large", "db_id": "manufacturer", "question": "Which manufacturer has the most number of shops? List its name and year of opening.", "gold_sql": "SELECT open_year , name FROM manufacturer ORDER BY num_of_shops DESC LIMIT 1", "db_path": "databases/manufacturer/manufacturer.sqlite", "schema": "CREATE TABLE \"furniture\" (\n \"Furniture_ID\" int,\n \"Name\" text,\n \"Num_of_Component\" int,\n \"Market_Rate\" real,\n PRIMARY KEY (\"Furniture_ID\")\n);\nCREATE TABLE \"furniture_manufacte\" (\n \"Manufacturer_ID\" int,\n \"Furniture_ID\" int,\n \"Price_in_Dollar\" real,\n PRIMARY KEY (\"Manufacturer_ID\",\"Furniture_ID\"),\n FOREIGN KEY (\"Manufacturer_ID\") REFERENCES `manufacturer`(\"Manufacturer_ID\"),\n FOREIGN KEY (\"Furniture_ID\") REFERENCES `furniture`(\"Furniture_ID\")\n);\nCREATE TABLE \"manufacturer\" (\n \"Manufacturer_ID\" int,\n \"Open_Year\" real,\n \"Name\" text,\n \"Num_of_Factories\" int,\n \"Num_of_Shops\" int,\n PRIMARY KEY (\"Manufacturer_ID\")\n);"} {"qid": "gate_0275", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What are the name and active date of the customers whose contact channel code is email?", "gold_sql": "SELECT t1.customer_name , t2.active_from_date FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email'", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0276", "split": "gate_large", "db_id": "ship_1", "question": "Which flag is most widely used among all ships?", "gold_sql": "SELECT flag FROM ship GROUP BY flag ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0277", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the description of the transaction type that occurs most frequently.", "gold_sql": "SELECT T1.transaction_type_description FROM Ref_Transaction_Types AS T1 JOIN TRANSACTIONS AS T2 ON T1.transaction_type_code = T2.transaction_type_code GROUP BY T1.transaction_type_code ORDER BY COUNT(*) DESC LIMIT 1", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0278", "split": "gate_large", "db_id": "product_catalog", "question": "Which catalog contents have a product stock number that starts from \"2\"? Show the catalog entry names.", "gold_sql": "SELECT catalog_entry_name FROM catalog_contents WHERE product_stock_number LIKE \"2%\"", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0279", "split": "gate_large", "db_id": "product_catalog", "question": "Find the entry name of the catalog with the highest price (in USD).", "gold_sql": "SELECT catalog_entry_name FROM catalog_contents ORDER BY price_in_dollars DESC LIMIT 1", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0280", "split": "gate_large", "db_id": "manufactory_1", "question": "What are the names of companies that do not make DVD drives?", "gold_sql": "SELECT name FROM manufacturers EXCEPT SELECT T2.name FROM products AS T1 JOIN manufacturers AS T2 ON T1.Manufacturer = T2.code WHERE T1.name = 'DVD drive'", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0281", "split": "gate_large", "db_id": "hr_1", "question": "What are the department ids for which more than 10 employees had a commission?", "gold_sql": "SELECT department_id FROM employees GROUP BY department_id HAVING COUNT(commission_pct) > 10", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0282", "split": "gate_large", "db_id": "hr_1", "question": "get the details of employees who manage a department.", "gold_sql": "SELECT DISTINCT * FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id WHERE T1.employee_id = T2.manager_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0283", "split": "gate_large", "db_id": "small_bank_1", "question": "How many accounts have a savings balance above the average savings balance?", "gold_sql": "SELECT count(*) FROM savings WHERE balance > (SELECT avg(balance) FROM savings)", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0284", "split": "gate_large", "db_id": "film_rank", "question": "Return the titles and directors of films that were never in the market of China.", "gold_sql": "SELECT title , director FROM film WHERE film_id NOT IN (SELECT film_id FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.Market_ID WHERE country = 'China')", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0285", "split": "gate_large", "db_id": "film_rank", "question": "List the names of studios that have at least two films.", "gold_sql": "SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2", "db_path": "databases/film_rank/film_rank.sqlite", "schema": "CREATE TABLE \"film\" (\n\"Film_ID\" int,\n\"Title\" text,\n\"Studio\" text,\n\"Director\" text,\n\"Gross_in_dollar\" int,\nPRIMARY KEY (\"Film_ID\")\n);\nCREATE TABLE \"film_market_estimation\" (\n\"Estimation_ID\" int,\n\"Low_Estimate\" real,\n\"High_Estimate\" real,\n\"Film_ID\" int,\n\"Type\" text,\n\"Market_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Estimation_ID\"),\nFOREIGN KEY (\"Film_ID\") REFERENCES film(\"Film_ID\"),\nFOREIGN KEY (\"Market_ID\") REFERENCES market(\"Market_ID\")\n);\nCREATE TABLE \"market\" (\n\"Market_ID\" int,\n\"Country\" text,\n\"Number_cities\" int,\nPRIMARY KEY (\"Market_ID\")\n);"} {"qid": "gate_0286", "split": "gate_large", "db_id": "small_bank_1", "question": "What are the balances of checking accounts belonging to people with savings balances greater than the average savings balance?", "gold_sql": "SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid = T2.custid WHERE T2.balance > (SELECT avg(balance) FROM savings))", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0287", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "How many medicines were not approved by the FDA?", "gold_sql": "SELECT count(*) FROM medicine WHERE FDA_approved = 'No'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0288", "split": "gate_large", "db_id": "inn_1", "question": "List how many times the number of people in the room reached the maximum occupancy of the room. The number of people include adults and kids.", "gold_sql": "SELECT count(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0289", "split": "gate_large", "db_id": "hr_1", "question": "What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000?", "gold_sql": "SELECT job_title , max_salary - min_salary FROM jobs WHERE max_salary BETWEEN 12000 AND 18000", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0290", "split": "gate_large", "db_id": "insurance_policies", "question": "Tell me the the date when the first claim was made.", "gold_sql": "SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0291", "split": "gate_large", "db_id": "insurance_fnol", "question": "What are all the phone numbers?", "gold_sql": "SELECT customer_phone FROM available_policies", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0292", "split": "gate_large", "db_id": "student_1", "question": "For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade.", "gold_sql": "SELECT grade , count(DISTINCT classroom) , count(*) FROM list GROUP BY grade", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0293", "split": "gate_large", "db_id": "behavior_monitoring", "question": "What are the monthly rentals of student addresses in Texas state?", "gold_sql": "SELECT T2.monthly_rental FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id WHERE T1.state_province_county = \"Texas\"", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0294", "split": "gate_large", "db_id": "train_station", "question": "Show station names without any trains.", "gold_sql": "SELECT name FROM station WHERE station_id NOT IN (SELECT station_id FROM train_station)", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0295", "split": "gate_large", "db_id": "inn_1", "question": "What is the total number of rooms available in this inn?", "gold_sql": "SELECT count(*) FROM Rooms;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0296", "split": "gate_large", "db_id": "ship_1", "question": "In which year were most of ships built?", "gold_sql": "SELECT built_year FROM ship GROUP BY built_year ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0297", "split": "gate_large", "db_id": "behavior_monitoring", "question": "What are the id and zip code of the address with the highest monthly rental?", "gold_sql": "SELECT T2.address_id , T1.zip_postcode FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id ORDER BY monthly_rental DESC LIMIT 1", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0298", "split": "gate_large", "db_id": "insurance_fnol", "question": "Find the policy types more than 4 customers use. Show their type code.", "gold_sql": "SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING count(*) > 4", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0299", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Find the name and ID of the product whose total order quantity is the largest.", "gold_sql": "SELECT t2.product_details , t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0300", "split": "gate_large", "db_id": "inn_1", "question": "What is the average base price of different bed type? List bed type and average base price.", "gold_sql": "SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0301", "split": "gate_large", "db_id": "soccer_1", "question": "How many leagues are there in England?", "gold_sql": "SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id = T2.country_id WHERE T1.name = \"England\"", "db_path": "databases/soccer_1/soccer_1.sqlite", "schema": "CREATE TABLE `Country` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`name`\tTEXT UNIQUE\n);\nCREATE TABLE `League` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`country_id`\tINTEGER,\n\t`name`\tTEXT UNIQUE,\n\tFOREIGN KEY(`country_id`) REFERENCES `Country`(`id`)\n);\nCREATE TABLE `Player` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_api_id`\tINTEGER UNIQUE,\n\t`player_name`\tTEXT,\n\t`player_fifa_api_id`\tINTEGER UNIQUE,\n\t`birthday`\tTEXT,\n\t`height`\tINTEGER,\n\t`weight`\tINTEGER\n);\nCREATE TABLE \"Player_Attributes\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`player_fifa_api_id`\tINTEGER,\n\t`player_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`overall_rating`\tINTEGER,\n\t`potential`\tINTEGER,\n\t`preferred_foot`\tTEXT,\n\t`attacking_work_rate`\tTEXT,\n\t`defensive_work_rate`\tTEXT,\n\t`crossing`\tINTEGER,\n\t`finishing`\tINTEGER,\n\t`heading_accuracy`\tINTEGER,\n\t`short_passing`\tINTEGER,\n\t`volleys`\tINTEGER,\n\t`dribbling`\tINTEGER,\n\t`curve`\tINTEGER,\n\t`free_kick_accuracy`\tINTEGER,\n\t`long_passing`\tINTEGER,\n\t`ball_control`\tINTEGER,\n\t`acceleration`\tINTEGER,\n\t`sprint_speed`\tINTEGER,\n\t`agility`\tINTEGER,\n\t`reactions`\tINTEGER,\n\t`balance`\tINTEGER,\n\t`shot_power`\tINTEGER,\n\t`jumping`\tINTEGER,\n\t`stamina`\tINTEGER,\n\t`strength`\tINTEGER,\n\t`long_shots`\tINTEGER,\n\t`aggression`\tINTEGER,\n\t`interceptions`\tINTEGER,\n\t`positioning`\tINTEGER,\n\t`vision`\tINTEGER,\n\t`penalties`\tINTEGER,\n\t`marking`\tINTEGER,\n\t`standing_tackle`\tINTEGER,\n\t`sliding_tackle`\tINTEGER,\n\t`gk_diving`\tINTEGER,\n\t`gk_handling`\tINTEGER,\n\t`gk_kicking`\tINTEGER,\n\t`gk_positioning`\tINTEGER,\n\t`gk_reflexes`\tINTEGER,\n\tFOREIGN KEY(`player_fifa_api_id`) REFERENCES `Player`(`player_fifa_api_id`),\n\tFOREIGN KEY(`player_api_id`) REFERENCES `Player`(`player_api_id`)\n);\nCREATE TABLE \"Team\" (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_api_id`\tINTEGER UNIQUE,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_long_name`\tTEXT,\n\t`team_short_name`\tTEXT\n);\nCREATE TABLE `Team_Attributes` (\n\t`id`\tINTEGER PRIMARY KEY AUTOINCREMENT,\n\t`team_fifa_api_id`\tINTEGER,\n\t`team_api_id`\tINTEGER,\n\t`date`\tTEXT,\n\t`buildUpPlaySpeed`\tINTEGER,\n\t`buildUpPlaySpeedClass`\tTEXT,\n\t`buildUpPlayDribbling`\tINTEGER,\n\t`buildUpPlayDribblingClass`\tTEXT,\n\t`buildUpPlayPassing`\tINTEGER,\n\t`buildUpPlayPassingClass`\tTEXT,\n\t`buildUpPlayPositioningClass`\tTEXT,\n\t`chanceCreationPassing`\tINTEGER,\n\t`chanceCreationPassingClass`\tTEXT,\n\t`chanceCreationCrossing`\tINTEGER,\n\t`chanceCreationCrossingClass`\tTEXT,\n\t`chanceCreationShooting`\tINTEGER,\n\t`chanceCreationShootingClass`\tTEXT,\n\t`chanceCreationPositioningClass`\tTEXT,\n\t`defencePressure`\tINTEGER,\n\t`defencePressureClass`\tTEXT,\n\t`defenceAggression`\tINTEGER,\n\t`defenceAggressionClass`\tTEXT,\n\t`defenceTeamWidth`\tINTEGER,\n\t`defenceTeamWidthClass`\tTEXT,\n\t`defenceDefenderLineClass`\tTEXT,\n\tFOREIGN KEY(`team_fifa_api_id`) REFERENCES `Team`(`team_fifa_api_id`),\n\tFOREIGN KEY(`team_api_id`) REFERENCES `Team`(`team_api_id`)\n);\nCREATE TABLE sqlite_sequence(name,seq);"} {"qid": "gate_0302", "split": "gate_large", "db_id": "machine_repair", "question": "What are the names of the technicians by ascending order of quality rank for the machine they are assigned?", "gold_sql": "SELECT T3.Name FROM repair_assignment AS T1 JOIN machine AS T2 ON T1.machine_id = T2.machine_id JOIN technician AS T3 ON T1.technician_ID = T3.technician_ID ORDER BY T2.quality_rank", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0303", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "What are the lot details of lots associated with transactions with share count smaller than 50?", "gold_sql": "SELECT T1.lot_details FROM LOTS AS T1 JOIN TRANSACTIONS_LOTS AS T2 ON T1.lot_id = T2.transaction_id JOIN TRANSACTIONS AS T3 ON T2.transaction_id = T3.transaction_id WHERE T3.share_count < 50", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0304", "split": "gate_large", "db_id": "customers_and_addresses", "question": "How many orders have detail \"Second time\"?", "gold_sql": "SELECT count(*) FROM customer_orders WHERE order_details = \"Second time\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0305", "split": "gate_large", "db_id": "club_1", "question": "What are the first and last name of the president of the club \"Bootup Baltimore\"?", "gold_sql": "SELECT t3.fname , t3.lname FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t1.clubname = \"Bootup Baltimore\" AND t2.position = \"President\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0306", "split": "gate_large", "db_id": "manufactory_1", "question": "What is the sum of revenue from companies with headquarters in Austin?", "gold_sql": "SELECT sum(revenue) FROM manufacturers WHERE headquarter = 'Austin'", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0307", "split": "gate_large", "db_id": "hr_1", "question": "What are the full name, hire date, salary, and department id for employees without the letter M in their first name?", "gold_sql": "SELECT first_name , last_name , hire_date , salary , department_id FROM employees WHERE first_name NOT LIKE '%M%'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0308", "split": "gate_large", "db_id": "race_track", "question": "Return the minimum, maximum, and average seating across all tracks.", "gold_sql": "SELECT min(seating) , max(seating) , avg(seating) FROM track", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0309", "split": "gate_large", "db_id": "student_1", "question": "How many students does LORIA ONDERSMA teaches?", "gold_sql": "SELECT count(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = \"LORIA\" AND T2.lastname = \"ONDERSMA\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0310", "split": "gate_large", "db_id": "tracking_orders", "question": "For each product, show its name and the number of times it was ordered.", "gold_sql": "SELECT T3.product_name , count(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0311", "split": "gate_large", "db_id": "manufactory_1", "question": "Where is the headquarter of the company founded by James?", "gold_sql": "SELECT headquarter FROM manufacturers WHERE founder = 'James'", "db_path": "databases/manufactory_1/manufactory_1.sqlite", "schema": "CREATE TABLE Manufacturers (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL,\n Headquarter VARCHAR(255) NOT NULL,\n Founder VARCHAR(255) NOT NULL,\n Revenue REAL,\n PRIMARY KEY (Code) \n);\nCREATE TABLE Products (\n Code INTEGER,\n Name VARCHAR(255) NOT NULL ,\n Price DECIMAL NOT NULL ,\n Manufacturer INTEGER NOT NULL,\n PRIMARY KEY (Code), \n FOREIGN KEY (Manufacturer) REFERENCES Manufacturers(Code)\n);"} {"qid": "gate_0312", "split": "gate_large", "db_id": "cre_Doc_Control_Systems", "question": "Which document has the most draft copies? List its document id and number of draft copies.", "gold_sql": "SELECT document_id , count(copy_number) FROM Draft_Copies GROUP BY document_id ORDER BY count(copy_number) DESC LIMIT 1;", "db_path": "databases/cre_Doc_Control_Systems/cre_Doc_Control_Systems.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\naddress_details VARCHAR(255),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Circulation_History (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nemployee_id INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number, employee_id),\nFOREIGN KEY (document_id, draft_number, copy_number) REFERENCES Draft_Copies (document_id,draft_number,copy_number),\nFOREIGN KEY (employee_id) REFERENCES Employees (employee_id)\n);\nCREATE TABLE Document_Drafts (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ndraft_details VARCHAR(255),\nPRIMARY KEY (document_id, draft_number),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id)\n);\nCREATE TABLE Documents (\ndocument_id INTEGER NOT NULL,\ndocument_status_code CHAR(15) NOT NULL,\ndocument_type_code CHAR(15) NOT NULL,\nshipping_agent_code CHAR(15),\nreceipt_date DATETIME,\nreceipt_number VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (document_id),\nFOREIGN KEY (document_type_code) REFERENCES Ref_Document_Types (document_type_code),\nFOREIGN KEY (document_status_code) REFERENCES Ref_Document_Status (document_status_code),\nFOREIGN KEY (shipping_agent_code) REFERENCES Ref_Shipping_Agents (shipping_agent_code)\n);\nCREATE TABLE Documents_Mailed (\ndocument_id INTEGER NOT NULL,\nmailed_to_address_id INTEGER NOT NULL,\nmailing_date DATETIME,\nPRIMARY KEY (document_id, mailed_to_address_id),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id),\nFOREIGN KEY (mailed_to_address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Draft_Copies (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number),\nFOREIGN KEY (document_id, draft_number) REFERENCES Document_Drafts (document_id,draft_number)\n);\nCREATE TABLE Employees (\nemployee_id INTEGER NOT NULL,\nrole_code CHAR(15) NOT NULL,\nemployee_name VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (employee_id),\nFOREIGN KEY (role_code) REFERENCES Roles (role_code)\n);\nCREATE TABLE Ref_Document_Status (\ndocument_status_code CHAR(15) NOT NULL,\ndocument_status_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_status_code)\n);\nCREATE TABLE Ref_Document_Types (\ndocument_type_code CHAR(15) NOT NULL,\ndocument_type_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_type_code)\n);\nCREATE TABLE Ref_Shipping_Agents (\nshipping_agent_code CHAR(15) NOT NULL,\nshipping_agent_name VARCHAR(255) NOT NULL,\nshipping_agent_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (shipping_agent_code)\n);\nCREATE TABLE Roles (\nrole_code CHAR(15) NOT NULL,\nrole_description VARCHAR(255),\nPRIMARY KEY (role_code)\n);"} {"qid": "gate_0313", "split": "gate_large", "db_id": "club_1", "question": "How many clubs does \"Linda Smith\" have membership for?", "gold_sql": "SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = \"Linda\" AND t3.lname = \"Smith\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0314", "split": "gate_large", "db_id": "tracking_orders", "question": "List the names of customers who have once canceled the purchase of the product \"food\" (the item status is \"Cancel\").", "gold_sql": "SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = \"Cancel\" AND T4.product_name = \"food\" GROUP BY T1.customer_id HAVING count(*) >= 1", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0315", "split": "gate_large", "db_id": "race_track", "question": "What are the classes of races that have two or more corresponding races?", "gold_sql": "SELECT CLASS FROM race GROUP BY CLASS HAVING count(*) >= 2", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0316", "split": "gate_large", "db_id": "perpetrator", "question": "Show the countries that have both perpetrators with injures more than 50 and perpetrators with injures smaller than 20.", "gold_sql": "SELECT Country FROM perpetrator WHERE Injured > 50 INTERSECT SELECT Country FROM perpetrator WHERE Injured < 20", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0317", "split": "gate_large", "db_id": "race_track", "question": "Give the class of races that is most common.", "gold_sql": "SELECT CLASS FROM race GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0318", "split": "gate_large", "db_id": "behavior_monitoring", "question": "What are the line 1 and average monthly rentals of all student addresses?", "gold_sql": "SELECT T1.line_1 , avg(T2.monthly_rental) FROM Addresses AS T1 JOIN Student_Addresses AS T2 ON T1.address_id = T2.address_id GROUP BY T2.address_id", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0319", "split": "gate_large", "db_id": "customer_complaints", "question": "Find the emails of customers who has filed a complaints of the product with the most complaints.", "gold_sql": "SELECT t1.email_address FROM customers AS t1 JOIN complaints AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY count(*) LIMIT 1", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0320", "split": "gate_large", "db_id": "customers_and_addresses", "question": "List the countries having more than 4 addresses listed.", "gold_sql": "SELECT country FROM addresses GROUP BY country HAVING count(address_id) > 4", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0321", "split": "gate_large", "db_id": "behavior_monitoring", "question": "What is the cell phone number of the student whose address has the lowest monthly rental?", "gold_sql": "SELECT T2.cell_mobile_number FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.monthly_rental ASC LIMIT 1", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0322", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the maximum and minimum share count of different transaction types.", "gold_sql": "SELECT transaction_type_code , max(share_count) , min(share_count) FROM TRANSACTIONS GROUP BY transaction_type_code", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0323", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the average time span of contact channels in the database?", "gold_sql": "SELECT avg(active_to_date - active_from_date) FROM customer_contact_channels", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0324", "split": "gate_large", "db_id": "farm", "question": "What are the hosts of competitions whose theme is not \"Aliens\"?", "gold_sql": "SELECT Hosts FROM farm_competition WHERE Theme != 'Aliens'", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0325", "split": "gate_large", "db_id": "train_station", "question": "What are all locations of train stations?", "gold_sql": "SELECT DISTINCT LOCATION FROM station", "db_path": "databases/train_station/train_station.sqlite", "schema": "CREATE TABLE \"station\" (\n\"Station_ID\" int,\n\"Name\" text,\n\"Annual_entry_exit\" real,\n\"Annual_interchanges\" real,\n\"Total_Passengers\" real,\n\"Location\" text,\n\"Main_Services\" text,\n\"Number_of_Platforms\" int,\nPRIMARY KEY (\"Station_ID\")\n);\nCREATE TABLE \"train\" (\n\"Train_ID\" int,\n\"Name\" text,\n\"Time\" text,\n\"Service\" text,\nPRIMARY KEY (\"Train_ID\")\n);\nCREATE TABLE \"train_station\" (\n\"Train_ID\" int,\n\"Station_ID\" int,\t\nPRIMARY KEY (\"Train_ID\",\"Station_ID\"),\nFOREIGN KEY (\"Train_ID\") REFERENCES \"train\"(\"Train_ID\"),\nFOREIGN KEY (\"Station_ID\") REFERENCES \"station\"(\"Station_ID\")\n);"} {"qid": "gate_0326", "split": "gate_large", "db_id": "insurance_policies", "question": "Which claims caused more than 2 settlements or have the maximum claim value? List the date the claim was made and the claim id.", "gold_sql": "SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id GROUP BY T1.Claim_id HAVING count(*) > 2 UNION SELECT T1.Date_Claim_Made , T1.Claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.Claim_id = T2.Claim_id WHERE T1.Amount_Claimed = ( SELECT max(Amount_Claimed) FROM Claims )", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0327", "split": "gate_large", "db_id": "inn_1", "question": "Find the number of times ROY SWEAZY has reserved a room.", "gold_sql": "SELECT count(*) FROM Reservations WHERE FirstName = \"ROY\" AND LastName = \"SWEAZY\";", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0328", "split": "gate_large", "db_id": "formula_1", "question": "What are the names of all the circuits that are in the UK or Malaysia?", "gold_sql": "SELECT name FROM circuits WHERE country = \"UK\" OR country = \"Malaysia\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0329", "split": "gate_large", "db_id": "student_1", "question": "Find the last names of the students in third grade that are not taught by COVIN JEROME.", "gold_sql": "SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname != \"COVIN\" AND T2.lastname != \"JEROME\"", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0330", "split": "gate_large", "db_id": "customers_card_transactions", "question": "How many credit cards does customer Blanche Huels have?", "gold_sql": "SELECT count(*) FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Blanche\" AND T2.customer_last_name = \"Huels\" AND T1.card_type_code = \"Credit\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0331", "split": "gate_large", "db_id": "student_1", "question": "What are the first names of the teachers who teach grade 1?", "gold_sql": "SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0332", "split": "gate_large", "db_id": "candidate_poll", "question": "What are the names of people who have a height greater than 200 or less than 190?", "gold_sql": "SELECT name FROM people WHERE height > 200 OR height < 190", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0333", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show the customer ids and firstname without a credit card.", "gold_sql": "SELECT customer_id , customer_first_name FROM Customers EXCEPT SELECT T1.customer_id , T2.customer_first_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE card_type_code = \"Credit\"", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0334", "split": "gate_large", "db_id": "hr_1", "question": "What is all the information about the Marketing department?", "gold_sql": "SELECT * FROM departments WHERE department_name = 'Marketing'", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0335", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "How many medicines have the FDA approval status 'No' ?", "gold_sql": "SELECT count(*) FROM medicine WHERE FDA_approved = 'No'", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0336", "split": "gate_large", "db_id": "ship_1", "question": "What types of ships have both ships that have Panama Flags and Malta flags?", "gold_sql": "SELECT TYPE FROM ship WHERE flag = 'Panama' INTERSECT SELECT TYPE FROM ship WHERE flag = 'Malta'", "db_path": "databases/ship_1/ship_1.sqlite", "schema": "CREATE TABLE \"Ship\" (\n\"Ship_ID\" int,\n\"Name\" text,\n\"Type\" text,\n\"Built_Year\" real,\n\"Class\" text,\n\"Flag\" text,\nPRIMARY KEY (\"Ship_ID\")\n);\nCREATE TABLE \"captain\" (\n\"Captain_ID\" int,\n\"Name\" text,\n\"Ship_ID\" int,\n\"age\" text,\n\"Class\" text,\n\"Rank\" text,\nPRIMARY KEY (\"Captain_ID\"),\nFOREIGN KEY (\"Ship_ID\") REFERENCES \"Ship\"(\"Ship_ID\")\n);"} {"qid": "gate_0337", "split": "gate_large", "db_id": "school_bus", "question": "Show the home city with the most number of drivers.", "gold_sql": "SELECT home_city FROM driver GROUP BY home_city ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0338", "split": "gate_large", "db_id": "club_1", "question": "What are the first names of all the students?", "gold_sql": "SELECT DISTINCT fname FROM student", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0339", "split": "gate_large", "db_id": "tracking_orders", "question": "Find the names of the customers who have order status both \"On Road\" and \"Shipped\".", "gold_sql": "SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = \"On Road\" INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = \"Shipped\"", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0340", "split": "gate_large", "db_id": "wedding", "question": "How many churches opened before 1850 are there?", "gold_sql": "SELECT count(*) FROM Church WHERE Open_Date < 1850", "db_path": "databases/wedding/wedding.sqlite", "schema": "CREATE TABLE \"church\" (\n\"Church_ID\" int,\n\"Name\" text,\n\"Organized_by\" text,\n\"Open_Date\" int,\n\"Continuation_of\" text,\nPRIMARY KEY (\"Church_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Country\" text,\n\"Is_Male\" text,\n\"Age\" int,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"wedding\" (\n\"Church_ID\" int,\n\"Male_ID\" int,\n\"Female_ID\" int,\n\"Year\" int,\nPRIMARY KEY (\"Church_ID\",\"Male_ID\",\"Female_ID\"),\nFOREIGN KEY (\"Church_ID\") REFERENCES `church`(\"Church_ID\"),\nFOREIGN KEY (\"Male_ID\") REFERENCES `people`(\"People_ID\"),\nFOREIGN KEY (\"Female_ID\") REFERENCES `people`(\"People_ID\")\n);"} {"qid": "gate_0341", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Count the number of customers who hold an account.", "gold_sql": "SELECT count(DISTINCT customer_id) FROM Accounts", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0342", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the id and details for the investors who have the top 3 number of transactions.", "gold_sql": "SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id GROUP BY T2.investor_id ORDER BY COUNT(*) DESC LIMIT 3", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0343", "split": "gate_large", "db_id": "game_1", "question": "Show all game ids and the number of hours played.", "gold_sql": "SELECT gameid , sum(hours_played) FROM Plays_games GROUP BY gameid", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0344", "split": "gate_large", "db_id": "formula_1", "question": "What is the name of the race held most recently?", "gold_sql": "SELECT name FROM races ORDER BY date DESC LIMIT 1", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0345", "split": "gate_large", "db_id": "pilot_record", "question": "Show the pilot positions that have both pilots joining after year 2005 and pilots joining before 2000.", "gold_sql": "SELECT POSITION FROM pilot WHERE Join_Year\t < 2000 INTERSECT SELECT POSITION FROM pilot WHERE Join_Year\t > 2005", "db_path": "databases/pilot_record/pilot_record.sqlite", "schema": "CREATE TABLE \"aircraft\" (\n\"Aircraft_ID\" int,\n\"Order_Year\" int,\n\"Manufacturer\" text,\n\"Model\" text,\n\"Fleet_Series\" text,\n\"Powertrain\" text,\n\"Fuel_Propulsion\" text,\nPRIMARY KEY (\"Aircraft_ID\")\n);\nCREATE TABLE \"pilot\" (\n\"Pilot_ID\" int,\n\"Pilot_name\" text,\n\"Rank\" int,\n\"Age\" int,\n\"Nationality\" text,\n\"Position\" text,\n\"Join_Year\" int,\n\"Team\" text,\nPRIMARY KEY (\"Pilot_ID\")\n);\nCREATE TABLE \"pilot_record\" (\n\"Record_ID\" int,\n\"Pilot_ID\" int,\n\"Aircraft_ID\" int,\n\"Date\" text,\nPRIMARY KEY (\"Pilot_ID\", \"Aircraft_ID\", \"Date\"),\nFOREIGN KEY (`Pilot_ID`) REFERENCES `pilot`(`Pilot_ID`),\nFOREIGN KEY (`Aircraft_ID`) REFERENCES `aircraft`(`Aircraft_ID`)\n);"} {"qid": "gate_0346", "split": "gate_large", "db_id": "customer_complaints", "question": "What are the last names of staff with email addressed containing the substring \"wrau\"?", "gold_sql": "SELECT last_name FROM staff WHERE email_address LIKE \"%wrau%\"", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0347", "split": "gate_large", "db_id": "sakila_1", "question": "Which film has the most number of actors or actresses? List the film name, film id and description.", "gold_sql": "SELECT T2.title , T2.film_id , T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0348", "split": "gate_large", "db_id": "sakila_1", "question": "What are the payment dates for any payments that have an amount greater than 10 or were handled by a staff member with the first name Elsa?", "gold_sql": "SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'", "db_path": "databases/sakila_1/sakila_1.sqlite", "schema": "CREATE TABLE actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id)\n);\nCREATE TABLE address (\n address_id SMALLINT UNSIGNED NOT NULL,\n address VARCHAR(50) NOT NULL,\n address2 VARCHAR(50) DEFAULT NULL,\n district VARCHAR(20) NOT NULL,\n city_id SMALLINT UNSIGNED NOT NULL,\n postal_code VARCHAR(10) DEFAULT NULL,\n phone VARCHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (address_id),\n FOREIGN KEY (city_id) REFERENCES city (city_id)\n);\nCREATE TABLE category (\n category_id TINYINT UNSIGNED NOT NULL,\n name VARCHAR(25) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (category_id)\n);\nCREATE TABLE city (\n city_id SMALLINT UNSIGNED NOT NULL,\n city VARCHAR(50) NOT NULL,\n country_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (city_id),\n FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\nCREATE TABLE country (\n country_id SMALLINT UNSIGNED NOT NULL,\n country VARCHAR(50) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (country_id)\n);\nCREATE TABLE customer (\n customer_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n email VARCHAR(50) DEFAULT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n create_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (customer_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id)\n);\nCREATE TABLE film (\n film_id SMALLINT UNSIGNED NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT DEFAULT NULL,\n release_year YEAR DEFAULT NULL,\n language_id TINYINT UNSIGNED NOT NULL,\n original_language_id TINYINT UNSIGNED DEFAULT NULL,\n rental_duration TINYINT UNSIGNED NOT NULL DEFAULT 3,\n rental_rate DECIMAL(4,2) NOT NULL DEFAULT 4.99,\n length SMALLINT UNSIGNED DEFAULT NULL,\n replacement_cost DECIMAL(5,2) NOT NULL DEFAULT 19.99,\n rating DEFAULT 'G',\n special_features DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id),\n FOREIGN KEY (language_id) REFERENCES language (language_id),\n FOREIGN KEY (original_language_id) REFERENCES language (language_id)\n);\nCREATE TABLE film_actor (\n actor_id SMALLINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (actor_id,film_id),\n FOREIGN KEY (actor_id) REFERENCES actor (actor_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE film_category (\n film_id SMALLINT UNSIGNED NOT NULL,\n category_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (film_id, category_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id),\n FOREIGN KEY (category_id) REFERENCES category (category_id)\n);\nCREATE TABLE film_text (\n film_id SMALLINT NOT NULL,\n title VARCHAR(255) NOT NULL,\n description TEXT,\n PRIMARY KEY (film_id)\n);\nCREATE TABLE inventory (\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n film_id SMALLINT UNSIGNED NOT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (inventory_id),\n FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (film_id) REFERENCES film (film_id)\n);\nCREATE TABLE language (\n language_id TINYINT UNSIGNED NOT NULL,\n name CHAR(20) NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (language_id)\n);\nCREATE TABLE payment (\n payment_id SMALLINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n rental_id INT DEFAULT NULL,\n amount DECIMAL(5,2) NOT NULL,\n payment_date DATETIME NOT NULL,\n last_update TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (payment_id),\n FOREIGN KEY (rental_id) REFERENCES rental (rental_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id)\n);\nCREATE TABLE rental (\n rental_id INT NOT NULL,\n rental_date DATETIME NOT NULL,\n inventory_id MEDIUMINT UNSIGNED NOT NULL,\n customer_id SMALLINT UNSIGNED NOT NULL,\n return_date DATETIME DEFAULT NULL,\n staff_id TINYINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (rental_id),\n FOREIGN KEY (staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id),\n FOREIGN KEY (customer_id) REFERENCES customer (customer_id)\n);\nCREATE TABLE staff (\n staff_id TINYINT UNSIGNED NOT NULL,\n first_name VARCHAR(45) NOT NULL,\n last_name VARCHAR(45) NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n picture BLOB DEFAULT NULL,\n email VARCHAR(50) DEFAULT NULL,\n store_id TINYINT UNSIGNED NOT NULL,\n active BOOLEAN NOT NULL DEFAULT TRUE,\n username VARCHAR(16) NOT NULL,\n password VARCHAR(40) DEFAULT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (staff_id),\n --FOREIGN KEY (store_id) REFERENCES store (store_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\nCREATE TABLE store (\n store_id TINYINT UNSIGNED NOT NULL,\n manager_staff_id TINYINT UNSIGNED NOT NULL,\n address_id SMALLINT UNSIGNED NOT NULL,\n last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (store_id),\n FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id),\n FOREIGN KEY (address_id) REFERENCES address (address_id)\n);"} {"qid": "gate_0349", "split": "gate_large", "db_id": "machine_repair", "question": "Show names of technicians and the number of machines they are assigned to repair.", "gold_sql": "SELECT T2.Name , COUNT(*) FROM repair_assignment AS T1 JOIN technician AS T2 ON T1.technician_ID = T2.technician_ID GROUP BY T2.Name", "db_path": "databases/machine_repair/machine_repair.sqlite", "schema": "CREATE TABLE \"machine\" (\n\"Machine_ID\" int,\n\"Making_Year\" int,\n\"Class\" text,\n\"Team\" text,\n\"Machine_series\" text,\n\"value_points\" real,\n\"quality_rank\" int,\nPRIMARY KEY (\"Machine_ID\")\n);\nCREATE TABLE \"repair\" (\n\"repair_ID\" int,\n\"name\" text,\n\"Launch_Date\" text,\n\"Notes\" text,\nPRIMARY KEY (\"repair_ID\")\n);\nCREATE TABLE \"repair_assignment\" (\n\"technician_id\" int,\n\"repair_ID\" int,\n\"Machine_ID\" int,\nPRIMARY Key (\"technician_id\",\"repair_ID\",\"Machine_ID\"),\nFOREIGN KEY (`technician_id`) REFERENCES `technician`(`technician_id`),\nFOREIGN KEY (`repair_ID`) REFERENCES `repair`(`repair_ID`),\nFOREIGN KEY (`Machine_ID`) REFERENCES `machine`(`Machine_ID`)\n);\nCREATE TABLE \"technician\" (\n\"technician_id\" real,\n\"Name\" text,\n\"Team\" text,\n\"Starting_Year\" real,\n\"Age\" int,\nPRIMARY Key (\"technician_id\")\n);"} {"qid": "gate_0350", "split": "gate_large", "db_id": "insurance_policies", "question": "Of all the claims, what was the earliest date when any claim was made?", "gold_sql": "SELECT Date_Claim_Made FROM Claims ORDER BY Date_Claim_Made ASC LIMIT 1", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0351", "split": "gate_large", "db_id": "formula_1", "question": "What are the different names of all the races in reverse alphabetical order?", "gold_sql": "SELECT DISTINCT name FROM races ORDER BY name DESC", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0352", "split": "gate_large", "db_id": "inn_1", "question": "Find the most popular room in the hotel. The most popular room is the room that had seen the largest number of reservations.", "gold_sql": "SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY count(*) DESC LIMIT 1;", "db_path": "databases/inn_1/inn_1.sqlite", "schema": "CREATE TABLE \"Reservations\" ( \n\t\"Code\" INTEGER PRIMARY KEY, \n\t\"Room\" TEXT, \n\t\"CheckIn\" TEXT, \n\t\"CheckOut\" TEXT, \n\t\"Rate\" REAL, \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Adults\" INTEGER, \n\t\"Kids\" INTEGER,\n\tFOREIGN KEY (Room) REFERENCES Rooms(RoomId)\n);\nCREATE TABLE \"Rooms\" ( \n\t\"RoomId\" TEXT PRIMARY KEY,\n\t\"roomName\" TEXT, \n\t\"beds\" INTEGER, \n\t\"bedType\" TEXT, \n\t\"maxOccupancy\" INTEGER, \n\t\"basePrice\" INTEGER, \n\t\"decor\" TEXT\n\n);"} {"qid": "gate_0353", "split": "gate_large", "db_id": "formula_1", "question": "What are the names of races held between 2009 and 2011?", "gold_sql": "SELECT name FROM races WHERE YEAR BETWEEN 2009 AND 2011", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0354", "split": "gate_large", "db_id": "customers_and_addresses", "question": "What is the address content of the customer named \"Maudie Kertzmann\"?", "gold_sql": "SELECT t3.address_content FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t1.customer_name = \"Maudie Kertzmann\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0355", "split": "gate_large", "db_id": "club_1", "question": "How many clubs does \"Linda Smith\" belong to?", "gold_sql": "SELECT count(*) FROM club AS t1 JOIN member_of_club AS t2 ON t1.clubid = t2.clubid JOIN student AS t3 ON t2.stuid = t3.stuid WHERE t3.fname = \"Linda\" AND t3.lname = \"Smith\"", "db_path": "databases/club_1/club_1.sqlite", "schema": "CREATE TABLE Club (\n ClubID INTEGER PRIMARY KEY,\n ClubName VARCHAR(40),\n ClubDesc VARCHAR(1024),\n ClubLocation VARCHAR(40)\n);\nCREATE TABLE Member_of_club (\n StuID INTEGER,\n ClubID INTEGER,\n Position VARCHAR(40),\n FOREIGN KEY(StuID) REFERENCES Student(StuID),\n FOREIGN KEY(ClubID) REFERENCES Club(ClubID)\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": "gate_0356", "split": "gate_large", "db_id": "hr_1", "question": "What are the full names and department ids for the lowest paid employees across all departments.", "gold_sql": "SELECT first_name , last_name , department_id FROM employees WHERE salary IN (SELECT MIN(salary) FROM employees GROUP BY department_id)", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0357", "split": "gate_large", "db_id": "product_catalog", "question": "Which attribute definitions have attribute value 0? Give me the attribute name and attribute ID.", "gold_sql": "SELECT t1.attribute_name , t1.attribute_id FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0", "db_path": "databases/product_catalog/product_catalog.sqlite", "schema": "CREATE TABLE `Attribute_Definitions` (\n`attribute_id` INTEGER PRIMARY KEY,\n`attribute_name` VARCHAR(30),\n`attribute_data_type` VARCHAR(10)\n);\nCREATE TABLE `Catalog_Contents` (\n`catalog_entry_id` INTEGER PRIMARY KEY,\n`catalog_level_number` INTEGER NOT NULL,\n`parent_entry_id` INTEGER,\n`previous_entry_id` INTEGER,\n`next_entry_id` INTEGER,\n`catalog_entry_name` VARCHAR(80),\n`product_stock_number` VARCHAR(50),\n`price_in_dollars` DOUBLE NULL,\n`price_in_euros` DOUBLE NULL,\n`price_in_pounds` DOUBLE NULL,\n`capacity` VARCHAR(20),\n`length` VARCHAR(20),\n`height` VARCHAR(20),\n`width` VARCHAR(20),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Contents_Additional_Attributes` (\n`catalog_entry_id` INTEGER NOT NULL,\n`catalog_level_number` INTEGER NOT NULL,\n`attribute_id` INTEGER NOT NULL,\n`attribute_value` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`catalog_entry_id` ) REFERENCES `Catalog_Contents`(`catalog_entry_id` ),\nFOREIGN KEY (`catalog_level_number` ) REFERENCES `Catalog_Structure`(`catalog_level_number` )\n);\nCREATE TABLE `Catalog_Structure` (\n`catalog_level_number` INTEGER PRIMARY KEY,\n`catalog_id` INTEGER NOT NULL,\n`catalog_level_name` VARCHAR(50),\nFOREIGN KEY (`catalog_id` ) REFERENCES `Catalogs`(`catalog_id` )\n);\nCREATE TABLE `Catalogs` (\n`catalog_id` INTEGER PRIMARY KEY,\n`catalog_name` VARCHAR(50),\n`catalog_publisher` VARCHAR(80),\n`date_of_publication` DATETIME,\n`date_of_latest_revision` DATETIME\n);"} {"qid": "gate_0358", "split": "gate_large", "db_id": "hr_1", "question": "display the first and last name, department, city, and state province for each employee.", "gold_sql": "SELECT T1.first_name , T1.last_name , T2.department_name , T3.city , T3.state_province FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0359", "split": "gate_large", "db_id": "school_bus", "question": "List names for drivers from Hartford city and younger than 40.", "gold_sql": "SELECT name FROM driver WHERE home_city = 'Hartford' AND age < 40", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0360", "split": "gate_large", "db_id": "hr_1", "question": "Which job titles correspond to jobs with salaries over 9000?", "gold_sql": "SELECT job_title FROM jobs WHERE min_salary > 9000", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0361", "split": "gate_large", "db_id": "hr_1", "question": "What are the department names and how many employees work in each of them?", "gold_sql": "SELECT department_name , COUNT(*) FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id GROUP BY department_name", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0362", "split": "gate_large", "db_id": "game_1", "question": "Show all video games and their types in the order of their names.", "gold_sql": "SELECT gname , gtype FROM Video_games ORDER BY gname", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0363", "split": "gate_large", "db_id": "game_1", "question": "Show the game name that has most number of hours played.", "gold_sql": "SELECT gname FROM Plays_games AS T1 JOIN Video_games AS T2 ON T1.gameid = T2.gameid GROUP BY T1.gameid ORDER BY sum(hours_played) DESC LIMIT 1", "db_path": "databases/game_1/game_1.sqlite", "schema": "CREATE TABLE Plays_Games (\n StuID INTEGER,\n GameID INTEGER,\n Hours_Played INTEGER,\n FOREIGN KEY(GameID) REFERENCES Video_Games(GameID),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\n);\nCREATE TABLE SportsInfo (\n StuID INTEGER,\n SportName VARCHAR(32),\n HoursPerWeek INTEGER,\n GamesPlayed INTEGER,\n OnScholarship VARCHAR(1),\n FOREIGN KEY(StuID) REFERENCES Student(StuID)\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 Video_Games (\n GameID INTEGER PRIMARY KEY,\n GName VARCHAR(40),\n GType VARCHAR(40)\n);"} {"qid": "gate_0364", "split": "gate_large", "db_id": "student_1", "question": "Show me the classrooms grade 5 is using.", "gold_sql": "SELECT DISTINCT classroom FROM list WHERE grade = 5", "db_path": "databases/student_1/student_1.sqlite", "schema": "CREATE TABLE \"list\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Grade\" INTEGER, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);\nCREATE TABLE \"teachers\" ( \n\t\"LastName\" TEXT, \n\t\"FirstName\" TEXT, \n\t\"Classroom\" INTEGER,\n\tPRIMARY KEY(LastName, FirstName)\n);"} {"qid": "gate_0365", "split": "gate_large", "db_id": "hr_1", "question": "What are the employee ids for employees who have held two or more jobs?", "gold_sql": "SELECT employee_id FROM job_history GROUP BY employee_id HAVING COUNT(*) >= 2", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0366", "split": "gate_large", "db_id": "tracking_orders", "question": "Which orders have shipment after 2000-01-01? Give me the order ids.", "gold_sql": "SELECT order_id FROM shipments WHERE shipment_date > \"2000-01-01\"", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0367", "split": "gate_large", "db_id": "tracking_orders", "question": "Sort all the distinct products in alphabetical order.", "gold_sql": "SELECT DISTINCT product_name FROM products ORDER BY product_name", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0368", "split": "gate_large", "db_id": "insurance_fnol", "question": "Which services have been used more than twice in first notification of loss? Return the service name.", "gold_sql": "SELECT t2.service_name FROM first_notification_of_loss AS t1 JOIN services AS t2 ON t1.service_id = t2.service_id GROUP BY t1.service_id HAVING count(*) > 2", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0369", "split": "gate_large", "db_id": "school_bus", "question": "Show all different home cities.", "gold_sql": "SELECT DISTINCT home_city FROM driver", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0370", "split": "gate_large", "db_id": "tracking_orders", "question": "What is the placement date of the order whose invoice number is 10?", "gold_sql": "SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10", "db_path": "databases/tracking_orders/tracking_orders.sqlite", "schema": "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);\nCREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);\nCREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) 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 `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);\nCREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);\nCREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);"} {"qid": "gate_0371", "split": "gate_large", "db_id": "race_track", "question": "How many races are there?", "gold_sql": "SELECT count(*) FROM race", "db_path": "databases/race_track/race_track.sqlite", "schema": "CREATE TABLE \"race\" (\n\"Race_ID\" int,\n\"Name\" text,\n\"Class\" text,\n\"Date\" text,\n\"Track_ID\" text,\nPRIMARY KEY (\"Race_ID\"),\nFOREIGN KEY (\"Track_ID\") REFERENCES \"track\"(\"Track_ID\")\n);\nCREATE TABLE \"track\" (\n\"Track_ID\" int,\n\"Name\" text,\n\"Location\" text,\n\"Seating\" real,\n\"Year_Opened\" real,\nPRIMARY KEY (\"Track_ID\")\n);"} {"qid": "gate_0372", "split": "gate_large", "db_id": "customer_complaints", "question": "How many customers are there in the customer type with the most customers?", "gold_sql": "SELECT count(*) FROM customers GROUP BY customer_type_code ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0373", "split": "gate_large", "db_id": "twitter_1", "question": "Find the name and email for the users who have more than one follower.", "gold_sql": "SELECT T1.name , T1.email FROM user_profiles AS T1 JOIN follows AS T2 ON T1.uid = T2.f1 GROUP BY T2.f1 HAVING count(*) > 1", "db_path": "databases/twitter_1/twitter_1.sqlite", "schema": "CREATE TABLE `follows` (\n `f1` int(11) NOT NULL,\n `f2` int(11) NOT NULL,\n PRIMARY KEY (`f1`,`f2`),\n FOREIGN KEY (`f1`) REFERENCES `user_profiles`(`uid`),\n FOREIGN KEY (`f2`) REFERENCES `user_profiles`(`uid`)\n\n);\nCREATE TABLE `tweets` (\n `id` bigint(20) NOT NULL,\n `uid` int(11) NOT NULL,\n `text` char(140) NOT NULL,\n `createdate` datetime DEFAULT CURRENT_TIMESTAMP,\n PRIMARY KEY (`id`),\n FOREIGN KEY (`uid`) REFERENCES `user_profiles`(`uid`)\n);\nCREATE TABLE \"user_profiles\" (`uid` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `partitionid` int(11) DEFAULT NULL, `followers` int(11) DEFAULT NULL, PRIMARY KEY (`uid`));"} {"qid": "gate_0374", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show all transaction types.", "gold_sql": "SELECT DISTINCT transaction_type FROM Financial_Transactions", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0375", "split": "gate_large", "db_id": "behavior_monitoring", "question": "Find the texts of assessment notes for teachers with last name \"Schuster\".", "gold_sql": "SELECT T1.text_of_notes FROM Assessment_Notes AS T1 JOIN Teachers AS T2 ON T1.teacher_id = T2.teacher_id WHERE T2.last_name = \"Schuster\"", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0376", "split": "gate_large", "db_id": "customers_card_transactions", "question": "Show id, first and last names for all customers with at least two cards.", "gold_sql": "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Customers_cards AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0377", "split": "gate_large", "db_id": "insurance_fnol", "question": "Find the IDs of customers whose name contains \"Diana\".", "gold_sql": "SELECT customer_id FROM customers WHERE customer_name LIKE \"%Diana%\"", "db_path": "databases/insurance_fnol/insurance_fnol.sqlite", "schema": "CREATE TABLE Available_Policies (\nPolicy_ID INTEGER NOT NULL,\npolicy_type_code CHAR(15),\nCustomer_Phone VARCHAR(255),\nPRIMARY KEY (Policy_ID),\nUNIQUE (Policy_ID)\n);\nCREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nFNOL_ID INTEGER NOT NULL,\nEffective_Date DATE,\nPRIMARY KEY (Claim_ID),\nUNIQUE (Claim_ID),\nFOREIGN KEY (FNOL_ID) REFERENCES First_Notification_of_Loss (FNOL_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_name VARCHAR(40),\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Customers_Policies (\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Opened DATE,\nDate_Closed DATE,\nPRIMARY KEY (Customer_ID, Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Available_Policies (Policy_ID)\n);\nCREATE TABLE First_Notification_of_Loss (\nFNOL_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nService_ID INTEGER NOT NULL,\nPRIMARY KEY (FNOL_ID),\nUNIQUE (FNOL_ID),\nFOREIGN KEY (Service_ID) REFERENCES Services (Service_ID),\nFOREIGN KEY (Customer_ID, Policy_ID) REFERENCES Customers_Policies (Customer_ID,Policy_ID)\n);\nCREATE TABLE Services (\nService_ID INTEGER NOT NULL,\nService_name VARCHAR(40),\nPRIMARY KEY (Service_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER,\nEffective_Date DATE,\nSettlement_Amount REAL,\nPRIMARY KEY (Settlement_ID),\nUNIQUE (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0378", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the ids and details of the investors who have at least two transactions with type code \"SALE\".", "gold_sql": "SELECT T2.investor_id , T1.Investor_details FROM INVESTORS AS T1 JOIN TRANSACTIONS AS T2 ON T1.investor_id = T2.investor_id WHERE T2.transaction_type_code = \"SALE\" GROUP BY T2.investor_id HAVING COUNT(*) >= 2", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0379", "split": "gate_large", "db_id": "insurance_policies", "question": "Give me the claim date, settlement date for all the claims whose claimed amount is larger than the average.", "gold_sql": "SELECT Date_Claim_Made , Date_Claim_Settled FROM Claims WHERE Amount_Claimed > ( SELECT avg(Amount_Claimed) FROM Claims )", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0380", "split": "gate_large", "db_id": "formula_1", "question": "Find the id and forenames of drivers who participated both the races with name Australian Grand Prix and the races with name Chinese Grand Prix?", "gold_sql": "SELECT T2.driverid , T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = \"Australian Grand Prix\" INTERSECT SELECT T2.driverid , T3.forename FROM races AS T1 JOIN results AS T2 ON T1.raceid = T2.raceid JOIN drivers AS T3 ON T2.driverid = T3.driverid WHERE T1.name = \"Chinese Grand Prix\"", "db_path": "databases/formula_1/formula_1.sqlite", "schema": "CREATE TABLE \"circuits\" (\n\"circuitId\" INTEGER PRIMARY KEY,\n \"circuitRef\" TEXT,\n \"name\" TEXT,\n \"location\" TEXT,\n \"country\" TEXT,\n \"lat\" REAL,\n \"lng\" REAL,\n \"alt\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"constructorResults\" (\n\"constructorResultsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"status\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructorStandings\" (\n\t\"constructorStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"constructorId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\")\n);\nCREATE TABLE \"constructors\" (\n\t\"constructorId\" INTEGER PRIMARY KEY,\n \"constructorRef\" TEXT,\n \"name\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"driverStandings\" (\n\"driverStandingsId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"points\" REAL,\n \"position\" INTEGER,\n \"positionText\" TEXT,\n \"wins\" INTEGER,\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"drivers\" (\n\"driverId\" INTEGER PRIMARY KEY,\n \"driverRef\" TEXT,\n \"number\" TEXT,\n \"code\" TEXT,\n \"forename\" TEXT,\n \"surname\" TEXT,\n \"dob\" TEXT,\n \"nationality\" TEXT,\n \"url\" TEXT\n);\nCREATE TABLE \"lapTimes\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"lap\" INTEGER,\n \"position\" INTEGER,\n \"time\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY(\"raceId\", \"driverId\", \"lap\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"pitStops\" (\n\"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"stop\" INTEGER,\n \"lap\" INTEGER,\n \"time\" TEXT,\n \"duration\" TEXT,\n \"milliseconds\" INTEGER,\n PRIMARY KEY (\"raceId\", \"driverId\", \"stop\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"qualifying\" (\n\"qualifyId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"position\" INTEGER,\n \"q1\" TEXT,\n \"q2\" TEXT,\n \"q3\" TEXT,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"races\" (\n\"raceId\" INTEGER PRIMARY KEY,\n \"year\" INTEGER,\n \"round\" INTEGER,\n \"circuitId\" INTEGER,\n \"name\" TEXT,\n \"date\" TEXT,\n \"time\" TEXT,\n \"url\" TEXT,\n FOREIGN KEY (\"circuitId\") REFERENCES \"circuits\"(\"circuitId\")\n);\nCREATE TABLE \"results\" (\n\"resultId\" INTEGER PRIMARY KEY,\n \"raceId\" INTEGER,\n \"driverId\" INTEGER,\n \"constructorId\" INTEGER,\n \"number\" INTEGER,\n \"grid\" INTEGER,\n \"position\" TEXT,\n \"positionText\" TEXT,\n \"positionOrder\" INTEGER,\n \"points\" REAL,\n \"laps\" TEXT,\n \"time\" TEXT,\n \"milliseconds\" TEXT,\n \"fastestLap\" TEXT,\n \"rank\" TEXT,\n \"fastestLapTime\" TEXT,\n \"fastestLapSpeed\" TEXT,\n \"statusId\" INTEGER,\n FOREIGN KEY(\"constructorId\") REFERENCES \"constructors\"(\"constructorId\"),\n FOREIGN KEY(\"raceId\") REFERENCES \"races\"(\"raceId\"),\n FOREIGN KEY (\"driverId\") REFERENCES \"drivers\"(\"driverId\")\n);\nCREATE TABLE \"seasons\" (\n\"year\" INTEGER PRIMARY KEY,\n \"url\" TEXT\n);\nCREATE TABLE \"status\" (\n\"statusId\" INTEGER PRIMARY KEY,\n \"status\" TEXT\n);"} {"qid": "gate_0381", "split": "gate_large", "db_id": "customers_and_addresses", "question": "Find the contact channel code that was used by the customer named \"Tillman Ernser\".", "gold_sql": "SELECT DISTINCT channel_code FROM customers AS t1 JOIN customer_contact_channels AS t2 ON t1.customer_id = t2.customer_id WHERE t1.customer_name = \"Tillman Ernser\"", "db_path": "databases/customers_and_addresses/customers_and_addresses.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`address_content` VARCHAR(80),\n`city` VARCHAR(50),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Customer_Addresses` (\n`customer_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`address_type` VARCHAR(15) NOT NULL,\n`date_address_to` DATETIME,\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customer_Contact_Channels` (\n`customer_id` INTEGER NOT NULL,\n`channel_code` VARCHAR(15) NOT NULL,\n`active_from_date` DATETIME NOT NULL,\n`active_to_date` DATETIME,\n`contact_number` VARCHAR(50) NOT NULL,\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` VARCHAR(15) NOT NULL,\n`order_date` DATETIME,\n`order_details` 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`date_became_customer` DATETIME,\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Order_Items` (\n`order_id` INTEGER NOT NULL,\n`product_id` INTEGER NOT NULL,\n`order_quantity` VARCHAR(15),\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_details` VARCHAR(255)\n);"} {"qid": "gate_0382", "split": "gate_large", "db_id": "candidate_poll", "question": "what are the names of people who did not participate in the candidate election.", "gold_sql": "SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate)", "db_path": "databases/candidate_poll/candidate_poll.sqlite", "schema": "CREATE TABLE \"candidate\" (\n\"Candidate_ID\" int,\n\"People_ID\" int,\n\"Poll_Source\" text,\n\"Date\" text,\n\"Support_rate\" real,\n\"Consider_rate\" real,\n\"Oppose_rate\" real,\n\"Unsure_rate\" real,\nPRIMARY KEY (\"Candidate_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);\nCREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Sex\" text,\n\"Name\" text,\n\"Date_of_Birth\" text,\n\"Height\" real,\n\"Weight\" real,\nPRIMARY KEY (\"People_ID\")\n);"} {"qid": "gate_0383", "split": "gate_large", "db_id": "insurance_policies", "question": "Tell me the the claim date and settlement date for each settlement case.", "gold_sql": "SELECT Date_Claim_Made , Date_Claim_Settled FROM Settlements", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0384", "split": "gate_large", "db_id": "cre_Doc_Control_Systems", "question": "How many employees does each role have? List role description, id and number of employees.", "gold_sql": "SELECT T1.role_description , T2.role_code , count(*) FROM ROLES AS T1 JOIN Employees AS T2 ON T1.role_code = T2.role_code GROUP BY T2.role_code;", "db_path": "databases/cre_Doc_Control_Systems/cre_Doc_Control_Systems.sqlite", "schema": "CREATE TABLE Addresses (\naddress_id INTEGER NOT NULL,\naddress_details VARCHAR(255),\nPRIMARY KEY (address_id)\n);\nCREATE TABLE Circulation_History (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nemployee_id INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number, employee_id),\nFOREIGN KEY (document_id, draft_number, copy_number) REFERENCES Draft_Copies (document_id,draft_number,copy_number),\nFOREIGN KEY (employee_id) REFERENCES Employees (employee_id)\n);\nCREATE TABLE Document_Drafts (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ndraft_details VARCHAR(255),\nPRIMARY KEY (document_id, draft_number),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id)\n);\nCREATE TABLE Documents (\ndocument_id INTEGER NOT NULL,\ndocument_status_code CHAR(15) NOT NULL,\ndocument_type_code CHAR(15) NOT NULL,\nshipping_agent_code CHAR(15),\nreceipt_date DATETIME,\nreceipt_number VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (document_id),\nFOREIGN KEY (document_type_code) REFERENCES Ref_Document_Types (document_type_code),\nFOREIGN KEY (document_status_code) REFERENCES Ref_Document_Status (document_status_code),\nFOREIGN KEY (shipping_agent_code) REFERENCES Ref_Shipping_Agents (shipping_agent_code)\n);\nCREATE TABLE Documents_Mailed (\ndocument_id INTEGER NOT NULL,\nmailed_to_address_id INTEGER NOT NULL,\nmailing_date DATETIME,\nPRIMARY KEY (document_id, mailed_to_address_id),\nFOREIGN KEY (document_id) REFERENCES Documents (document_id),\nFOREIGN KEY (mailed_to_address_id) REFERENCES Addresses (address_id)\n);\nCREATE TABLE Draft_Copies (\ndocument_id INTEGER NOT NULL,\ndraft_number INTEGER NOT NULL,\ncopy_number INTEGER NOT NULL,\nPRIMARY KEY (document_id, draft_number, copy_number),\nFOREIGN KEY (document_id, draft_number) REFERENCES Document_Drafts (document_id,draft_number)\n);\nCREATE TABLE Employees (\nemployee_id INTEGER NOT NULL,\nrole_code CHAR(15) NOT NULL,\nemployee_name VARCHAR(255),\nother_details VARCHAR(255),\nPRIMARY KEY (employee_id),\nFOREIGN KEY (role_code) REFERENCES Roles (role_code)\n);\nCREATE TABLE Ref_Document_Status (\ndocument_status_code CHAR(15) NOT NULL,\ndocument_status_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_status_code)\n);\nCREATE TABLE Ref_Document_Types (\ndocument_type_code CHAR(15) NOT NULL,\ndocument_type_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (document_type_code)\n);\nCREATE TABLE Ref_Shipping_Agents (\nshipping_agent_code CHAR(15) NOT NULL,\nshipping_agent_name VARCHAR(255) NOT NULL,\nshipping_agent_description VARCHAR(255) NOT NULL,\nPRIMARY KEY (shipping_agent_code)\n);\nCREATE TABLE Roles (\nrole_code CHAR(15) NOT NULL,\nrole_description VARCHAR(255),\nPRIMARY KEY (role_code)\n);"} {"qid": "gate_0385", "split": "gate_large", "db_id": "small_bank_1", "question": "Find the name and checking balance of the account with the lowest saving balance.", "gold_sql": "SELECT T2.balance , T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid ORDER BY T3.balance LIMIT 1", "db_path": "databases/small_bank_1/small_bank_1.sqlite", "schema": "CREATE TABLE ACCOUNTS (\n custid BIGINT NOT NULL PRIMARY KEY,\n name VARCHAR(64) NOT NULL\n);\nCREATE TABLE CHECKING (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);\nCREATE TABLE SAVINGS (\n custid BIGINT NOT NULL PRIMARY KEY,\n balance FLOAT NOT NULL,\n FOREIGN KEY (custid) REFERENCES ACCOUNTS (custid)\n);"} {"qid": "gate_0386", "split": "gate_large", "db_id": "behavior_monitoring", "question": "What are the id and first name of the student whose addresses have the highest average monthly rental?", "gold_sql": "SELECT T1.student_id , T2.first_name FROM Student_Addresses AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY AVG(monthly_rental) DESC LIMIT 1", "db_path": "databases/behavior_monitoring/behavior_monitoring.sqlite", "schema": "CREATE TABLE `Addresses` (\n`address_id` INTEGER PRIMARY KEY,\n`line_1` VARCHAR(120),\n`line_2` VARCHAR(120),\n`line_3` VARCHAR(120),\n`city` VARCHAR(80),\n`zip_postcode` VARCHAR(20),\n`state_province_county` VARCHAR(50),\n`country` VARCHAR(50),\n`other_address_details` VARCHAR(255)\n);\nCREATE TABLE `Assessment_Notes` (\n`notes_id` INTEGER NOT NULL ,\n`student_id` INTEGER,\n`teacher_id` INTEGER NOT NULL,\n`date_of_notes` DATETIME,\n`text_of_notes` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Behavior_Incident` (\n`incident_id` INTEGER PRIMARY KEY,\n`incident_type_code` VARCHAR(10) NOT NULL,\n`student_id` INTEGER NOT NULL,\n`date_incident_start` DATETIME,\n`date_incident_end` DATETIME,\n`incident_summary` VARCHAR(255),\n`recommendations` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`incident_type_code` ) REFERENCES `Ref_Incident_Type`(`incident_type_code` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Detention` (\n`detention_id` INTEGER PRIMARY KEY,\n`detention_type_code` VARCHAR(10) NOT NULL,\n`teacher_id` INTEGER,\n`datetime_detention_start` DATETIME,\n`datetime_detention_end` DATETIME,\n`detention_summary` VARCHAR(255),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`detention_type_code` ) REFERENCES `Ref_Detention_Type`(`detention_type_code` ),\nFOREIGN KEY (`teacher_id` ) REFERENCES `Teachers`(`teacher_id` )\n);\nCREATE TABLE `Ref_Address_Types` (\n`address_type_code` VARCHAR(15) PRIMARY KEY,\n`address_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Detention_Type` (\n`detention_type_code` VARCHAR(10) PRIMARY KEY,\n`detention_type_description` VARCHAR(80)\n);\nCREATE TABLE `Ref_Incident_Type` (\n`incident_type_code` VARCHAR(10) PRIMARY KEY,\n`incident_type_description` VARCHAR(80)\n);\nCREATE TABLE `Student_Addresses` (\n`student_id` INTEGER NOT NULL,\n`address_id` INTEGER NOT NULL,\n`date_address_from` DATETIME NOT NULL,\n`date_address_to` DATETIME,\n`monthly_rental` DECIMAL(19,4),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Students` (\n`student_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(40),\n`last_name` VARCHAR(40),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`date_first_rental` DATETIME,\n`date_left_university` DATETIME,\n`other_student_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);\nCREATE TABLE `Students_in_Detention` (\n`student_id` INTEGER NOT NULL,\n`detention_id` INTEGER NOT NULL,\n`incident_id` INTEGER NOT NULL,\nFOREIGN KEY (`incident_id` ) REFERENCES `Behavior_Incident`(`incident_id` ),\nFOREIGN KEY (`detention_id` ) REFERENCES `Detention`(`detention_id` ),\nFOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )\n);\nCREATE TABLE `Teachers` (\n`teacher_id` INTEGER PRIMARY KEY,\n`address_id` INTEGER NOT NULL,\n`first_name` VARCHAR(80),\n`middle_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`gender` VARCHAR(1),\n`cell_mobile_number` VARCHAR(40),\n`email_address` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`address_id` ) REFERENCES `Addresses`(`address_id` )\n);"} {"qid": "gate_0387", "split": "gate_large", "db_id": "tracking_share_transactions", "question": "Show the description of transaction type with code \"PUR\".", "gold_sql": "SELECT transaction_type_description FROM Ref_Transaction_Types WHERE transaction_type_code\t = \"PUR\"", "db_path": "databases/tracking_share_transactions/tracking_share_transactions.sqlite", "schema": "CREATE TABLE `Investors` (\n`investor_id` INTEGER PRIMARY KEY,\n`Investor_details` VARCHAR(255)\n);\nCREATE TABLE `Lots` (\n`lot_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`lot_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` )\n);\nCREATE TABLE `Purchases` (\n`purchase_transaction_id` INTEGER NOT NULL,\n`purchase_details` VARCHAR(255) NOT NULL,\nFOREIGN KEY (`purchase_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Ref_Transaction_Types` (\n`transaction_type_code` VARCHAR(10) PRIMARY KEY,\n`transaction_type_description` VARCHAR(80) NOT NULL\n);\nCREATE TABLE `Sales` (\n`sales_transaction_id` INTEGER PRIMARY KEY,\n`sales_details` VARCHAR(255),\nFOREIGN KEY (`sales_transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);\nCREATE TABLE `Transactions` (\n`transaction_id` INTEGER PRIMARY KEY,\n`investor_id` INTEGER NOT NULL,\n`transaction_type_code` VARCHAR(10) NOT NULL,\n`date_of_transaction` DATETIME,\n`amount_of_transaction` DECIMAL(19,4),\n`share_count` VARCHAR(40),\n`other_details` VARCHAR(255),\nFOREIGN KEY (`investor_id` ) REFERENCES `Investors`(`investor_id` ),FOREIGN KEY (`transaction_type_code` ) REFERENCES `Ref_Transaction_Types`(`transaction_type_code` )\n);\nCREATE TABLE `Transactions_Lots` (\n`transaction_id` INTEGER NOT NULL,\n`lot_id` INTEGER NOT NULL,\nFOREIGN KEY (`lot_id` ) REFERENCES `Lots`(`lot_id` ),\nFOREIGN KEY (`transaction_id` ) REFERENCES `Transactions`(`transaction_id` )\n);"} {"qid": "gate_0388", "split": "gate_large", "db_id": "insurance_policies", "question": "How many settlements were made on the claim with the most recent claim settlement date? List the number and the claim id.", "gold_sql": "SELECT count(*) , T1.claim_id FROM Claims AS T1 JOIN Settlements AS T2 ON T1.claim_id = T2.claim_id GROUP BY T1.claim_id ORDER BY T1.Date_Claim_Settled DESC LIMIT 1", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0389", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What is the total count of enzymes?", "gold_sql": "SELECT count(*) FROM enzyme", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"} {"qid": "gate_0390", "split": "gate_large", "db_id": "store_product", "question": "What is the average pages per minute color?", "gold_sql": "SELECT avg(pages_per_minute_color) FROM product", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0391", "split": "gate_large", "db_id": "store_product", "question": "What are the names of all districts with a city area greater than 10 or have more than 100000 people living there?", "gold_sql": "SELECT district_name FROM district WHERE city_area > 10 OR City_Population > 100000", "db_path": "databases/store_product/store_product.sqlite", "schema": "CREATE TABLE \"district\" (\n\"District_ID\" int,\n\"District_name\" text,\n\"Headquartered_City\" text,\n\"City_Population\" real,\n\"City_Area\" real,\nPRIMARY KEY (\"District_ID\")\n);\nCREATE TABLE \"product\" (\n\"product_id\" int,\n\"product\" text,\n\"dimensions\" text,\n\"dpi\" real,\n\"pages_per_minute_color\" real,\n\"max_page_size\" text,\n\"interface\" text,\nPRIMARY KEY (\"product_id\")\n);\nCREATE TABLE \"store\" (\n\"Store_ID\" int,\n\"Store_Name\" text,\n\"Type\" text,\n\"Area_size\" real,\n\"Number_of_product_category\" real,\n\"Ranking\" int,\nPRIMARY KEY (\"Store_ID\")\n);\nCREATE TABLE \"store_district\" (\n\"Store_ID\" int,\n\"District_ID\" int,\nPRIMARY KEY (\"Store_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`District_ID`) REFERENCES `district`(`District_ID`)\n);\nCREATE TABLE \"store_product\" (\n\"Store_ID\" int,\n\"Product_ID\" int,\nPRIMARY KEY (\"Store_ID\",\"Product_ID\"),\nFOREIGN KEY (`Store_ID`) REFERENCES `store`(`Store_ID`),\nFOREIGN KEY (`Product_ID`) REFERENCES `product`(`Product_ID`)\n);"} {"qid": "gate_0392", "split": "gate_large", "db_id": "customers_card_transactions", "question": "What is the customer id with most number of cards, and how many does he have?", "gold_sql": "SELECT customer_id , count(*) FROM Customers_cards GROUP BY customer_id ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/customers_card_transactions/customers_card_transactions.sqlite", "schema": "CREATE TABLE `Accounts` (\n`account_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`account_name` VARCHAR(50),\n`other_account_details` VARCHAR(255)\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_first_name` VARCHAR(20),\n`customer_last_name` VARCHAR(20),\n`customer_address` VARCHAR(255),\n`customer_phone` VARCHAR(255),\n`customer_email` VARCHAR(255),\n`other_customer_details` VARCHAR(255)\n);\nCREATE TABLE `Customers_Cards` (\n`card_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`card_type_code` VARCHAR(15) NOT NULL,\n`card_number` VARCHAR(80),\n`date_valid_from` DATETIME,\n`date_valid_to` DATETIME,\n`other_card_details` VARCHAR(255)\n);\nCREATE TABLE `Financial_Transactions` (\n`transaction_id` INTEGER NOT NULL ,\n`previous_transaction_id` INTEGER,\n`account_id` INTEGER NOT NULL,\n`card_id` INTEGER NOT NULL,\n`transaction_type` VARCHAR(15) NOT NULL,\n`transaction_date` DATETIME,\n`transaction_amount` DOUBLE NULL,\n`transaction_comment` VARCHAR(255),\n`other_transaction_details` VARCHAR(255),\nFOREIGN KEY (`card_id` ) REFERENCES `Customers_Cards`(`card_id` ),\nFOREIGN KEY (`account_id` ) REFERENCES `Accounts`(`account_id` )\n);"} {"qid": "gate_0393", "split": "gate_large", "db_id": "school_bus", "question": "Show the name, home city, and age for all drivers.", "gold_sql": "SELECT name , home_city , age FROM driver", "db_path": "databases/school_bus/school_bus.sqlite", "schema": "CREATE TABLE \"driver\" (\n\"Driver_ID\" int,\n\"Name\" text,\n\"Party\" text,\n\"Home_city\" text,\n\"Age\" int,\nPRIMARY KEY (\"Driver_ID\")\n);\nCREATE TABLE \"school\" (\n\"School_ID\" int,\n\"Grade\" text,\n\"School\" text,\n\"Location\" text,\n\"Type\" text,\nPRIMARY KEY (\"School_ID\")\n);\nCREATE TABLE \"school_bus\" (\n\"School_ID\" int,\n\"Driver_ID\" int,\n\"Years_Working\" int,\n\"If_full_time\" bool,\nPRIMARY KEY (\"School_ID\",\"Driver_ID\"),\nFOREIGN KEY (\"School_ID\") REFERENCES `school`(\"School_ID\"),\nFOREIGN KEY (\"Driver_ID\") REFERENCES `driver`(\"Driver_ID\")\n);"} {"qid": "gate_0394", "split": "gate_large", "db_id": "perpetrator", "question": "What are the heights of perpetrators in descending order of the number of people they injured?", "gold_sql": "SELECT T1.Height FROM people AS T1 JOIN perpetrator AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Injured DESC", "db_path": "databases/perpetrator/perpetrator.sqlite", "schema": "CREATE TABLE \"people\" (\n\"People_ID\" int,\n\"Name\" text,\n\"Height\" real,\n\"Weight\" real,\n\"Home Town\" text,\nPRIMARY KEY (\"People_ID\")\n);\nCREATE TABLE \"perpetrator\" (\n\"Perpetrator_ID\" int,\n\"People_ID\" int,\n\"Date\" text,\n\"Year\" real,\n\"Location\" text,\n\"Country\" text,\n\"Killed\" int,\n\"Injured\" int,\nPRIMARY KEY (\"Perpetrator_ID\"),\nFOREIGN KEY (\"People_ID\") REFERENCES \"people\"(\"People_ID\")\n);"} {"qid": "gate_0395", "split": "gate_large", "db_id": "insurance_policies", "question": "Return the distinct customer details.", "gold_sql": "SELECT DISTINCT customer_details FROM Customers", "db_path": "databases/insurance_policies/insurance_policies.sqlite", "schema": "CREATE TABLE Claims (\nClaim_ID INTEGER NOT NULL,\nPolicy_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nPRIMARY KEY (Claim_ID),\nFOREIGN KEY (Policy_ID) REFERENCES Customer_Policies (Policy_ID)\n);\nCREATE TABLE Customer_Policies (\nPolicy_ID INTEGER NOT NULL,\nCustomer_ID INTEGER NOT NULL,\nPolicy_Type_Code CHAR(15) NOT NULL,\nStart_Date DATE,\nEnd_Date DATE,\nPRIMARY KEY (Policy_ID),\nFOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID)\n);\nCREATE TABLE Customers (\nCustomer_ID INTEGER NOT NULL,\nCustomer_Details VARCHAR(255) NOT NULL,\nPRIMARY KEY (Customer_ID)\n);\nCREATE TABLE Payments (\nPayment_ID INTEGER NOT NULL,\nSettlement_ID INTEGER NOT NULL,\nPayment_Method_Code VARCHAR(255),\nDate_Payment_Made DATE,\nAmount_Payment INTEGER,\nPRIMARY KEY (Payment_ID),\nFOREIGN KEY (Settlement_ID) REFERENCES Settlements (Settlement_ID)\n);\nCREATE TABLE Settlements (\nSettlement_ID INTEGER NOT NULL,\nClaim_ID INTEGER NOT NULL,\nDate_Claim_Made DATE,\nDate_Claim_Settled DATE,\nAmount_Claimed INTEGER,\nAmount_Settled INTEGER,\nCustomer_Policy_ID INTEGER NOT NULL,\nPRIMARY KEY (Settlement_ID),\nFOREIGN KEY (Claim_ID) REFERENCES Claims (Claim_ID)\n);"} {"qid": "gate_0396", "split": "gate_large", "db_id": "farm", "question": "What are the themes of competitions that have corresponding host cities with more than 1000 residents?", "gold_sql": "SELECT T2.Theme FROM city AS T1 JOIN farm_competition AS T2 ON T1.City_ID = T2.Host_city_ID WHERE T1.Population > 1000", "db_path": "databases/farm/farm.sqlite", "schema": "CREATE TABLE \"city\" (\n\"City_ID\" int,\n\"Official_Name\" text,\n\"Status\" text,\n\"Area_km_2\" real,\n\"Population\" real,\n\"Census_Ranking\" text,\nPRIMARY KEY (\"City_ID\")\n);\nCREATE TABLE \"competition_record\" (\n\"Competition_ID\" int,\n\"Farm_ID\" int,\n\"Rank\" int,\nPRIMARY KEY (\"Competition_ID\",\"Farm_ID\"),\nFOREIGN KEY (`Competition_ID`) REFERENCES `farm_competition`(`Competition_ID`),\nFOREIGN KEY (`Farm_ID`) REFERENCES `farm`(`Farm_ID`)\n);\nCREATE TABLE \"farm\" (\n\"Farm_ID\" int,\n\"Year\" int,\n\"Total_Horses\" real,\n\"Working_Horses\" real,\n\"Total_Cattle\" real,\n\"Oxen\" real,\n\"Bulls\" real,\n\"Cows\" real,\n\"Pigs\" real,\n\"Sheep_and_Goats\" real,\nPRIMARY KEY (\"Farm_ID\")\n);\nCREATE TABLE \"farm_competition\" (\n\"Competition_ID\" int,\n\"Year\" int,\n\"Theme\" text,\n\"Host_city_ID\" int,\n\"Hosts\" text,\nPRIMARY KEY (\"Competition_ID\"),\nFOREIGN KEY (`Host_city_ID`) REFERENCES `city`(`City_ID`)\n);"} {"qid": "gate_0397", "split": "gate_large", "db_id": "hr_1", "question": "What are department ids for departments with managers managing more than 3 employees?", "gold_sql": "SELECT DISTINCT department_id FROM employees GROUP BY department_id , manager_id HAVING COUNT(employee_id) >= 4", "db_path": "databases/hr_1/hr_1.sqlite", "schema": "CREATE TABLE `countries` (\n `COUNTRY_ID` varchar(2) NOT NULL,\n `COUNTRY_NAME` varchar(40) DEFAULT NULL,\n `REGION_ID` decimal(10,0) DEFAULT NULL,\n PRIMARY KEY (`COUNTRY_ID`),\n FOREIGN KEY (`REGION_ID`) REFERENCES regions (`REGION_ID`)\n);\nCREATE TABLE `departments` (\n `DEPARTMENT_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `DEPARTMENT_NAME` varchar(30) NOT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `LOCATION_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`DEPARTMENT_ID`)\n);\nCREATE TABLE `employees` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL DEFAULT '0',\n `FIRST_NAME` varchar(20) DEFAULT NULL,\n `LAST_NAME` varchar(25) NOT NULL,\n `EMAIL` varchar(25) NOT NULL,\n `PHONE_NUMBER` varchar(20) DEFAULT NULL,\n `HIRE_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `SALARY` decimal(8,2) DEFAULT NULL,\n `COMMISSION_PCT` decimal(2,2) DEFAULT NULL,\n `MANAGER_ID` decimal(6,0) DEFAULT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `job_history` (\n `EMPLOYEE_ID` decimal(6,0) NOT NULL,\n `START_DATE` date NOT NULL,\n `END_DATE` date NOT NULL,\n `JOB_ID` varchar(10) NOT NULL,\n `DEPARTMENT_ID` decimal(4,0) DEFAULT NULL,\n PRIMARY KEY (`EMPLOYEE_ID`,`START_DATE`),\n FOREIGN KEY (`EMPLOYEE_ID`) REFERENCES employees(`EMPLOYEE_ID`),\n FOREIGN KEY (`DEPARTMENT_ID`) REFERENCES departments(`DEPARTMENT_ID`),\n FOREIGN KEY (`JOB_ID`) REFERENCES jobs(`JOB_ID`)\n);\nCREATE TABLE `jobs` (\n `JOB_ID` varchar(10) NOT NULL DEFAULT '',\n `JOB_TITLE` varchar(35) NOT NULL,\n `MIN_SALARY` decimal(6,0) DEFAULT NULL,\n `MAX_SALARY` decimal(6,0) DEFAULT NULL,\n PRIMARY KEY (`JOB_ID`)\n);\nCREATE TABLE `locations` (\n `LOCATION_ID` decimal(4,0) NOT NULL DEFAULT '0',\n `STREET_ADDRESS` varchar(40) DEFAULT NULL,\n `POSTAL_CODE` varchar(12) DEFAULT NULL,\n `CITY` varchar(30) NOT NULL,\n `STATE_PROVINCE` varchar(25) DEFAULT NULL,\n `COUNTRY_ID` varchar(2) DEFAULT NULL,\n PRIMARY KEY (`LOCATION_ID`),\n FOREIGN KEY (`COUNTRY_ID`) REFERENCES countries(`COUNTRY_ID`)\n);\nCREATE TABLE `regions` (\n `REGION_ID` decimal(5,0) NOT NULL,\n `REGION_NAME` varchar(25) DEFAULT NULL,\n PRIMARY KEY (`REGION_ID`)\n);"} {"qid": "gate_0398", "split": "gate_large", "db_id": "customer_complaints", "question": "What are all the different product names, and how many complains has each received?", "gold_sql": "SELECT t1.product_name , count(*) FROM products AS t1 JOIN complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name", "db_path": "databases/customer_complaints/customer_complaints.sqlite", "schema": "CREATE TABLE `Complaints` (\n`complaint_id` INTEGER NOT NULL ,\n`product_id` INTEGER NOT NULL,\n`customer_id` INTEGER NOT NULL,\n`complaint_outcome_code` VARCHAR(20) NOT NULL,\n`complaint_status_code` VARCHAR(20) NOT NULL,\n`complaint_type_code` VARCHAR(20) NOT NULL,\n`date_complaint_raised` DATETIME,\n`date_complaint_closed` DATETIME,\n`staff_id` INTEGER NOT NULL ,\nFOREIGN KEY (`staff_id` ) REFERENCES `Staff`(`staff_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` ),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);\nCREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_type_code` VARCHAR(20) NOT NULL,\n`address_line_1` VARCHAR(80),\n`address_line_2` VARCHAR(80),\n`town_city` VARCHAR(80),\n`state` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);\nCREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`parent_product_id` INTEGER,\n`product_category_code` VARCHAR(20) NOT NULL,\n`date_product_first_available` DATETIME,\n`date_product_discontinued` DATETIME,\n`product_name` VARCHAR(80),\n`product_description` VARCHAR(255),\n`product_price` DECIMAL(19,4)\n);\nCREATE TABLE `Staff` (\n`staff_id` INTEGER PRIMARY KEY,\n`gender` VARCHAR(1),\n`first_name` VARCHAR(80),\n`last_name` VARCHAR(80),\n`email_address` VARCHAR(255),\n`phone_number` VARCHAR(80)\n);"} {"qid": "gate_0399", "split": "gate_large", "db_id": "medicine_enzyme_interaction", "question": "What is the most common interaction type between enzymes and medicine? And how many are there?", "gold_sql": "SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1", "db_path": "databases/medicine_enzyme_interaction/medicine_enzyme_interaction.sqlite", "schema": "CREATE TABLE \"enzyme\" (\n\"id\" int,\n\"name\" text,\n\"Location\" text,\n\"Product\" text,\n\"Chromosome\" text,\n\"OMIM\" int,\n\"Porphyria\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine\" (\n\"id\" int,\n\"name\" text,\n\"Trade_Name\" text,\n\"FDA_approved\" text,\nprimary key (\"id\")\n);\nCREATE TABLE \"medicine_enzyme_interaction\" (\n\"enzyme_id\" int,\n\"medicine_id\" int,\n\"interaction_type\" text,\nprimary key (\"enzyme_id\", \"medicine_id\"),\nforeign key (\"enzyme_id\") references `enzyme`(\"id\"),\nforeign key (\"medicine_id\") references `medicine`(\"id\")\n);"}