context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime...
what are the five most common laboratory tests that a patient had within the same hospital visit after being diagnosed with s/p pelvic exenteration since 1 year ago?
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 's/p pelvic exente...
eicu
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, ...
what are the five most commonly given microbiology tests for patients that had previously received insulin - sliding scale administration during the same month until 2 years ago?
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'insulin - sliding scale administration' AND ...
eicu
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 TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS...
What is the number of professors for different school Plot them as bar chart, display X-axis from low to high order.
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 table_19115 ( "Club" text, "Played" text, "Won" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
what's the won with points for being 596
SELECT "Won" FROM table_19115 WHERE "Points for" = '596'
wikisql
CREATE TABLE procedures ( 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 diagnoses ( ...
how many patients whose diagnoses short title is adv eff antineoplastic and lab test category is chemistry?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Adv eff antineoplastic" AND lab."CATEGORY" = "Chemistry"
mimicsql_data
CREATE TABLE table_name_99 ( points INTEGER, difference VARCHAR, against VARCHAR )
What is the average number of points for a difference of 55 and an against less than 47?
SELECT AVG(points) FROM table_name_99 WHERE difference = "55" AND against < 47
sql_create_context
CREATE TABLE table_18757 ( "Frequency" text, "Call sign" text, "Name" text, "Format" text, "Owner" text, "Target city/ market" text, "City of license" text )
What is the target market for the station on 97.9 fm?
SELECT "Target city/ market" FROM table_18757 WHERE "Frequency" = '97.9 FM'
wikisql
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE flight_stop ( flight_id in...
please list for me the flights on UA between BOSTON and DENVER
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, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BOSTON...
atis
CREATE TABLE table_54060 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
Which manufacturer has a Time/Retired of +15.665?
SELECT "Manufacturer" FROM table_54060 WHERE "Time/Retired" = '+15.665'
wikisql
CREATE TABLE table_718 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What year was ike skelton first elected?
SELECT MIN("First elected") FROM table_718 WHERE "Incumbent" = 'Ike Skelton'
wikisql
CREATE TABLE table_name_28 ( _percentage_of_1_rep_max_last_set_ VARCHAR, set_4 VARCHAR )
How many % of 1 Rep Max(Last Set) has a Set 4 of 145lb x 5reps?
SELECT _percentage_of_1_rep_max_last_set_ FROM table_name_28 WHERE set_4 = "145lb x 5reps"
sql_create_context
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 prescriptions...
count the number of patients whose ethnicity is white - russian and procedure short title is oth uni salpingo-oophor?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND procedures.short_title = "Oth uni salpingo-oophor"
mimicsql_data
CREATE TABLE table_name_55 ( platform VARCHAR, current_version VARCHAR )
What Platform has a Current Version 0.6.2?
SELECT platform FROM table_name_55 WHERE current_version = "0.6.2"
sql_create_context
CREATE TABLE table_9095 ( "party" text, "% of votes" text, "% of seats" text, "difference" text, "difference squared" real )
What is the % of seats where the difference is 0.19?
SELECT "% of seats" FROM table_9095 WHERE "difference" = '0.19'
wikisql
CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments ...
Is 376 offered on Monday and Wednesday ?
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.friday = 'N' AND course_offering.monday = 'Y' AND course_offering.thursday = 'N' AND course_offering.tuesday = 'N' AND course_offering.wednesday = 'Y' AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND cour...
advising
CREATE TABLE table_name_36 ( to_par VARCHAR, player VARCHAR, place VARCHAR, country VARCHAR )
What is the to par of player john buczek, who has a t9 place and is from the United States?
SELECT to_par FROM table_name_36 WHERE place = "t9" AND country = "united states" AND player = "john buczek"
sql_create_context
CREATE TABLE table_name_19 ( away_team VARCHAR, venue VARCHAR )
What is the away team score at vfl park?
SELECT away_team AS score FROM table_name_19 WHERE venue = "vfl park"
sql_create_context
CREATE TABLE table_name_34 ( touchdowns INTEGER, net_yards VARCHAR, attempts VARCHAR )
What are the highest touchdowns that have net yards greater than 631, with attempts less than 145?
SELECT MAX(touchdowns) FROM table_name_34 WHERE net_yards > 631 AND attempts < 145
sql_create_context
CREATE TABLE table_name_72 ( icao VARCHAR, commenced_operations INTEGER )
Which ICAO has a Commenced operations larger than 2011?
SELECT icao FROM table_name_72 WHERE commenced_operations > 2011
sql_create_context
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...
how many patients with rheumatic heart failure diagnoses have delta abnormal lab test status?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Rheumatic heart failure" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE mzb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
过去患者82617822有什么治疗么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.PERSON_ID = '82617822' AND t_kc22.MED_INV_ITEM_TYPE = '治疗费' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE ...
css
CREATE TABLE table_70416 ( "Name" text, "Born" text, "Age at first step" text, "Mission" text, "Lunar EVA dates" text, "Service" text )
Which astronaut went on the Apollo 16 mission at the age of 36y 6m 18d to step on the moon?
SELECT "Name" FROM table_70416 WHERE "Mission" = 'apollo 16' AND "Age at first step" = '36y 6m 18d'
wikisql
CREATE TABLE table_16104 ( "Date" text, "Album name" text, "Track" text, "Track title" text, "Lyricist" text, "Music genre/style" text, "Major instrument(s)" text, "Lyrics theme/style" text, "Duration" text )
What is the album namethat has the track title Sweetness (ti n ti n de)?
SELECT "Album name" FROM table_16104 WHERE "Track title" = 'Sweetness 甜甜的 (Tián tián de)'
wikisql
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid...
what is the daily maximum value of pressure control in patient 027-151154 this year?
SELECT MAX(lab.labresult) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-151154')) AND lab.labname = 'pressure control' AND DATETIME(lab.labresulttime,...
eicu
CREATE TABLE table_203_355 ( id number, "year" number, "total" number, "romanians" text, "hungarians" text, "roma" text )
what year had the next highest percentage for roma after 2011 ?
SELECT "year" FROM table_203_355 WHERE "year" <> 2011 ORDER BY "roma" DESC LIMIT 1
squall
CREATE TABLE table_39563 ( "Role" text, "D'Oyly Carte 1920 Tour" text, "D'Oyly Carte 1930 Tour" text, "D'Oyly Carte 1939 Tour" text, "D'Oyly Carte 1945 Tour" text, "D'Oyly Carte 1950 Tour" text )
D'Oyly Carte 1939 Tour of richard walker involves what D'Oyly Carte 1945 Tour?
SELECT "D'Oyly Carte 1945 Tour" FROM table_39563 WHERE "D'Oyly Carte 1939 Tour" = 'richard walker'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
calculate the number of patients staying in the id 451 ward until 2102.
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 451 AND STRFTIME('%y', patient.unitadmittime) <= '2102'
eicu
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is the maximum age of patients that survived that were diagnosed with primary diseaase aortic valve insuffiency\aortic valve replacement /sda??
SELECT MAX(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA"
mimicsql_data
CREATE TABLE table_27529608_21 ( genre VARCHAR, age_s_ VARCHAR )
What is the genre for the group with ages 29-30?
SELECT genre FROM table_27529608_21 WHERE age_s_ = "29-30"
sql_create_context
CREATE TABLE table_19060 ( "Team" text, "Stadium" text, "Capacity" real, "Highest" real, "Lowest" real, "Average" real )
what is the maximum lowest with average being 734
SELECT MAX("Lowest") FROM table_19060 WHERE "Average" = '734'
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 are diagnosed for malignant carcinoid tumor of the rectum and treated with main drug type?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Malignant carcinoid tumor of the rectum" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE table_name_13 ( name VARCHAR, floors VARCHAR )
What was the name of the building with 10 floors?
SELECT name FROM table_name_13 WHERE floors = 10
sql_create_context
CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Student...
Give me the comparison about author_tutor_ATB over the personal_name by a bar chart.
SELECT personal_name, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name
nvbench
CREATE TABLE table_name_43 ( kilometers VARCHAR, station_code VARCHAR )
What is the sum of Kilometers that has a Station Code of KGQ?
SELECT COUNT(kilometers) FROM table_name_43 WHERE station_code = "kgq"
sql_create_context
CREATE TABLE table_203_263 ( id number, "alumni chapters and clubs" text, "location" text, "founding date" text, "years active" text, "province" text )
which delta omicron chapter was founded before zeta beta ?
SELECT "alumni chapters and clubs" FROM table_203_263 WHERE id = (SELECT id FROM table_203_263 WHERE "alumni chapters and clubs" = 'zeta beta') - 1
squall
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CR...
Return a bar chart on how many departments are in each school?
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT
nvbench
CREATE TABLE table_name_63 ( rounds VARCHAR, constructor VARCHAR, rider VARCHAR )
What rounds did rider Mika Kallio with a Ducati constructor have?
SELECT rounds FROM table_name_63 WHERE constructor = "ducati" AND rider = "mika kallio"
sql_create_context
CREATE TABLE table_24797 ( "Season" text, "Round" real, "Opponents" text, "Home Leg" text, "Away Leg" text, "Aggregate" text )
What is the record for the away leg in round 1 and aggregate 2-0?
SELECT "Away Leg" FROM table_24797 WHERE "Round" = '1' AND "Aggregate" = '2-0'
wikisql
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsysto...
what is the average daily number of patients who have had rash, infectious since 1 year ago?
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'rash, infectious' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year') GROUP BY STRFTIME('%y-%m-%d', diagnosis.diagnosistime)) AS t1
eicu
CREATE TABLE table_71761 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real )
What is the finish in 1956?
SELECT "Finish" FROM table_71761 WHERE "Year" = '1956'
wikisql
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, ...
show me all flights from PITTSBURGH to ATLANTA which leave after 1700 o'clock pm 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 ((date_day.day_number = 20 AND date_day.month_number = 1 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time...
atis
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 ) ...
how many patients whose age is less than 31 and diagnoses icd9 code is 70721?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.icd9_code = "70721"
mimicsql_data
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...
列出病人70995116医疗记录中医疗费总额在8532.47元以上的入院诊断疾病编码和名称
SELECT t_kc21.IN_DIAG_DIS_CD, t_kc21.IN_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '70995116' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 8532.47)
css
CREATE TABLE gwyjzb ( CLINIC_ID text, CLINIC_TYPE text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
医疗记录的医疗费用总额中病人年龄高于28岁的平均医疗费金额是多少
SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_AGE > 28 UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_AGE > 28)
css
CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions...
How many regions were affected by each storm?
SELECT T1.name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id
spider
CREATE TABLE table_name_91 ( overall INTEGER, player VARCHAR )
Name the average overall for james davis
SELECT AVG(overall) FROM table_name_91 WHERE player = "james davis"
sql_create_context
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar,...
what are the morning flights from BOSTON to PHILADELPHIA
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, flight 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 CITY_1.city_name = 'PHILAD...
atis
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
What is the number of patients under the age of 47 who have acidosis as their primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACIDOSIS" AND demographic.age < "47"
mimicsql_data
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...
give me the number of patients whose admission year is less than 2115 and procedure long title is insertion of non-drug-eluting coronary artery stent(s)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2115" AND procedures.long_title = "Insertion of non-drug-eluting coronary artery stent(s)"
mimicsql_data
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...
算算医院9301014全部诊疗记录中不同科室统筹基金的开销和全部医疗费用的平均比值
SELECT t_kc21.MED_ORG_DEPT_NM, AVG(t_kc24.OVE_PAY) FROM t_kc21 JOIN t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE t_kc21.MED_SER_ORG_NO = '9301014' GROUP BY t_kc21.MED_ORG_DEPT_NM
css
CREATE TABLE table_41950 ( "Year" real, "Team" text, "Co-Drivers" text, "Class" text, "Laps" real, "Pos." text, "Class Pos." text )
Can you tell me the Team that has the Laps of 379?
SELECT "Team" FROM table_41950 WHERE "Laps" = '379'
wikisql
CREATE TABLE table_65561 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
What Tournament had Jack Nicklaus as Runner(s)-up?
SELECT "Tournament" FROM table_65561 WHERE "Runner(s)-up" = 'jack nicklaus'
wikisql
CREATE TABLE artist ( name VARCHAR, year_join VARCHAR )
What is the name of the artist who joined latest?
SELECT name FROM artist ORDER BY year_join DESC LIMIT 1
sql_create_context
CREATE TABLE table_19187 ( "Cast" text, "1951 ( BBC )" text, "1957 (BBC)" text, "1968 (BBC)" text, "1970 (film)" text, "2000 ( Carlton Television )" text )
Name the 1970 film when 1951 bbc is michael croudson
SELECT "1970 (film)" FROM table_19187 WHERE "1951 ( BBC )" = 'Michael Croudson'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
tell me the time of discharge and long title of diagnosis for the patient with patient id 52012.
SELECT demographic.dischtime, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "52012"
mimicsql_data
CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Purchases ( purchase_transaction_id INTEGER, purchase_details VARCHAR(255) ) CREATE TABLE Investors ( investor_id ...
A bar chart for what are the number of the purchase details of transactions with amount bigger than 10000?, and I want to show by the X from high to low please.
SELECT purchase_details, COUNT(purchase_details) FROM Purchases AS T1 JOIN Transactions AS T2 ON T1.purchase_transaction_id = T2.transaction_id WHERE T2.amount_of_transaction > 10000 GROUP BY purchase_details ORDER BY purchase_details DESC
nvbench
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
有哪些人在医疗就诊62628580577中报告超过4份检验报告单?列出这些人工号和姓名都是什么?
SELECT jybgb.BGRGH, jybgb.BGRXM FROM jybgb WHERE jybgb.JZLSH = '62628580577' GROUP BY jybgb.BGRGH HAVING COUNT(*) > 4
css
CREATE TABLE table_name_51 ( built VARCHAR, period VARCHAR )
How many cabins were built in the time between 1967-1987?
SELECT built FROM table_name_51 WHERE period = "1967-1987"
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE intakeoutput ( in...
what is the name of the drug that was prescribed to patient 025-50079 within the same day after having been diagnosed with a pulmonary embolism?
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-50079') AND diagnosis.diagnos...
eicu
CREATE TABLE table_2233872_1 ( Otl INTEGER, l VARCHAR )
What was the maximum OTL if L is 28?
SELECT MAX(Otl) FROM table_2233872_1 WHERE l = 28
sql_create_context
CREATE TABLE table_15409 ( "Date" text, "City" text, "Event" text, "Winner" text, "Prize" text )
What is the Prize, when the Winner is Aaron Gustavson?
SELECT "Prize" FROM table_15409 WHERE "Winner" = 'aaron gustavson'
wikisql
CREATE TABLE table_33142 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" text )
What was the date when the attendance was 73,529?
SELECT "Date" FROM table_33142 WHERE "Attendance" = '73,529'
wikisql
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
mention the admission type and death status of subject id 22999.
SELECT demographic.admission_type, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "22999"
mimicsql_data
CREATE TABLE table_38754 ( "Couple" text, "Score" text, "Style" text, "Music" text, "Result" text )
Which Score has a Couple of cristi n & cheryl, and a Style of cha-cha-cha?
SELECT "Score" FROM table_38754 WHERE "Couple" = 'cristián & cheryl' AND "Style" = 'cha-cha-cha'
wikisql
CREATE TABLE table_name_58 ( time VARCHAR, track_number VARCHAR, song_title VARCHAR )
Name the time with track number less than 4 for you're my everything
SELECT time FROM table_name_58 WHERE track_number < 4 AND song_title = "you're my everything"
sql_create_context
CREATE TABLE table_name_88 ( os_x VARCHAR, name VARCHAR )
What is the OS X for the Home Media Center?
SELECT os_x FROM table_name_88 WHERE name = "home media center"
sql_create_context
CREATE TABLE table_68130 ( "Year" real, "Team" text, "Co-Drivers" text, "Class" text, "Laps" real, "Pos." text, "Class Pos." text )
Which co drivers are 3rd in Joest racing?
SELECT "Co-Drivers" FROM table_68130 WHERE "Pos." = '3rd' AND "Team" = 'joest racing'
wikisql
CREATE TABLE table_name_4 ( headquarter VARCHAR, newspaper_magazine VARCHAR )
What is Headquarter, when Newspaper/Magazine is Al-Ayyam?
SELECT headquarter FROM table_name_4 WHERE newspaper_magazine = "al-ayyam"
sql_create_context
CREATE TABLE table_56827 ( "Chemical class" text, "Group" text, "Formula" text, "Prefix" text, "Suffix" text )
Which formula has thial as a chemical class?
SELECT "Formula" FROM table_56827 WHERE "Chemical class" = 'thial'
wikisql
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...
what is the number of patients whose drug type is additive and lab test name is rdw?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "ADDITIVE" AND lab.label = "RDW"
mimicsql_data
CREATE TABLE invoice ( invoiceid number, customerid number, invoicedate time, billingaddress text, billingcity text, billingstate text, billingcountry text, billingpostalcode text, total number ) CREATE TABLE playlisttrack ( playlistid number, trackid number ) CREATE TABLE ...
Count the number of tracks that are part of the rock genre.
SELECT COUNT(*) FROM genre AS T1 JOIN track AS T2 ON T1.genreid = T2.genreid WHERE T1.name = "Rock"
spider
CREATE TABLE table_30141 ( "Institution" text, "City" text, "State" text, "Team Name" text, "Affiliation" text, "Enrollment" real, "Home Conference" text )
What kind of institute is in Indiana?
SELECT "Affiliation" FROM table_30141 WHERE "State" = 'Indiana'
wikisql
CREATE TABLE table_22874 ( "Outcome" text, "Year" real, "Championship" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
Who did she play with on clay?
SELECT "Partner" FROM table_22874 WHERE "Surface" = 'Clay'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row...
what was the maximum yearly number of patients diagnosed with part epil w/o intr epil until 1 year ago?
SELECT MAX(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'part epil w/o intr epil') AND DATETIME(diagnoses_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')...
mimic_iii
CREATE TABLE table_59547 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What is the Tie No with a Score of 2 2?
SELECT "Tie no" FROM table_59547 WHERE "Score" = '2–2'
wikisql
CREATE TABLE table_name_86 ( gold INTEGER, rank VARCHAR, total VARCHAR, silver VARCHAR, bronze VARCHAR )
What is the sum of gold medal totals for nations with 1 silver, less than 2 bronze, and ranked below 10?
SELECT SUM(gold) FROM table_name_86 WHERE silver = 1 AND bronze < 2 AND total = 1 AND rank < 10
sql_create_context
CREATE TABLE table_37481 ( "Date" text, "City" text, "Result" text, "Score" text, "Competition" text )
Which City has a Date of may 19, 1976?
SELECT "City" FROM table_37481 WHERE "Date" = 'may 19, 1976'
wikisql
CREATE TABLE table_name_77 ( _percentage_wt_2nd VARCHAR, bp_3rd_comp__˚c_ VARCHAR )
Tell me the % of wt 2nd for bp 3rd comp of 98.4
SELECT _percentage_wt_2nd FROM table_name_77 WHERE bp_3rd_comp__˚c_ = "98.4"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
tell me the cost of a lab test for glucose, ascites?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'labevents' AND cost.event_id IN (SELECT labevents.row_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose, ascites'))
mimic_iii
CREATE TABLE table_name_92 ( country VARCHAR, name VARCHAR )
What country did Dmitriy Karpov represent?
SELECT country FROM table_name_92 WHERE name = "dmitriy karpov"
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...
how many patients whose marital status is single and diagnoses long title is hemochromatosis due to repeated red blood cell transfusions?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Hemochromatosis due to repeated red blood cell transfusions"
mimicsql_data
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...
列出37304370这名患者从零一年三月十一开始到二一年六月二十七这段时间在医院8586775被开的所有的药名还有药物的编码
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '37304370' AND gwyjzb.MED_SER_ORG_NO = '8586775' AND gwyjzb.IN_HOSP_DATE BETWEEN '2001-03-11' AND '2021-06-27' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb...
css
CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE month ( month_number int, month_name text ) CREATE TA...
please list the AA flights from PHILADELPHIA to DALLAS on tuesday october first
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 = 'DALLAS' AND date_day.day_number = 22 AND date_day.month_number = 3 AND d...
atis
CREATE TABLE table_79787 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
Which teams had an aggregate score of 3-4?
SELECT "Team 1" FROM table_79787 WHERE "Agg." = '3-4'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
在两千年七月三十日至两千零四年二月二十九日期间医院4897749有几科室在门诊就诊中开出了超过30张检验报告单?
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE mzjzjlb.YLJGDM = '4897749' AND jybgb.BGRQ BETWEEN '2000-07-30' AND '2004-02-29' GROUP BY jybgb.KSBM HAVING COUNT(*) > 30) AS T
css
CREATE TABLE table_17168 ( "Player" text, "No.(s)" real, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
What are all the positions for the rockets in 2008?
SELECT "Position" FROM table_17168 WHERE "Years for Rockets" = '2008'
wikisql
CREATE TABLE table_name_76 ( draw VARCHAR, performer VARCHAR )
WHAT IS THE DRAW FOR PERFORMER ANDREA CUBRIC?
SELECT draw FROM table_name_76 WHERE performer = "andrea cubric"
sql_create_context
CREATE TABLE table_8123 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
Which Runner(s)-up has a Tournament of cameron park open?
SELECT "Runner(s)-up" FROM table_8123 WHERE "Tournament" = 'cameron park open'
wikisql
CREATE TABLE table_75539 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Safeties" real, "Points" real )
Which Points is the lowest one that has Touchdowns smaller than 2, and an Extra points of 7, and a Field goals smaller than 0?
SELECT MIN("Points") FROM table_75539 WHERE "Touchdowns" < '2' AND "Extra points" = '7' AND "Field goals" < '0'
wikisql
CREATE TABLE table_27755784_8 ( team VARCHAR, high_points VARCHAR )
How many teams have hight points listed as David Lee (31)?
SELECT COUNT(team) FROM table_27755784_8 WHERE high_points = "David Lee (31)"
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
since 4 years ago, has a microbiology test been performed for patient 025-28600?
SELECT COUNT(*) > 0 FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-28600')) AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(...
eicu
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...
想知道患者蒋阳飙在二0一一年十月十四日到二0二0年十一月十九日期间被开出利可君片(薄膜衣)的总次数是多少
SELECT COUNT(*) FROM t_kc21 JOIN t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE t_kc21.PERSON_NM = '蒋阳飙' AND t_kc22.STA_DATE BETWEEN '2011-10-14' AND '2020-11-19' AND t_kc22.SOC_SRT_DIRE_NM = '利可君片(薄膜衣)'
css
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, Cr...
List of questions with bounties.
SELECT PostId AS "post_link", CreationDate, BountyAmount FROM Votes WHERE NOT BountyAmount IS NULL ORDER BY CreationDate DESC, BountyAmount DESC LIMIT 500
sede
CREATE TABLE table_25718552_2 ( Ends INTEGER, stolen_ends VARCHAR )
What is the largest amount of ends won when stolen ends were 3?
SELECT MAX(Ends) AS won FROM table_25718552_2 WHERE stolen_ends = 3
sql_create_context
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), CO...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, and rank from high to low by the total number.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID) DESC
nvbench
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, ...
Questions with close votes by specific tag.
SELECT ROW_NUMBER() OVER (ORDER BY p.Id), p.Id AS "post_link", p.Tags FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE v.VoteTypeId = 6 AND p.ClosedDate IS NULL AND t.TagName = '##Tag:string?tagname##'
sede
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 text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
count the number of patients whose drug code is thym25i and lab test fluid is cerebrospinal fluid (csf).
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "THYM25I" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE PostTypes ( Id number, Name text ) C...
Most downvoted posts of all time.
SELECT Id, Score, Title, Body FROM Posts WHERE Score < 0 ORDER BY Score LIMIT 50
sede
CREATE TABLE table_31026 ( "Club" text, "Location" text, "Stadium" text, "Capacity" real, "Manager" text, "Captain" text )
Who is the manager for the fc inter club?
SELECT "Manager" FROM table_31026 WHERE "Club" = 'FC Inter'
wikisql
CREATE TABLE table_43123 ( "Livery" text, "Locomotive type" text, "Wheel Arrangement" text, "Builder" text, "Year built" real )
What is the livery of the steam locomotive built after 1950 with a wheel arrangement of 2-6-2?
SELECT "Livery" FROM table_43123 WHERE "Locomotive type" = 'steam' AND "Year built" > '1950' AND "Wheel Arrangement" = '2-6-2'
wikisql