File size: 158,432 Bytes
b12d4a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{"qid": "gate_0000", "split": "gate", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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", "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);"}