context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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 t...
what is discharge location of subject id 29541?
SELECT demographic.discharge_location FROM demographic WHERE demographic.subject_id = "29541"
mimicsql_data
CREATE TABLE table_name_2 ( grid VARCHAR, rider VARCHAR )
What is the total number of Grid, when Rider is Aleix Espargaro?
SELECT COUNT(grid) FROM table_name_2 WHERE rider = "aleix espargaro"
sql_create_context
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_M...
把患者云成双在医院5772837住院的就诊记录列出来,选择入院时的科室名字有免疫科的记录
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '云成双' AND hz_info.YLJGDM = '5772837' AND zyjzjlb.JZKSMC LIKE '%免疫科%'
css
CREATE TABLE table_204_379 ( id number, "year" text, "title" text, "hangul" text, "network" text, "further info" text )
when is the last year as listed ?
SELECT MAX("year") FROM table_204_379
squall
CREATE TABLE table_44620 ( "Event" text, "Date" text, "Round" text, "Name" text, "Nationality" text, "Time" text, "Record" text )
What is the record for the date 15 december, and a round of final?
SELECT "Record" FROM table_44620 WHERE "Date" = '15 december' AND "Round" = 'final'
wikisql
CREATE TABLE table_49674 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" text )
how many times is the chassis brabham bt33?
SELECT COUNT("Year") FROM table_49674 WHERE "Chassis" = 'brabham bt33'
wikisql
CREATE TABLE table_name_56 ( score VARCHAR, tournament VARCHAR )
Which Score has a Tournament of san jose, us (2)?
SELECT score FROM table_name_56 WHERE tournament = "san jose, us (2)"
sql_create_context
CREATE TABLE table_name_57 ( game_site VARCHAR, week VARCHAR )
Where did they play in week 14?
SELECT game_site FROM table_name_57 WHERE week = "14"
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...
陶秀竹病患在02年4月20日至03年8月28日内在医疗机构4933509西药共开了多少?
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '陶秀竹' AND t_kc22.STA_DATE BETWEEN '2002-04-20' AND '2003-08-28' AND t_kc22.t_kc21_MED_SER_ORG_NO = '4933509' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE table_72218 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
What is the height of the player who attended Hartford?
SELECT "Height in Ft." FROM table_72218 WHERE "School/Club Team/Country" = 'Hartford'
wikisql
CREATE TABLE table_train_77 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "language" string, "hiv_aids" bool, "age" float, "NOUSE" float )
written and oral fluency in english or spanish .
SELECT * FROM table_train_77 WHERE language = 'english' OR language = 'spanish'
criteria2sql
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...
Return a bar chart about the distribution of All_Home and School_ID , and group by attribute ACC_Home, and order in asc by the Y-axis please.
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID
nvbench
CREATE TABLE table_59732 ( "Name (year commissioned)" text, "Owner/operator" text, "Length" text, "Maximum diameter" text, "From/to" text, "Licence number" text )
What is the name where the license number is PL 22?
SELECT "Name (year commissioned)" FROM table_59732 WHERE "Licence number" = 'pl 22'
wikisql
CREATE TABLE table_52460 ( "Tournament" text, "1972" text, "1973" text, "1974" text, "1975" text, "1976" text, "1977" text, "1978" text )
What is the 1976 value of the Australian Open?
SELECT "1976" FROM table_52460 WHERE "Tournament" = 'australian open'
wikisql
CREATE TABLE table_name_45 ( total VARCHAR )
Which 2009 year has a total of 1, and 2004 year of 7th?
SELECT 2009 FROM table_name_45 WHERE total = 1 AND 2004 = "7th"
sql_create_context
CREATE TABLE table_26916 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "School" text )
What numbered pick attended western ontario and is an OL?
SELECT "Pick #" FROM table_26916 WHERE "School" = 'Western Ontario' AND "Position" = 'OL'
wikisql
CREATE TABLE table_name_32 ( nationality VARCHAR, name VARCHAR )
What is the nationality of the HMS Cheshire?
SELECT nationality FROM table_name_32 WHERE name = "hms cheshire"
sql_create_context
CREATE TABLE table_name_72 ( school VARCHAR, college VARCHAR, height VARCHAR )
For the Player playing for the College of Kentucky and a Height of 6-7 what was their corresponding School?
SELECT school FROM table_name_72 WHERE college = "kentucky" AND height = "6-7"
sql_create_context
CREATE TABLE table_47221 ( "Date" text, "Home team" text, "Score" text, "Away team" text, "Venue" text, "Box Score" text, "Report" text )
What was the box score for the game that had the Cairns Taipans as home team?
SELECT "Box Score" FROM table_47221 WHERE "Home team" = 'cairns taipans'
wikisql
CREATE TABLE table_58864 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text )
What is the Place of the Player with a Score of 73-75-71-73=292?
SELECT "Place" FROM table_58864 WHERE "Score" = '73-75-71-73=292'
wikisql
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic (...
how many patients stay in hospital more than 4 days and with drug type base?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE table_29039942_1 ( writer VARCHAR, episode VARCHAR )
Who was the writer for episode 3?
SELECT writer FROM table_29039942_1 WHERE episode = 3
sql_create_context
CREATE TABLE table_27235 ( "No." real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
Who wrote 'Concordia'?
SELECT "Written by" FROM table_27235 WHERE "Title" = 'Concordia'
wikisql
CREATE TABLE table_name_32 ( round___race VARCHAR, winning_driver VARCHAR, pole_position VARCHAR )
What is the round or race of the winning driver Charles Hollings and what was his pole position?
SELECT round___race FROM table_name_32 WHERE winning_driver = "charles hollings" AND pole_position = "charles hollings"
sql_create_context
CREATE TABLE table_12481 ( "Draft" real, "Round" real, "Pick" real, "Player" text, "Nationality" text )
What is the highest Pick, when Nationality is 'France', and when Draft is less than 1979?
SELECT MAX("Pick") FROM table_12481 WHERE "Nationality" = 'france' AND "Draft" < '1979'
wikisql
CREATE TABLE table_203_67 ( id number, "place" number, "team" text, "played" number, "won" number, "draw" number, "lost" number, "goals\nscored" number, "goals\nconceded" number, "+/-" number, "points" number )
what is the difference between the number of goals scored from the highest scoring team and the lowest scoring team ?
SELECT MAX("goals\nscored") - MIN("goals\nscored") FROM table_203_67
squall
CREATE TABLE table_name_41 ( year INTEGER, seat_factor VARCHAR, flying_hours VARCHAR )
What was the earliest year that had more than 105,579 flying hours and a seat factor of 68%?
SELECT MIN(year) FROM table_name_41 WHERE seat_factor = "68%" AND flying_hours > 105 OFFSET 579
sql_create_context
CREATE TABLE table_56260 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Who drove grid 5?
SELECT "Driver" FROM table_56260 WHERE "Grid" = '5'
wikisql
CREATE TABLE table_36841 ( "Rank" text, "Film" text, "Director(s)" text, "Producer(s)" text, "Writer(s)" text, "Production Company" text )
For which production company did Sam Mccarthy produce?
SELECT "Production Company" FROM table_36841 WHERE "Producer(s)" = 'sam mccarthy'
wikisql
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, account_id INTEGER, invoice_number INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DECIMAL(19,4), transaction_comment VARCHAR(255), other_transaction_details VARCHAR(255) ) CREATE TABLE Cu...
What are the first names and ids for customers who have two or more accounts.
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id
nvbench
CREATE TABLE table_name_12 ( year_won INTEGER, player VARCHAR, to_par VARCHAR )
What is the earliest year won Paul Azinger had with a to par higher than 5?
SELECT MIN(year_won) FROM table_name_12 WHERE player = "paul azinger" AND to_par > 5
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
名字是奚星晖的患者在医院编码5472060出院诊断疾病名称不包含社交的医疗就诊记录编号是多少呀?
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '奚星晖' AND MED_SER_ORG_NO = '5472060' AND NOT OUT_DIAG_DIS_NM LIKE '%社交%'
css
CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_na...
give me the flights from CHICAGO to SEATTLE on saturday morning
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 = 'SEATTLE' AND date_day.day_number = 26 AND date_day.month_number = 7 AND ...
atis
CREATE TABLE table_13490 ( "Date" text, "Japan" text, "Americas" text, "Other" text, "Total" text )
Which date had Japanese sales of 0.59 million?
SELECT "Date" FROM table_13490 WHERE "Japan" = '0.59 million'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text...
Distribution of HNQs based on time until entering - divided by n minutes.
WITH times_cte AS (SELECT p.Id AS pid, p.CreationDate AS cre, ph.CreationDate AS hot, FLOOR(CAST(CAST((JULIANDAY(CreationDate) - JULIANDAY(p.CreationDate)) * 1440.0 AS INT) AS FLOAT) / '##interval?10##') AS time FROM PostHistory AS ph INNER JOIN Posts AS p ON ph.PostId = p.Id WHERE ph.PostHistoryTypeId = 52) SELECT tim...
sede
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
患者90084471在二00八年八月十七日到二0一八年五月二十日期间,总共去过几家医院
SELECT COUNT(qtb.MED_SER_ORG_NO) FROM qtb WHERE qtb.PERSON_ID = '90084471' AND qtb.IN_HOSP_DATE BETWEEN '2008-08-17' AND '2018-05-20' UNION SELECT COUNT(gyb.MED_SER_ORG_NO) FROM gyb WHERE gyb.PERSON_ID = '90084471' AND gyb.IN_HOSP_DATE BETWEEN '2008-08-17' AND '2018-05-20' UNION SELECT COUNT(zyb.MED_SER_ORG_NO) FROM zy...
css
CREATE TABLE torrents ( groupname text, totalsnatched number, artist text, groupyear number, releasetype text, groupid number, id number ) CREATE TABLE tags ( index number, id number, tag text )
Which year has the most released song?
SELECT groupyear FROM torrents GROUP BY groupyear ORDER BY COUNT(groupname) DESC LIMIT 1
whatcdhiphop
CREATE TABLE table_47208 ( "Player" text, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text )
for how many years did the player who graduated from stanford play for Grizzlies?
SELECT "Years for Grizzlies" FROM table_47208 WHERE "School/Club Team" = 'stanford'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, H...
患者严光辉曾经接受过什么治疗
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '严光辉' AND t_kc22.MED_INV_ITEM_TYPE = '治疗费'
css
CREATE TABLE table_name_88 ( goals_for INTEGER, played INTEGER )
What is the lowest goals for more than 30 games played?
SELECT MIN(goals_for) FROM table_name_88 WHERE played > 30
sql_create_context
CREATE TABLE table_67919 ( "Name" text, "Period" text, "Matches" real, "Wins" real, "Draws" real, "Losses" real, "Efficiency %" text )
What is the total number of Draws with less than 4 matches?
SELECT COUNT("Draws") FROM table_67919 WHERE "Matches" < '4'
wikisql
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...
编号为8898248的医院在一一年十一月二十日到一四年三月五日的这段时间里,有多少医疗费总额超过5327.65元的科室
SELECT COUNT(*) FROM (SELECT t_kc21.MED_ORG_DEPT_CD FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '8898248' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-11-20' AND '2014-03-05' GROUP BY t_kc21.MED_ORG_DEPT_CD HAVING SUM(t_kc24.MED_AMOUT) > 5327.65) AS T
css
CREATE TABLE table_train_277 ( "id" int, "gender" string, "cholesterol" float, "blood_platelet_counts" int, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "severe_dyslipidemia" bool, "fasting_triglyceride" int, "body_mass_index_bmi" float, "trig...
subjects with fasting triglyceride levels > 250 mg / dl prior to the study ( at sv1
SELECT * FROM table_train_277 WHERE fasting_triglyceride > 250
criteria2sql
CREATE TABLE table_14115 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score" text )
Who was the partner on May 16, 2004?
SELECT "Partner" FROM table_14115 WHERE "Date" = 'may 16, 2004'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
患者韩曼冬在2002年2月11日到2014年2月3日内都做了什么检验把检验结果指标记录中的仪器编号以及名称列出来
SELECT jyjgzbb.YQBH, jyjgzbb.YQMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = j...
css
CREATE TABLE table_4136 ( "Stadium" text, "Location" text, "Opened" real, "Built for" text, "Capacity at Construction" real )
What was the stadium in Moorabbin, Victoria built for?
SELECT "Built for" FROM table_4136 WHERE "Location" = 'Moorabbin, Victoria'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE labevents ( row_id number, subject_id number, h...
this year what were the three most commonly performed procedures for patients who are 20s?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age B...
mimic_iii
CREATE TABLE table_22050544_3 ( event VARCHAR, entries VARCHAR )
Which event had 25,883 entries?
SELECT event FROM table_22050544_3 WHERE entries = "25,883"
sql_create_context
CREATE TABLE table_204_162 ( id number, "team" text, "constructor" text, "motorcycle" text, "tyres" text, "no" number, "rider" text, "rounds" text )
which team was larger than the rest ?
SELECT "team" FROM table_204_162 GROUP BY "team" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_name_46 ( score VARCHAR, visitor VARCHAR, date VARCHAR )
What's the score on february 18 when the visitors are the montreal canadiens?
SELECT score FROM table_name_46 WHERE visitor = "montreal canadiens" AND date = "february 18"
sql_create_context
CREATE TABLE table_77396 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
Who had the most assists in the game against Atlanta?
SELECT "High assists" FROM table_77396 WHERE "Team" = 'atlanta'
wikisql
CREATE TABLE table_34100 ( "Round" real, "Track" text, "Date" text, "Pole Position" text, "Fastest Race Lap" text, "Winner" text, "Team" text )
What is the sum of team impul with the date of 8 july
SELECT SUM("Round") FROM table_34100 WHERE "Team" = 'team impul' AND "Date" = '8 july'
wikisql
CREATE TABLE table_name_93 ( record VARCHAR, visitor VARCHAR )
What is the record when Tampa Bay is the visitor?
SELECT record FROM table_name_93 WHERE visitor = "tampa bay"
sql_create_context
CREATE TABLE table_203_465 ( id number, "name" text, "population (2002 census)" number, "population (2007 estimation)" number, "population (2011 census)" number, "area (km2)" number, "density (pop/km2)" number )
what is the number of inhabitants living in predeal in 2007 ?
SELECT "population (2007 estimation)" FROM table_203_465 WHERE "name" = 'predeal'
squall
CREATE TABLE table_47614 ( "Date" text, "Competition" text, "Winners" text, "Score" text, "Runners-up" text )
What was the score in the game that was won by Sligo Rovers F.C.?
SELECT "Score" FROM table_47614 WHERE "Winners" = 'sligo rovers f.c.'
wikisql
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
how many patients whose admission type is urgent and year of birth is less than 1821?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.dob_year < "1821"
mimicsql_data
CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real ) CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real ) CREATE TABLE club ( Club_ID int, ...
A bar chart for how many competitions for each country.
SELECT Country, COUNT(Country) FROM competition GROUP BY Country
nvbench
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttim...
how many patients have been discharged until 4 years ago?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE NOT admissions.dischtime IS NULL AND DATETIME(admissions.dischtime) <= DATETIME(CURRENT_TIME(), '-4 year')
mimic_iii
CREATE TABLE table_29606 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "First Star" text, "Decision" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
Who got the decision in the game, when the final score was 1-7?
SELECT "Decision" FROM table_29606 WHERE "Score" = '1-7'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
what is the number of patients whose primary disease is rash and drug route is tp?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "RASH" AND prescriptions.route = "TP"
mimicsql_data
CREATE TABLE table_64931 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text, "Arena" text, "Points" real )
Which Attendance has a Score of 4 3, and Points smaller than 5?
SELECT MAX("Attendance") FROM table_64931 WHERE "Score" = '4–3' AND "Points" < '5'
wikisql
CREATE TABLE table_5088 ( "Station Code" text, "Station Name" text, "Arrival" text, "Departure" text, "Platform" text )
What is the Station Code of the Destination Station Departure?
SELECT "Station Code" FROM table_5088 WHERE "Departure" = 'destination station'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( ...
when did patient 005-48105 receive the last proventil,ventolin and vancomycin 1 g mini-bag plus (vial mate) prescription at the same time in 12/this year?
SELECT t1.drugstarttime FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'proventil,ventolin' AND patient.uniquepid = '005-48105' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIM...
eicu
CREATE TABLE table_21086 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" text, "Year named" real, "Name origin" text )
When was the most recently named feature named?
SELECT MAX("Year named") FROM table_21086
wikisql
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), ...
How many courses for each course description? Show me a stacked bar chart. The x-axis is course description and group by office name.
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY PROF_OFFICE, CRS_DESCRIPTION
nvbench
CREATE TABLE track ( Track_ID int, Name text, Location text, Seating real, Year_Opened real ) CREATE TABLE race ( Race_ID int, Name text, Class text, Date text, Track_ID text )
What are the different classes of races, and how many races correspond to each Show bar chart, and could you sort by the X-axis from low to high?
SELECT Class, COUNT(*) FROM race GROUP BY Class ORDER BY Class
nvbench
CREATE TABLE table_204_692 ( id number, "publication" text, "score" text, "review" text )
what is the total number of publications ?
SELECT COUNT("publication") FROM table_204_692
squall
CREATE TABLE table_1737 ( "Episode" real, "Original title" text, "Directed by" text, "Written by" text, "Original airdate" text, "Duration" text, "Viewership" text )
Name the total number of original titles written by john sullivan and keith lindsay
SELECT COUNT("Original title") FROM table_1737 WHERE "Written by" = 'John Sullivan and Keith Lindsay'
wikisql
CREATE TABLE table_10808 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score in the final" text )
What was the score in the final on 14 august 1994?
SELECT "Score in the final" FROM table_10808 WHERE "Date" = '14 august 1994'
wikisql
CREATE TABLE member ( Name VARCHAR, Country VARCHAR )
Show the names of members whose country is 'United States' or 'Canada'.
SELECT Name FROM member WHERE Country = "United States" OR Country = "Canada"
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...
show me the number of patients on base type drug prescription who were younger than 30 years of age.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "30" AND prescriptions.drug_type = "BASE"
mimicsql_data
CREATE TABLE manufacturer ( manufacturer_id number, open_year number, name text, num_of_factories number, num_of_shops number ) CREATE TABLE furniture_manufacte ( manufacturer_id number, furniture_id number, price_in_dollar number ) CREATE TABLE furniture ( furniture_id number, ...
Find the component amounts and names of all furnitures that have more than 10 components.
SELECT num_of_component, name FROM furniture WHERE num_of_component > 10
spider
CREATE TABLE table_7825 ( "Country" text, "2010" real, "2011" real, "2012" real, "2013" real )
What is the average number of participants in 2012 when there were less than 8 in 2013 and 7 in 2011?
SELECT AVG("2012") FROM table_7825 WHERE "2013" < '8' AND "2011" = '7'
wikisql
CREATE TABLE table_150 ( "Team" text, "Stadium" text, "Capacity" real, "Highest" real, "Lowest" real, "Average" real )
The stenhousemuir team had how many highest attendances?
SELECT COUNT("Highest") FROM table_150 WHERE "Team" = 'Stenhousemuir'
wikisql
CREATE TABLE table_name_87 ( interacting__settings_ VARCHAR, need VARCHAR )
Name the interacting for need of protection
SELECT interacting__settings_ FROM table_name_87 WHERE need = "protection"
sql_create_context
CREATE TABLE table_10163 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Who was the away team when Geelong was the home team?
SELECT "Away team" FROM table_10163 WHERE "Home team" = 'geelong'
wikisql
CREATE TABLE table_203_358 ( id number, "pos." number, "athlete" text, "run 1" number, "run 2" number, "total" text )
how many athlete 's first run was between 51 and 52 seconds ?
SELECT COUNT("athlete") FROM table_203_358 WHERE "run 1" >= 51 AND "run 1" <= 52
squall
CREATE TABLE table_name_28 ( bronze INTEGER, gold VARCHAR, nation VARCHAR, silver VARCHAR, rank VARCHAR )
What is the total bronze medals when the silver medals is 0, and 1 is the rank, Brazil (BRA) is the nation, and the gold medals is less than 2?
SELECT SUM(bronze) FROM table_name_28 WHERE silver = 0 AND rank = "1" AND nation = "brazil (bra)" AND gold < 2
sql_create_context
CREATE TABLE table_name_68 ( enrollment VARCHAR, established INTEGER )
What is the enrollment of the university established in or after 2011?
SELECT enrollment FROM table_name_68 WHERE established > 2011
sql_create_context
CREATE TABLE table_43174 ( "Rd. / Race" text, "Race Title" text, "Circuit" text, "City / State" text, "Date" text, "Winner" text, "Team" text )
What is the Date for the City/State of Sydney, New South Wales?
SELECT "Date" FROM table_43174 WHERE "City / State" = 'sydney, new south wales'
wikisql
CREATE TABLE table_name_41 ( total INTEGER, rank VARCHAR, gold VARCHAR )
what is the total when the rank is 7 and gold is more than 0?
SELECT AVG(total) FROM table_name_41 WHERE rank = "7" AND gold > 0
sql_create_context
CREATE TABLE table_453 ( "Episode" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text )
What is the theme for the episode selection process?
SELECT "Theme" FROM table_453 WHERE "Episode" = 'Selection Process'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
哪几家医院给患者魏星辰销售过药品硫酸氢氯吡格雷片?
SELECT gwyjzb.MED_SER_ORG_NO FROM gwyjzb WHERE gwyjzb.PERSON_NM = '魏星辰' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.SOC_SRT_DIRE_NM = '硫酸氢氯吡格雷片') UNION SELECT fgwyjzb.MED_SER_ORG_NO FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '魏星辰' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_...
css
CREATE TABLE table_79554 ( "Date" text, "Location" text, "Lineup" text, "Assist/pass" text, "Score" text, "Result" text, "Competition" text )
Name the Result of the Lineup of start, an Assist/pass of carli lloyd, and an Competition of 2011 fifa women s world cup group stage?
SELECT "Result" FROM table_79554 WHERE "Lineup" = 'start' AND "Assist/pass" = 'carli lloyd' AND "Competition" = '2011 fifa women’s world cup – group stage'
wikisql
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, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
since 2104 count the number of patients who were diagnosed with hx-rectal & anal malign and did not come back to the hospital within 2 months.
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hx-rectal ...
mimic_iii
CREATE TABLE table_33266 ( "Game Name" text, "Price" text, "Top Prize" text, "Launch Date" text, "Odds of Winning" text )
What is the top price of $1 with a launch date on February 12, 2008?
SELECT "Top Prize" FROM table_33266 WHERE "Price" = '$1' AND "Launch Date" = 'february 12, 2008'
wikisql
CREATE TABLE table_name_72 ( lane VARCHAR, time VARCHAR, rank VARCHAR )
How many Lanes have a rank higher than 3 with a time of 2:08.11?
SELECT COUNT(lane) FROM table_name_72 WHERE time = "2:08.11" AND rank > 3
sql_create_context
CREATE TABLE table_name_17 ( score VARCHAR, date VARCHAR )
What was the score on April 22?
SELECT score FROM table_name_17 WHERE date = "april 22"
sql_create_context
CREATE TABLE table_name_89 ( winning_score VARCHAR, date VARCHAR )
What was the winning score on Aug 28, 1983?
SELECT winning_score FROM table_name_89 WHERE date = "aug 28, 1983"
sql_create_context
CREATE TABLE table_25818630_1 ( affiliation VARCHAR, candidate VARCHAR )
What is every affiliation for candidate Daren Ireland?
SELECT affiliation FROM table_25818630_1 WHERE candidate = "Daren Ireland"
sql_create_context
CREATE TABLE table_56903 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Where was the game played where the home team was Collingwood?
SELECT "Venue" FROM table_56903 WHERE "Home team" = 'collingwood'
wikisql
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zo...
one way
SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CI...
atis
CREATE TABLE table_name_33 ( european_competitions VARCHAR, tier INTEGER )
What is the European competition when the tier is more than 2?
SELECT european_competitions FROM table_name_33 WHERE tier > 2
sql_create_context
CREATE TABLE table_name_59 ( cuts_made INTEGER, wins INTEGER )
What is the smallest number of cuts when there were more than 0 wins?
SELECT MIN(cuts_made) FROM table_name_59 WHERE wins > 0
sql_create_context
CREATE TABLE table_name_71 ( laps INTEGER, driver VARCHAR, grid VARCHAR )
How many Laps with a Grid smaller than 11 did John Watson have?
SELECT AVG(laps) FROM table_name_71 WHERE driver = "john watson" AND grid < 11
sql_create_context
CREATE TABLE table_name_48 ( attendance VARCHAR, arena VARCHAR )
What was the Attendance at Jobing.com Arena?
SELECT COUNT(attendance) FROM table_name_48 WHERE arena = "jobing.com arena"
sql_create_context
CREATE TABLE table_name_49 ( republican_ticket VARCHAR, democratic_ticket VARCHAR )
Who's the Republican ticket with a Democratic ticket of matthew j. merritt?
SELECT republican_ticket FROM table_name_49 WHERE democratic_ticket = "matthew j. merritt"
sql_create_context
CREATE TABLE table_4571 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the Date in which the Crowed was over 10,300 and the Home team was Melbourne?
SELECT "Date" FROM table_4571 WHERE "Crowd" > '10,300' AND "Home team" = 'melbourne'
wikisql
CREATE TABLE table_name_2 ( round INTEGER, school VARCHAR )
What's the average round number for East Carolina?
SELECT AVG(round) FROM table_name_2 WHERE school = "east carolina"
sql_create_context
CREATE TABLE Office_locations ( building_id VARCHAR, company_id VARCHAR ) CREATE TABLE buildings ( name VARCHAR, id VARCHAR ) CREATE TABLE Companies ( id VARCHAR )
Show the name of the building that has the most company offices.
SELECT T2.name FROM Office_locations AS T1 JOIN buildings AS T2 ON T1.building_id = T2.id JOIN Companies AS T3 ON T1.company_id = T3.id GROUP BY T1.building_id ORDER BY COUNT(*) DESC LIMIT 1
sql_create_context