context stringlengths 11 9.12k | question stringlengths 0 1.06k | SQL stringlengths 2 4.44k | source stringclasses 28
values |
|---|---|---|---|
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
... | Which classes gives me the easiest path to cover the ULCS requirement ? | SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_co... | advising |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
... | when in a year before patient 26995 received for the last time a procedure? | SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26995) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime DESC LIMIT ... | mimic_iii |
CREATE TABLE table_70932 (
"Team" text,
"Manager 1" text,
"Captain" text,
"Kit manufacturer" text,
"Shirt sponsor" text
) | Who was the shirt sponsor for the Blackburn Rovers? | SELECT "Shirt sponsor" FROM table_70932 WHERE "Team" = 'blackburn rovers' | wikisql |
CREATE TABLE table_name_17 (
position VARCHAR,
school VARCHAR
) | Name the position for indiana state | SELECT position FROM table_name_17 WHERE school = "indiana state" | sql_create_context |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | calculate the number of patients with abdominal pain as primary disease and aged below 72 | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL PAIN" AND demographic.age < "72" | mimicsql_data |
CREATE TABLE table_name_67 (
örebro VARCHAR,
umeå VARCHAR
) | What did Orebro score when Umea scored 2? | SELECT örebro FROM table_name_67 WHERE umeå = "2" | sql_create_context |
CREATE TABLE table_62607 (
"Year" real,
"Network" text,
"Play-by-play" text,
"Colour commentator(s)" text,
"Pregame host" text
) | For which network was Chris Walby the color commentator after 1990? | SELECT "Network" FROM table_62607 WHERE "Year" > '1990' AND "Colour commentator(s)" = 'chris walby' | wikisql |
CREATE TABLE table_name_40 (
position VARCHAR,
event VARCHAR,
venue VARCHAR
) | What is Position, when Event is 60 m, and when Venue is Budapest , Hungary? | SELECT position FROM table_name_40 WHERE event = "60 m" AND venue = "budapest , hungary" | sql_create_context |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
... | how much patient 28775 weighs during the last hospital encounter for the last time? | SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28775 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevent... | mimic_iii |
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemics... | count the number of patients who had a head ct scan procedure in the same hospital visit after being given a endotracheal tube removal procedure during this year. | SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'endotracheal tube removal' AND DATETIME(treatment.treatmenttime, 'start o... | eicu |
CREATE TABLE table_11622255_1 (
date VARCHAR,
location VARCHAR
) | what's the date where location is illinois | SELECT date FROM table_11622255_1 WHERE location = "Illinois" | sql_create_context |
CREATE TABLE table_3935 (
"Round" real,
"Race" text,
"Pole position" text,
"Fastest lap" text,
"Most laps led" text,
"Driver" text,
"Team" text,
"Manufacturer" text,
"Report" text
) | Who was the driver in round 8? | SELECT "Driver" FROM table_3935 WHERE "Round" = '8' | wikisql |
CREATE TABLE table_18813011_6 (
high_assists VARCHAR,
record VARCHAR
) | Who had the high assist in the game where the record is 13-11? | SELECT high_assists FROM table_18813011_6 WHERE record = "13-11" | sql_create_context |
CREATE TABLE table_222771_1 (
alpha_3_code VARCHAR,
alpha_2_code VARCHAR
) | What is the Alpha 3 code for the area also known as FO? | SELECT alpha_3_code FROM table_222771_1 WHERE alpha_2_code = "FO" | sql_create_context |
CREATE TABLE t_kc24 (
ACCOUNT_DASH_DATE time,
ACCOUNT_DASH_FLG number,
CASH_PAY number,
CIVIL_SUBSIDY number,
CKC102 number,
CLINIC_ID text,
CLINIC_SLT_DATE time,
COMP_ID text,
COM_ACC_PAY number,
COM_PAY number,
DATA_ID text,
ENT_ACC_PAY number,
ENT_PAY number,
F... | 名为袁清怡的病人在0621277医院的就诊记录中,有哪些就诊科室名称中包含整形 | SELECT * FROM gwyjzb WHERE gwyjzb.PERSON_NM = '袁清怡' AND gwyjzb.MED_SER_ORG_NO = '0621277' AND gwyjzb.MED_ORG_DEPT_NM LIKE '%整形%' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '袁清怡' AND fgwyjzb.MED_SER_ORG_NO = '0621277' AND fgwyjzb.MED_ORG_DEPT_NM LIKE '%整形%' | css |
CREATE TABLE documents (
document_code text,
document_structure_code text,
document_type_code text,
access_count number,
document_name text
)
CREATE TABLE images (
image_id number,
image_alt_text text,
image_name text,
image_url text
)
CREATE TABLE document_functional_areas (
d... | Give the section titles of the document with the name 'David CV'. | SELECT t2.section_title FROM documents AS t1 JOIN document_sections AS t2 ON t1.document_code = t2.document_code WHERE t1.document_name = "David CV" | spider |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | 患者褚博瀚腰部的各项指标检验结果是怎么样的? | SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZ... | css |
CREATE TABLE table_14986292_1 (
population_density_2010___km²_ VARCHAR,
administrative_division VARCHAR
) | Name the number of population density 2010 for duque de caxias | SELECT COUNT(population_density_2010___km²_) FROM table_14986292_1 WHERE administrative_division = "Duque de Caxias" | sql_create_context |
CREATE TABLE table_46024 (
"Pick #" real,
"CFL Team" text,
"Player" text,
"Position" text,
"College" text
) | What is Player, when Position is DB, and when College is Saint Mary's? | SELECT "Player" FROM table_46024 WHERE "Position" = 'db' AND "College" = 'saint mary''s' | wikisql |
CREATE TABLE table_204_51 (
id number,
"week #" text,
"theme" text,
"song choice" text,
"original artist" text,
"order #" number,
"result" text
) | is the order # of top 6 greater than that of top 8 ? | SELECT (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 6') > (SELECT "order #" FROM table_204_51 WHERE "week #" = 'top 8') | squall |
CREATE TABLE table_47873 (
"Season" text,
"Coach" text,
"Captain" text,
"Alternate (1)" text,
"Alternate (2)" text
) | Which coach works with Robert Harvey? | SELECT "Coach" FROM table_47873 WHERE "Captain" = 'robert harvey' | wikisql |
CREATE TABLE table_63694 (
"School" text,
"City" text,
"Team Name" text,
"County" text,
"Year Joined" text,
"Year Left" text
) | What year did the team based in the city of Winamac join the conference? | SELECT "Year Joined" FROM table_63694 WHERE "City" = 'winamac' | wikisql |
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBase... | Comments to Answers to my Questions by specific user. | WITH YourQuestions AS (SELECT Id FROM Posts WHERE OwnerUserId = '##UserId##' AND PostTypeId = 1), AnswersToYourQuestions AS (SELECT * FROM Posts WHERE ParentId IN (SELECT Id FROM YourQuestions)) SELECT PostId AS "post_link", CreationDate, Id AS "comment_link" FROM Comments WHERE UserId = '##CommenterUserId##' AND PostI... | sede |
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number,
Name text,
Body text,
IsHidden boolean,
Predefined boolean,
PostNoticeDurationId number
)
CREATE TABLE Posts (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
Deletio... | Hour, Length -> Score, Answers. | SELECT p.Id AS Id, TIME_TO_STR(p.CreationDate, '%-HOUR') AS Hour, LENGTH(p.Title) AS LengthOfTitle, LENGTH(p.Body) AS LengthOfBody, p.Score AS Score, p.ViewCount AS Views, p.AnswerCount AS Answers FROM Posts AS p WHERE LENGTH(p.Title) > 0 AND p.CreationDate > CAST('2014-10-01 00:00:00.000' AS DATETIME) AND p.CreationDa... | sede |
CREATE TABLE table_name_30 (
player VARCHAR,
school_club_team VARCHAR
) | What is the Player from McGill? | SELECT player FROM table_name_30 WHERE school_club_team = "mcgill" | sql_create_context |
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostHistoryTypes (
Id numb... | Testing, is this thing on? (100 users...). | SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY Id) AS row FROM Users) AS a WHERE a.row > 5 AND a.row <= 100 | sede |
CREATE TABLE table_name_45 (
game INTEGER,
date VARCHAR
) | What is the lowest Game, when Date is 'November 1'? | SELECT MIN(game) FROM table_name_45 WHERE date = "november 1" | sql_create_context |
CREATE TABLE table_name_47 (
week VARCHAR,
opponent VARCHAR
) | What game week did the Buccaneers play against the Minnesota Vikings? | SELECT week FROM table_name_47 WHERE opponent = "minnesota vikings" | sql_create_context |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE patients (
row_id number,
subject_id number,
g... | how many patients had been released until 2102 from the hospital? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND STRFTIME('%y', admissions.dischtime) <= '2102' | mimic_iii |
CREATE TABLE table_38964 (
"Week 2 Sept 7" text,
"Week 3 Sept 14" text,
"Week 4 Sept 21" text,
"Week 5 Sept 28" text,
"Week 6 Oct 5" text,
"Week 7 Oct 12" text,
"Week 10 Nov 2" text,
"Week 12 Nov 16" text,
"Week 14 Nov 30" text,
"Week 15 Dec 7" text,
"Week 16 (Final) Jan 9" t... | What is the week 4 opponent for the year with a week 10 opponent of Michigan State (8-2)? | SELECT "Week 4 Sept 21" FROM table_38964 WHERE "Week 10 Nov 2" = 'michigan state (8-2)' | wikisql |
CREATE TABLE jybgb (
BBCJBW text,
BBDM text,
BBMC text,
BBZT number,
BGDH text,
BGJGDM text,
BGJGMC text,
BGRGH text,
BGRQ time,
BGRXM text,
BGSJ time,
CJRQ time,
JSBBRQSJ time,
JSBBSJ time,
JYBBH text,
JYJGMC text,
JYJSGH text,
JYJSQM text,
JY... | 在2007年7月16日到2020年8月1日内,医院5860255有几个科室在门诊就诊中开出不超过19张检验报告单? | SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb.B... | css |
CREATE TABLE t_kc24 (
MED_SAFE_PAY_ID text,
OVERALL_CD_ORG text,
OVERALL_CD_PERSON text,
MED_CLINIC_ID text,
REF_SLT_FLG number,
CLINIC_SLT_DATE time,
COMP_ID text,
PERSON_ID text,
FLX_MED_ORG_ID text,
INSU_TYPE text,
MED_AMOUT number,
PER_ACC_PAY number,
OVE_PAY numb... | 开塞露(含甘油)在医疗就诊81908180508中的医疗机构三大目录编码是什么?名称是什么? | SELECT MED_DIRE_CD, MED_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '81908180508' AND SOC_SRT_DIRE_NM = '开塞露(含甘油)' | css |
CREATE TABLE table_203_356 (
id number,
"type" text,
"diagonal (mm)" text,
"width (mm)" text,
"height (mm)" text,
"area (mm2)" text,
"stops (area)" number,
"crop factor" text
) | how many sensors have a crop area of less than 1.0 ? | SELECT COUNT("type") FROM table_203_356 WHERE "crop factor" < 1.0 | squall |
CREATE TABLE table_65849 (
"Date Released" text,
"Institute" text,
"Social Democratic" text,
"Socialist" text,
"Green-Communist" text,
"Democratic Renewal" text,
"Democratic and Social Centre" text,
"Lead" text
) | What Social Democratic has the Democratic and Social Centre of 4.4% 4 seats? | SELECT "Social Democratic" FROM table_65849 WHERE "Democratic and Social Centre" = '4.4% 4 seats' | wikisql |
CREATE TABLE table_36676 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | Which Gold has a Bronze larger than 6? | SELECT MIN("Gold") FROM table_36676 WHERE "Bronze" > '6' | wikisql |
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int
)
CREATE... | How many different professors are there for the different schools Show bar chart, and show in asc by the SCHOOL_CODE. | SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE ORDER BY SCHOOL_CODE | nvbench |
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PostHistoryTypes (
Id number,
... | Count of New Questions and Answers Since a Specified Year. | SELECT YEAR(CreationDate) AS "year", MONTH(CreationDate) AS "month", SUM(CASE WHEN Posts.PostTypeId = 1 THEN 1 ELSE 0 END) AS QuestionCount, SUM(CASE WHEN Posts.PostTypeId = 2 THEN 1 ELSE 0 END) AS AnswerCount FROM Posts WHERE YEAR(CreationDate) >= 2014 GROUP BY YEAR(CreationDate), MONTH(CreationDate) ORDER BY YEAR(Cre... | sede |
CREATE TABLE Invoice_Line_Items (
order_item_id INTEGER,
invoice_number INTEGER,
product_id INTEGER,
product_title VARCHAR(80),
product_quantity VARCHAR(50),
product_price DECIMAL(19,4),
derived_product_cost DECIMAL(19,4),
derived_vat_payable DECIMAL(19,4),
derived_total_cost DECIMAL... | How many accounts for each customer? Show a bar chart that groups by customer's last name, I want to rank from high to low by the total number. | SELECT customer_last_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) DESC | nvbench |
CREATE TABLE table_9433 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Lions' Points" text,
"Opponents' Points" text,
"Record" text,
"Streak" text,
"Attendance" text
) | What is the total number for the week with a record of 0-11? | SELECT COUNT("Week") FROM table_9433 WHERE "Record" = '0-11' | wikisql |
CREATE TABLE table_41139 (
"S No" real,
"Team (A)" text,
"Team (B)" text,
"Winner" text,
"Margin" text,
"Match Date" text
) | What is Team (B), when S No is less than 18, when Margin is 8 Wickets, and when Match Date is Oct 30, 1989? | SELECT "Team (B)" FROM table_41139 WHERE "S No" < '18' AND "Margin" = '8 wickets' AND "Match Date" = 'oct 30, 1989' | wikisql |
CREATE TABLE table_40239 (
"Player" text,
"Position" text,
"GP (GS)" text,
"Minutes" real,
"Goals" real,
"Assists" real
) | What is the number of minutes when there are more than 4 goals and 3 assists? | SELECT "Minutes" FROM table_40239 WHERE "Goals" > '4' AND "Assists" = '3' | wikisql |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,... | how many days it's been since patient 012-66291's first bun lab test in the current hospital visit? | SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-66291' AND patient.hospi... | eicu |
CREATE TABLE table_name_28 (
i_o_bus VARCHAR,
sspec_number VARCHAR
) | what is the i/o bus when the sspec numebr is sr0n5(l1)? | SELECT i_o_bus FROM table_name_28 WHERE sspec_number = "sr0n5(l1)" | sql_create_context |
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE d_labitems (
row_id number... | what is the number of drugs patient 64185 has been prescribed since 6 years ago? | SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 64185) AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-6 year') | mimic_iii |
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostLinks (
Id number,
CreationDate time,
Pos... | Average Reputation of SO user in United Kingdom with reputation equal or more than 15. | SELECT AVG(Reputation) AS "average_reputation", COUNT(Id) AS "total_users" FROM Users WHERE LOWER(Location) LIKE '%united kingdom' AND Reputation >= 15 | sede |
CREATE TABLE table_37473 (
"Position" real,
"Team" text,
"Points" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Against" real,
"Difference" text
) | What is the largest drawn that has a played less than 38? | SELECT MAX("Drawn") FROM table_37473 WHERE "Played" < '38' | wikisql |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | how many patients whose admission year is less than 2124 and lab test category is hematology? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Hematology" | mimicsql_data |
CREATE TABLE table_35741 (
"Name" text,
"Location" text,
"State" text,
"Opened (closing date if defunct)" text,
"Surface" text,
"Length" text
) | What is the Location for the woodburn dragstrip? | SELECT "Location" FROM table_35741 WHERE "Name" = 'woodburn dragstrip' | wikisql |
CREATE TABLE table_31009 (
"No. in series" real,
"No. in season" real,
"Title" text,
"Directed by" text,
"Written by" text,
"Original air date" text,
"U.S. viewers (millions)" text
) | How many episodes in the season had the title, 'first blood'? | SELECT COUNT("No. in season") FROM table_31009 WHERE "Title" = 'First Blood' | wikisql |
CREATE TABLE table_79113 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What place had a To par of 10? | SELECT "Place" FROM table_79113 WHERE "To par" = '–10' | wikisql |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
... | when was patient 75658 discharged from the hospital in the previous year for the first time? | SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 75658 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1 | mimic_iii |
CREATE TABLE table_name_49 (
home_team VARCHAR
) | What is fitzroy's score as the home team? | SELECT home_team AS score FROM table_name_49 WHERE home_team = "fitzroy" | sql_create_context |
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
... | For those employees who was hired before 2002-06-21, find job_id and the sum of manager_id , and group by attribute job_id, and visualize them by a bar chart, and list Y in desc order. | SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC | nvbench |
CREATE TABLE Certificate (
eid VARCHAR,
aid VARCHAR
)
CREATE TABLE Employee (
name VARCHAR,
eid VARCHAR
)
CREATE TABLE Aircraft (
aid VARCHAR,
distance INTEGER
) | What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000? | SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY COUNT(*) DESC LIMIT 1 | sql_create_context |
CREATE TABLE table_26861 (
"Season" real,
"Series" text,
"Team" text,
"Races" real,
"Wins" real,
"Poles" real,
"FLaps" real,
"Podiums" real,
"Points" text,
"Position" text
) | Name the total number of races for 15th position | SELECT COUNT("Races") FROM table_26861 WHERE "Position" = '15th' | wikisql |
CREATE TABLE Badges (
Id number,
UserId number,
Name text,
Date time,
Class number,
TagBased boolean
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABL... | developers over 500 reps in Ahmedabad. | SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE (LOWER(Location) LIKE '%ahmedabad%' OR UPPER(Location) LIKE '%AHMEDABAD%' OR Location LIKE '%Ahmedabad%') AND Reputation >= 500 ORDER BY Reputation DESC | sede |
CREATE TABLE person_info (
CSD text,
CSRQ time,
GJDM text,
GJMC text,
JGDM text,
JGMC text,
MZDM text,
MZMC text,
RYBH text,
XBDM number,
XBMC text,
XLDM text,
XLMC text,
XM text,
ZYLBDM text,
ZYMC text
)
CREATE TABLE mzjzjlb_jybgb (
YLJGDM_MZJZJLB te... | 从2011年6月6到2021年10月25日,7702859这个医疗机构的新生儿门诊的就诊记录有多少 | SELECT COUNT(*) FROM mzjzjlb WHERE mzjzjlb.YLJGDM = '7702859' AND mzjzjlb.JZKSRQ BETWEEN '2011-06-06' AND '2021-10-25' AND mzjzjlb.ZSEBZ > 0 | css |
CREATE TABLE table_9422 (
"Team" text,
"All Games" text,
"All Games %" real,
"Nonconference Games" text,
"Nonconference Games %" real,
"Ranked AP Nonconference" text
) | Which All Games have a Nonconference Games % smaller than 0.75, and a Ranked AP Nonconference of 3 7? | SELECT "All Games" FROM table_9422 WHERE "Nonconference Games %" < '0.75' AND "Ranked AP Nonconference" = '3–7' | wikisql |
CREATE TABLE staff (
staff_id VARCHAR,
staff_name VARCHAR
)
CREATE TABLE Staff_Department_Assignments (
staff_id VARCHAR
) | Find the id and name of the staff who has been assigned for the shortest period. | SELECT T1.staff_id, T1.staff_name FROM staff AS T1 JOIN Staff_Department_Assignments AS T2 ON T1.staff_id = T2.staff_id ORDER BY date_assigned_to - date_assigned_from LIMIT 1 | sql_create_context |
CREATE TABLE table_68184 (
"Season" real,
"Overall" text,
"Slalom" text,
"Giant Slalom" text,
"Super G" text,
"Downhill" text,
"Combined" text
) | Which downhill has 7 overalls? | SELECT "Downhill" FROM table_68184 WHERE "Overall" = '7' | wikisql |
CREATE TABLE table_39043 (
"Position" real,
"Team" text,
"Played" real,
"Wins" real,
"Draws" real,
"Losses" real,
"Scored" real,
"Conceded" real,
"Points" real
) | What's the lowest Position with a Conceded that's larger than 16, Draws of 3, and Losses that's larger than 3? | SELECT MIN("Position") FROM table_39043 WHERE "Conceded" > '16' AND "Draws" = '3' AND "Losses" > '3' | wikisql |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | how many patients were diagnosed with chest pain - unlikely cardiac in origin and did not return to the hospital within 2 months during this year? | SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'chest pain - unlikely cardiac in origin' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DA... | eicu |
CREATE TABLE Reservations (
Code INTEGER,
Room TEXT,
CheckIn TEXT,
CheckOut TEXT,
Rate REAL,
LastName TEXT,
FirstName TEXT,
Adults INTEGER,
Kids INTEGER
)
CREATE TABLE Rooms (
RoomId TEXT,
roomName TEXT,
beds INTEGER,
bedType TEXT,
maxOccupancy INTEGER,
baseP... | Using a pie chart to show the proportion of each type of bed. | SELECT bedType, COUNT(bedType) FROM Rooms WHERE decor = "traditional" GROUP BY bedType | nvbench |
CREATE TABLE table_52981 (
"Game" real,
"Date" text,
"Batting 1st" text,
"Batting 2nd" text,
"Result" text
) | who is batting 1st in game 8? | SELECT "Batting 1st" FROM table_52981 WHERE "Game" = '8' | wikisql |
CREATE TABLE table_21062 (
"Name" text,
"Latitude" text,
"Longitude" text,
"Diameter" text,
"Year named" real,
"Namesake" text
) | How many longitudes have a latitude of 9.9n? | SELECT COUNT("Longitude") FROM table_21062 WHERE "Latitude" = '9.9N' | wikisql |
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Per... | Draw a scatter chart about the correlation between Team_ID and School_ID , and group by attribute ACC_Road. | SELECT Team_ID, School_ID FROM basketball_match GROUP BY ACC_Road | nvbench |
CREATE TABLE table_203_491 (
id number,
"year" number,
"title" text,
"us hot 100" number,
"us modern rock" number,
"us mainstream rock" number,
"album" text
) | calculate the number of songs listed between 1994 and 2005 . | SELECT COUNT("title") FROM table_203_491 WHERE "year" >= 1994 AND "year" <= 2005 | squall |
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
... | how many hours it has been since patient 016-9636 was first diagnosed with alcohol withdrawal in their current hospital visit? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', diagnosis.diagnosistime)) FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-9636'... | eicu |
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuo... | what is the name of the medication that was first prescribed to patient 12775 in 12/this year? | SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 12775) AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '12' ORD... | mimic_iii |
CREATE TABLE table_25392 (
"Team" text,
"SEC Wins" real,
"SEC Losses" real,
"Percentage" text,
"Home Record" text,
"Road Record" text,
"Overall Record" text
) | Name the percentage for georgia | SELECT "Percentage" FROM table_25392 WHERE "Team" = 'Georgia' | wikisql |
CREATE TABLE table_35349 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" text,
"Record" text
) | What is the score from the 21-27 Record? | SELECT "Score" FROM table_35349 WHERE "Record" = '21-27' | wikisql |
CREATE TABLE table_21550870_1 (
original_air_date VARCHAR,
us_viewers__million_ VARCHAR
) | Name the original air date for 9.16 viewers | SELECT original_air_date FROM table_21550870_1 WHERE us_viewers__million_ = "9.16" | sql_create_context |
CREATE TABLE game (
stadium_id int,
id int,
Season int,
Date text,
Home_team text,
Away_team text,
Score text,
Competition text
)
CREATE TABLE injury_accident (
game_id int,
id int,
Player text,
Injury text,
Number_of_matches text,
Source text
)
CREATE TABLE sta... | I want to see trend the number of season over season by Home_team, and order by the X-axis from high to low. | SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season DESC | nvbench |
CREATE TABLE table_62724 (
"Name" text,
"Premier League" real,
"League Cup" real,
"FA Cup" real,
"UEFA Cup" real,
"Total" real
) | Which FA Cup has a Total smaller than 1? | SELECT AVG("FA Cup") FROM table_62724 WHERE "Total" < '1' | wikisql |
CREATE TABLE table_28068645_8 (
total INTEGER
) | What is the minimum sum? | SELECT MIN(total) FROM table_28068645_8 | sql_create_context |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescription... | count the number of patients whose year of death is less than or equal to 2111 and lab test fluid is other body fluid? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2111.0" AND lab.fluid = "Other Body Fluid" | mimicsql_data |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | give the number of newborns who were born before the year 2168. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.dob_year < "2168" | mimicsql_data |
CREATE TABLE table_name_74 (
date VARCHAR,
event VARCHAR,
acts VARCHAR
) | When is the Monsters of Rock show with 12 bands? | SELECT date FROM table_name_74 WHERE event = "monsters of rock" AND acts = "12 bands" | sql_create_context |
CREATE TABLE table_name_64 (
venue VARCHAR,
away_team VARCHAR
) | What venue features geelong as the away side? | SELECT venue FROM table_name_64 WHERE away_team = "geelong" | sql_create_context |
CREATE TABLE table_1140088_6 (
constructor VARCHAR,
race_name VARCHAR
) | Who constructed the I Italian Republic Grand Prix? | SELECT constructor FROM table_1140088_6 WHERE race_name = "I Italian Republic Grand Prix" | sql_create_context |
CREATE TABLE table_30058355_2 (
fri_26_aug VARCHAR,
mon_22_aug VARCHAR
) | What is shown for fri 26 aug when mon 22 aug is no time? | SELECT fri_26_aug FROM table_30058355_2 WHERE mon_22_aug = "—— No Time" | sql_create_context |
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
CREATE TABLE university (
Scho... | Show me about the distribution of All_Home and the average of Team_ID , and group by attribute All_Home in a bar chart, and sort by the X in descending. | SELECT All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home ORDER BY All_Home DESC | nvbench |
CREATE TABLE table_62431 (
"Rank" text,
"Name" text,
"Height ft (m)" text,
"Floors" real,
"Year" real
) | How tall is the building ranked #13? | SELECT "Height ft (m)" FROM table_62431 WHERE "Rank" = '13' | wikisql |
CREATE TABLE table_42669 (
"Benchmark" text,
"Crown height" text,
"Pavilion depth" text,
"Table diameter" text,
"Girdle thickness" text,
"Crown angle" text,
"Pavilion angle" text,
"Brilliance Grade" text
) | Which Pavilion depth has a Crown angle of 34.0 34.7 ? | SELECT "Pavilion depth" FROM table_42669 WHERE "Crown angle" = '34.0–34.7°' | wikisql |
CREATE TABLE Customers (
customer_id VARCHAR,
customer_details VARCHAR
)
CREATE TABLE Customer_Events (
date_moved_in VARCHAR,
customer_id VARCHAR
) | What is each customer's move in date, and the corresponding customer id and details? | SELECT T2.date_moved_in, T1.customer_id, T1.customer_details FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id | sql_create_context |
CREATE TABLE table_27721131_6 (
team VARCHAR,
high_points VARCHAR
) | Which team played them when andray blatche , javale mcgee (20) had the high points? | SELECT team FROM table_27721131_6 WHERE high_points = "Andray Blatche , JaVale McGee (20)" | sql_create_context |
CREATE TABLE table_name_66 (
week VARCHAR,
finalist VARCHAR
) | What is the Week, when the Finalist is Carlos Moy (5)? | SELECT week FROM table_name_66 WHERE finalist = "carlos moyá (5)" | sql_create_context |
CREATE TABLE table_17155250_1 (
film_title_used_in_nomination VARCHAR,
original_title VARCHAR
) | What name was used for nomination for the film with an original title of 'The Black Tulip'? | SELECT film_title_used_in_nomination FROM table_17155250_1 WHERE original_title = "The Black Tulip" | sql_create_context |
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
... | round trip flights from MINNEAPOLIS to SAN DIEGO COACH economy fare | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE ((fare_basis.class_type = 'COACH' AND fare.fare_basis_code = fare_basis.fare_basis_code) AND CITY_1.city_code = AIRPORT_SERVICE_1.... | atis |
CREATE TABLE table_35409 (
"Year" real,
"Jewish" real,
"Muslim" real,
"Christian" real,
"Druze" real,
"Total" real
) | What is the average muslim that has a druze less than 2,534, a year prior to 2005, and a jewish greater than 100,657? | SELECT AVG("Muslim") FROM table_35409 WHERE "Druze" < '2,534' AND "Year" = '2005' AND "Jewish" > '100,657' | wikisql |
CREATE TABLE table_name_51 (
res VARCHAR,
time VARCHAR
) | What was the result of the 4:27 fight? | SELECT res FROM table_name_51 WHERE time = "4:27" | sql_create_context |
CREATE TABLE jyjgzbb (
JYZBLSH text,
YLJGDM text,
BGDH text,
BGRQ time,
JYRQ time,
JCRGH text,
JCRXM text,
SHRGH text,
SHRXM text,
JCXMMC text,
JCZBDM text,
JCFF text,
JCZBMC text,
JCZBJGDX text,
JCZBJGDL number,
JCZBJGDW text,
SBBM text,
YQBH text... | 经过门诊诊断后确定为慢性牙周炎的患者的检测指标261843的参考值范围下限还有上限能达到多少? | SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDSM = '慢性牙周炎' AND jyjgzbb.JCZBDM = '261843' | css |
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,... | what is the earliest flight from TAMPA to MILWAUKEE tomorrow | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MILWAUKEE' AND date_day.day_number = 20 AND date_day.month_number = 1 AN... | atis |
CREATE TABLE table_67164 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is the score of Australia? | SELECT "Score" FROM table_67164 WHERE "Country" = 'australia' | wikisql |
CREATE TABLE table_18153 (
"District" text,
"Incumbent" text,
"Party" text,
"First elected" text,
"Results" text,
"Candidates" text
) | What's the party elected in the district that first elected in 1990? | SELECT "Party" FROM table_18153 WHERE "First elected" = '1990' | wikisql |
CREATE TABLE table_17626 (
"Municipality" text,
"Population" real,
"Police officers" real,
"Residents per officer" real,
"Total costs (2005)" text,
"Cost per capita" text,
"Case burden" real,
"Crime rate per 1,000 people" real,
"Police force" text
) | When total costs (2005) are $700,116, what is the cost per capita? | SELECT "Cost per capita" FROM table_17626 WHERE "Total costs (2005)" = '$700,116' | wikisql |
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE... | tell me what are the top three most common intakes during a year before? | SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT inputevents_cv.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM inputevents_cv WHERE DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY inputevents_cv.it... | mimic_iii |
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | count the number of patients whose year of death is less than or equal to 2155 and diagnoses icd9 code is 4240? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2155.0" AND diagnoses.icd9_code = "4240" | mimicsql_data |
CREATE TABLE table_1342270_3 (
first_elected VARCHAR,
incumbent VARCHAR
) | what's the first elected with incumbent being joe starnes | SELECT first_elected FROM table_1342270_3 WHERE incumbent = "Joe Starnes" | sql_create_context |
CREATE TABLE Customer_Addresses (
customer_id INTEGER,
address_id INTEGER,
date_address_from DATETIME,
address_type VARCHAR(15),
date_address_to DATETIME
)
CREATE TABLE Products (
product_id INTEGER,
product_details VARCHAR(255)
)
CREATE TABLE Customers (
customer_id INTEGER,
payme... | Find the number of customers that use email as the contact channel for each weekday Visualize with a bar chart, order from low to high by the Y-axis please. | SELECT active_from_date, COUNT(active_from_date) FROM Customers AS t1 JOIN Customer_Contact_Channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' ORDER BY COUNT(active_from_date) | nvbench |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.