context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time,...
what is the minimum total hospital cost to include a procedure called cv cath plcmt w guidance until 2104?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cv cath plcmt w guidance')) AND STRFTIME('%y', cost.charg...
mimic_iii
CREATE TABLE Museums ( Museum_ID INTEGER, Museum_Details VARCHAR(255) ) CREATE TABLE Street_Markets ( Market_ID INTEGER, Market_Details VARCHAR(255) ) CREATE TABLE Visitors ( Tourist_ID INTEGER, Tourist_Details VARCHAR(255) ) CREATE TABLE Features ( Feature_ID INTEGER, Feature_Details...
Show the number of visit date from each visit date, list total number in descending order please.
SELECT Visit_Date, COUNT(Visit_Date) FROM Visits ORDER BY COUNT(Visit_Date) DESC
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, u...
when had patient 006-195316 last had the maximum respiration on 04/17/this year?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195316')) AND NOT vitalperiodic.respiration IS ...
eicu
CREATE TABLE table_9349 ( "Event" text, "Skip" text, "Lead" text, "Alternate" text, "Result" text )
What event had Wang Bingyu for the skip?
SELECT "Event" FROM table_9349 WHERE "Skip" = 'wang bingyu'
wikisql
CREATE TABLE table_28051 ( "Episode no." real, "Airdate" text, "Dave Viewers" real, "Dave Rank" real, "Rank (cable)" real, "Dave ja vu Viewers" real, "Total viewers" real )
Which episode number aired on 18 october 2012?
SELECT MIN("Episode no.") FROM table_28051 WHERE "Airdate" = '18 October 2012'
wikisql
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 jyjgzbb ( BGDH text, BGRQ tim...
孔雅静患者报告日期均在2011年1月25日之后的住院就诊记录对应着哪些检验报告单和住院就诊流水号是多少?
SELECT zyjzjlb.JZLSH 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 NOT zyjzjlb.JZLSH IN (SELECT jybgb.JZLSH FROM jybgb WHERE jybgb.BGRQ <= '2011-01-25')
css
CREATE TABLE table_66799 ( "January" text, "February" text, "March" text, "April" text, "June" text, "July" text, "August" text, "September" text, "October" text, "November" text, "December" text )
Who is in November where February is willy rey?
SELECT "November" FROM table_66799 WHERE "February" = 'willy rey'
wikisql
CREATE TABLE table_22591 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text )
What is the production code for episode 'surgery'?
SELECT "Production code" FROM table_22591 WHERE "Title" = 'Surgery'
wikisql
CREATE TABLE table_202_161 ( id number, "dutch language group\nelectoral district (as of 2012)" text, "dutch language group\nseats" text, "french language group\nelectoral district (as of 2012)" text, "french language group\nseats" text )
which electoral district in the dutch language group has the most seats allotted to it ?
SELECT "dutch language group\nelectoral district (as of 2012)" FROM table_202_161 ORDER BY "dutch language group\nseats" DESC LIMIT 1
squall
CREATE TABLE table_52135 ( "Crew" real, "Open 1st VIII" text, "Open 2nd VIII" text, "Open 3rd VIII" text, "U16 1st VIII" text, "U16 2nd VIII" text, "U16 3rd VIII" text, "U15 1st Quad" text, "U15 2nd Quad" text, "U15 3rd Quad" text, "U15 4th Quad" text, "U15 5th Quad" text...
What U15 3rd Quad has a U15 2nd Quad of ACGS?
SELECT "U15 3rd Quad" FROM table_52135 WHERE "U15 2nd Quad" = 'acgs'
wikisql
CREATE TABLE table_name_97 ( perth VARCHAR, adelaide VARCHAR, sydney VARCHAR, gold_coast VARCHAR )
Which Perth also has Sydney yes, Gold Coast yes, and Adelaide no?
SELECT perth FROM table_name_97 WHERE sydney = "yes" AND gold_coast = "yes" AND adelaide = "no"
sql_create_context
CREATE TABLE table_61759 ( "Player" text, "Country" text, "Year(s) won" text, "Total" real, "To par" real )
What is the to par for the player with fewer than 148 total points?
SELECT SUM("To par") FROM table_61759 WHERE "Total" < '148'
wikisql
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
What is the number of upper level classes that have labs ?
SELECT COUNT(DISTINCT course.course_id) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_lab = 'Y' AND program_course.category LIKE '%ULCS%'
advising
CREATE TABLE table_name_97 ( callsign VARCHAR, brand VARCHAR, webcast VARCHAR, frequency VARCHAR )
Which Callsign includes a frequency under 1210, Newsradio 740 KTRH, and webcasts with listen live?
SELECT callsign FROM table_name_97 WHERE webcast = "listen live" AND frequency < 1210 AND brand = "newsradio 740 ktrh"
sql_create_context
CREATE TABLE table_name_49 ( pick__number VARCHAR, college_junior_club_team VARCHAR, position VARCHAR )
What is the Pick # for the College/junior/club team of edmonton oil kings (wchl), and the position if defence?
SELECT pick__number FROM table_name_49 WHERE college_junior_club_team = "edmonton oil kings (wchl)" AND position = "defence"
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 primary disease is coronary artery disease\coronary artery bypass graft /sda and year of birth is less than 2095?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA" AND demographic.dob_year < "2095"
mimicsql_data
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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, lan...
what is the pricing for nystatin-triamcinolone cream?
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'prescriptions' AND cost.event_id IN (SELECT prescriptions.row_id FROM prescriptions WHERE prescriptions.drug = 'nystatin-triamcinolone cream')
mimic_iii
CREATE TABLE table_31697 ( "Region" text, "Host" text, "Venue" text, "City" text, "State" text )
What state is the University of Tennessee located in?
SELECT "State" FROM table_31697 WHERE "Host" = 'university of tennessee'
wikisql
CREATE TABLE table_name_48 ( record VARCHAR, week VARCHAR, opponent VARCHAR )
Which Record has a Week smaller than 15, and an Opponent of at new york jets?
SELECT record FROM table_name_48 WHERE week < 15 AND opponent = "at new york jets"
sql_create_context
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 times has patient 030-53416 received a heparin gtt intake until 08/28/2105?
SELECT COUNT(*) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-53416')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.ce...
eicu
CREATE TABLE table_40728 ( "Station" text, "Local authority [a ]" text, "Servedby" text, "Station users 2004\u201305" real, "Station users 2005\u201306" real )
Which Servedby has a Local authority [a ] of thurrock, and a Station of ockendon?
SELECT "Servedby" FROM table_40728 WHERE "Local authority [a ]" = 'thurrock' AND "Station" = 'ockendon'
wikisql
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
患者吕博涉的胸腹水白蛋白(白蛋白)什么情况在14年9月30日到20年8月11日期间
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_72824 ( "Rank" real, "Company" text, "Headquarters" text, "Industry" text, "Sales (billion $)" text, "Profits (billion $)" text, "Assets (billion $)" text, "Market Value (billion $)" text )
Which industry has a company with a market value of 80.3 billion?
SELECT "Industry" FROM table_72824 WHERE "Market Value (billion $)" = '80.3'
wikisql
CREATE TABLE table_20513 ( "Line" text, "Terminals" text, "Status" text, "Length" text, "Total number of stations" real, "Operator" text )
What are the terminals for line 2?
SELECT "Terminals" FROM table_20513 WHERE "Line" = 'Line 2'
wikisql
CREATE TABLE table_33048 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the sum of the crowds in the matches where the away team scored 11.8 (74)?
SELECT SUM("Crowd") FROM table_33048 WHERE "Away team score" = '11.8 (74)'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
what procedure did patient 99082 receive the first time in their first hospital visit.
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99082 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admit...
mimic_iii
CREATE TABLE table_41389 ( "Episode Number" real, "Air Date" text, "Guest Host" text, "Musical Guest (Song performed)" text, "Coat Of Cash Wearing Celebrity" text )
What is the Musical Guest (Song performed) for the episode aired on 13 july 2008?
SELECT "Musical Guest (Song performed)" FROM table_41389 WHERE "Air Date" = '13 july 2008'
wikisql
CREATE TABLE table_18708 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What year was someone first elected?
SELECT MIN("First elected") FROM table_18708
wikisql
CREATE TABLE table_name_4 ( regular_season_champion_s_ VARCHAR, tournament_champion VARCHAR, year VARCHAR )
Which Regular Season Champion(s) has a Tournament Champion of west virginia in 1955 56?
SELECT regular_season_champion_s_ FROM table_name_4 WHERE tournament_champion = "west virginia" AND year = "1955–56"
sql_create_context
CREATE TABLE fzzmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZD...
患者21324611在01年4月21日到2011年6月2日内的所有检验结果指标记录的检测人为姜欣合的检测指标流水号是多少?
SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.B...
css
CREATE TABLE table_name_39 ( tries_against VARCHAR, points_against VARCHAR )
How many tries against did the club with 383 points against have?
SELECT tries_against FROM table_name_39 WHERE points_against = "383"
sql_create_context
CREATE TABLE table_name_48 ( format VARCHAR, catalog_number VARCHAR, year VARCHAR, label VARCHAR )
Tell me the format with year more than 2000 and label of myuzyk with catalog number of mzykn08
SELECT format FROM table_name_48 WHERE year > 2000 AND label = "myuzyk" AND catalog_number = "mzykn08"
sql_create_context
CREATE TABLE table_23274514_4 ( high_points VARCHAR, record VARCHAR )
Who had the highest points during the game with a record of 2-7?
SELECT high_points FROM table_23274514_4 WHERE record = "2-7"
sql_create_context
CREATE TABLE table_13464416_8 ( location_attendance VARCHAR, record VARCHAR )
What was the location and attendance when the team's record was 16-44?
SELECT location_attendance FROM table_13464416_8 WHERE record = "16-44"
sql_create_context
CREATE TABLE table_name_2 ( money___$__ VARCHAR, to_par VARCHAR )
What is the Money ($) amount of the Player with a To par of e?
SELECT money___$__ FROM table_name_2 WHERE to_par = "e"
sql_create_context
CREATE TABLE table_name_16 ( player VARCHAR, score VARCHAR )
Who is the player with a score of 69-70-76=215?
SELECT player FROM table_name_16 WHERE score = 69 - 70 - 76 = 215
sql_create_context
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 jybgb.BGDH FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX AND zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '任...
css
CREATE TABLE table_3858 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
how many times is the team oklahoma city?
SELECT COUNT("High points") FROM table_3858 WHERE "Team" = 'Oklahoma City'
wikisql
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CR...
since 1 year ago, what were the top three most frequent laboratory tests ordered for patients during the same month after receiving a incis thyroid field nec?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_i...
mimic_iii
CREATE TABLE table_name_41 ( data VARCHAR, percent_gain VARCHAR )
Name the data with a percent gain of 28.4%
SELECT data FROM table_name_41 WHERE percent_gain = "28.4%"
sql_create_context
CREATE TABLE table_40360 ( "Position" text, "Jersey #" real, "Name" text, "Height (cm)" real, "Weight (kg)" real, "Birthdate" text, "Birthplace" text, "2008\u20132009 Team" text )
What is the weight of John-Michael Liles?
SELECT "Weight (kg)" FROM table_40360 WHERE "Name" = 'john-michael liles'
wikisql
CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text ) CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text )
How many companies each investor has invested? Show me a bar chart, and show by the X from low to high.
SELECT Investor, COUNT(Investor) FROM entrepreneur GROUP BY Investor ORDER BY Investor
nvbench
CREATE TABLE table_38960 ( "Poll" text, "Wk 1" text, "Wk 2" text, "Wk 3" text, "Wk 4" text, "Wk 5" text, "Wk 6" text, "Wk 7" text, "Wk 8" real, "Wk 9" real, "Wk 10" real, "Wk 11" real, "Wk 13" real, "Wk 14" real )
Which poll had a week 10 larger than 2, a week 2 of exactly 12, and a week 13 of 8?
SELECT "Poll" FROM table_38960 WHERE "Wk 10" > '2' AND "Wk 2" = '12' AND "Wk 13" = '8'
wikisql
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, war...
what was patient 11362 last height since 10/2105?
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 = 11362)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit ht'...
mimic_iii
CREATE TABLE table_27003223_4 ( registered_voters VARCHAR, d_r_spread VARCHAR )
What is the percentage of registered voters in which the d-r spread is +10.4%?
SELECT registered_voters FROM table_27003223_4 WHERE d_r_spread = "+10.4%"
sql_create_context
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 ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE out...
what lab tests were given to patient 99082 for the first time on their last hospital encounter?
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT labevents.itemid FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 99082 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) ORDER BY labevents.chartti...
mimic_iii
CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text ) CREATE TABLE editor ( Editor_ID int, Name text, Age real ) CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int )
Just show the id and name of each editor using a bar chart, and could you show in desc by the Editor_ID?
SELECT T1.Name, T1.Editor_ID FROM editor AS T1 JOIN journal_committee AS T2 ON T1.Editor_ID = T2.Editor_ID ORDER BY T1.Editor_ID DESC
nvbench
CREATE TABLE table_27902171_6 ( location_attendance VARCHAR, team VARCHAR )
What location with it's corresponding attendance was the game against Utah Jazz?
SELECT location_attendance FROM table_27902171_6 WHERE team = "Utah Jazz"
sql_create_context
CREATE TABLE table_name_7 ( championship VARCHAR )
What is the 54 holes for The Open Championship (4)?
SELECT 54 AS _holes FROM table_name_7 WHERE championship = "the open championship (4)"
sql_create_context
CREATE TABLE table_69866 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" real )
What is the highest amount of money a play from Scotland United States has?
SELECT MAX("Money ( $ )") FROM table_69866 WHERE "Country" = 'scotland united states'
wikisql
CREATE TABLE table_62356 ( "Event" text, "Time" text, "Nationality" text, "Date" text, "Meet" text, "Location" text )
What is the time of the 100m freestyle event?
SELECT "Time" FROM table_62356 WHERE "Event" = '100m freestyle'
wikisql
CREATE TABLE table_name_49 ( frequency VARCHAR, owner VARCHAR, branding VARCHAR )
What is the frequency of the station owned by the Canadian Broadcasting Corporation and branded as CBC Radio One?
SELECT frequency FROM table_name_49 WHERE owner = "canadian broadcasting corporation" AND branding = "cbc radio one"
sql_create_context
CREATE TABLE table_204_26 ( id number, "name" text, "position" text, "birth date/age at start of campaign" text, "games in campaign" text, "club" text )
who is the only player to play in 5 games , 1 as a sub ?
SELECT "name" FROM table_204_26 WHERE "games in campaign" = 5 AND "games in campaign" = '1 as sub'
squall
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9cod...
did patient 027-132801 have a heartrate that was greater than 55.0?
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-132801')) AND vitalperiodic.heartrate > 55.0 AND NOT vitalperiod...
eicu
CREATE TABLE table_name_36 ( score VARCHAR, place VARCHAR, player VARCHAR )
What's the score of Jeff Maggert in T2 place?
SELECT score FROM table_name_36 WHERE place = "t2" AND player = "jeff maggert"
sql_create_context
CREATE TABLE table_41141 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What is the Surface of indoor/carpet Outcome on 13 October 1996
SELECT "Outcome" FROM table_41141 WHERE "Surface" = 'indoor/carpet' AND "Date" = '13 october 1996'
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, ...
what was the first procedure time of patient 006-113829 during their last hospital encounter for stress ulcer prophylaxis - pantoprazole?
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-113829' AND NOT patient.hospitaldischargetime IS NULL ORDER B...
eicu
CREATE TABLE Statements ( Statement_ID INTEGER, Statement_Details VARCHAR(255) ) CREATE TABLE Accounts ( Account_ID INTEGER, Statement_ID INTEGER, Account_Details VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Typ...
What are the different budget type codes, and how many documents are there for each. Plot them as bar chart.
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code
nvbench
CREATE TABLE employees ( employee_id number, role_code text, employee_name text, other_details text ) CREATE TABLE documents_mailed ( document_id number, mailed_to_address_id number, mailing_date time ) CREATE TABLE ref_document_status ( document_status_code text, document_status_d...
For each document, list the number of employees who have showed up in the circulation history of that document. List the document ids and number of employees.
SELECT document_id, COUNT(DISTINCT employee_id) FROM circulation_history GROUP BY document_id
spider
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients are admitted under emergency and treated via the drug route ivpca?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.route = "IVPCA"
mimicsql_data
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, a...
when did patient 16248 get the procedure for the first time on the first hospital visit.
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16248 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) ORDER BY procedures_icd.charttime LIMIT 1
mimic_iii
CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Coun...
How many stadiums does each country have. Show bar chart.
SELECT Country, COUNT(*) FROM stadium GROUP BY Country
nvbench
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
provide the number of government health insurance patients who have other percutaneous procedures on biliary tract.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.long_title = "Other percutaneous procedures on biliary tract"
mimicsql_data
CREATE TABLE table_203_341 ( id number, "season" text, "champion" text, "runner-up" text, "score" text, "third place" text )
how many third place wins can ericsson bobry bytom call his own ?
SELECT COUNT("third place") FROM table_203_341 WHERE "third place" = 'ericsson bobry bytom'
squall
CREATE TABLE table_203_527 ( id number, "tournament" text, "games played" number, "points per game" number, "rebounds per game" number, "assists per game" number )
during which tournament did florent average the least points per game ?
SELECT "tournament" FROM table_203_527 ORDER BY "points per game" LIMIT 1
squall
CREATE TABLE table_204_279 ( id number, "name of place" text, "number\nof\ncounties" number, "principal\ncounty" text, "zip code\nlower" number, "zip code\nupper" number )
what are the number of times weld county is listed on this chart ?
SELECT COUNT(*) FROM table_204_279 WHERE "principal\ncounty" = 'weld county'
squall
CREATE TABLE table_24037 ( "Tour" text, "Mens singles" text, "Womens singles" text, "Mens doubles" text, "Womens doubles" text, "Mixed doubles" text )
when mixed doubles is zheng bo ma jin and womens singles is wang yihan, what was the tour?
SELECT "Tour" FROM table_24037 WHERE "Mixed doubles" = 'Zheng Bo Ma Jin' AND "Womens singles" = 'Wang Yihan'
wikisql
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
列出编码为在0655501为医院中患者46992824就诊科室名称不包含修复的所有医疗就诊记录是哪些?
SELECT * FROM t_kc21 WHERE PERSON_ID = '46992824' AND MED_SER_ORG_NO = '0655501' AND NOT MED_ORG_DEPT_NM LIKE '%修复%'
css
CREATE TABLE apartment_facilities ( apt_id number, facility_code text ) CREATE TABLE view_unit_status ( apt_id number, apt_booking_id number, status_date time, available_yn others ) CREATE TABLE guests ( guest_id number, gender_code text, guest_first_name text, guest_last_name ...
Show the start dates and end dates of all the apartment bookings made by guests with gender code 'Female'.
SELECT T1.booking_start_date, T1.booking_start_date FROM apartment_bookings AS T1 JOIN guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female"
spider
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...
通过进行不同的科室编码然后加上入院诊断疾病名称的筛选得到在1104291号医院记载的所有医疗就诊记录中患者的平均年龄是多少呢?
SELECT t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '1104291' GROUP BY t_kc21.MED_ORG_DEPT_CD, t_kc21.IN_DIAG_DIS_NM
css
CREATE TABLE t_kc21 ( 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, ...
这位褚泰鸿的患者在11年1月20日到21年4月6日期间医保的医疗总消费金额有多少
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc21 JOIN t_kc24 JOIN t_kc21_t_kc24 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc24.MED_CLINIC_ID AND t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID WHERE t_kc21.PERSON_NM = '褚泰鸿' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2011-01-20' AND '2021-04-06'
css
CREATE TABLE table_48435 ( "Season" text, "GP\u2013GS" text, "Yards" text, "Long" text, "Avg/G" text )
What was the Av/G of the 2009 season?
SELECT "Avg/G" FROM table_48435 WHERE "Season" = '2009'
wikisql
CREATE TABLE train ( Train_ID int, Name text, Time text, Service text ) CREATE TABLE station ( Station_ID int, Name text, Annual_entry_exit real, Annual_interchanges real, Total_Passengers real, Location text, Main_Services text, Number_of_Platforms int ) CREATE TABLE t...
What is the number of platforms for each location? Show the comparison with a bar chart, rank bars from high to low order.
SELECT Location, SUM(Number_of_Platforms) FROM station GROUP BY Location ORDER BY Location DESC
nvbench
CREATE TABLE table_name_34 ( bike_no INTEGER, driver___passenger VARCHAR, position VARCHAR )
What is the average Bike No, when Driver / Passenger is Joris Hendrickx / Kaspars Liepins, and when Position is greater than 4?
SELECT AVG(bike_no) FROM table_name_34 WHERE driver___passenger = "joris hendrickx / kaspars liepins" AND position > 4
sql_create_context
CREATE TABLE table_name_74 ( attendance INTEGER, arena VARCHAR, loss VARCHAR )
Which Attendance has an Arena of arrowhead pond of anaheim, and a Loss of giguere (3 3)?
SELECT MAX(attendance) FROM table_name_74 WHERE arena = "arrowhead pond of anaheim" AND loss = "giguere (3–3)"
sql_create_context
CREATE TABLE table_name_21 ( class VARCHAR, facility_id VARCHAR )
What is the class of facility ID 150935?
SELECT class FROM table_name_21 WHERE facility_id = 150935
sql_create_context
CREATE TABLE table_65611 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
How many people attended on december 26, 1982?
SELECT "Attendance" FROM table_65611 WHERE "Date" = 'december 26, 1982'
wikisql
CREATE TABLE t_kc21 ( 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, ...
编号为57271172的病患的医疗记录中有多少回被开出的药品金额不多于2998.53元?看看这些医疗就诊的编号
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '57271172' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 2998.53)
css
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDi...
Movement of Users vs Downvote Ratio.
SELECT DATEFROMPARTS(YEAR(U.CreationDate), MONTH(U.CreationDate), 1) AS YearMonth, MAX(U.Id) AS MaxUsers, MAX(U.Id) - LAG(MAX(U.Id), 1, 0) OVER (ORDER BY DATEFROMPARTS(YEAR(U.CreationDate), MONTH(U.CreationDate), 1)) AS Change, 1 / (CAST(SUM(CASE WHEN V.VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / NULLIF(CAST(SUM(CASE...
sede
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
尤飞双这位患者在就诊期间购买的药物价格超了7155.47元的次数有几次?都对应了什么编号?
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '尤飞双' AND MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc22 WHERE AMOUNT > 7155.47)
css
CREATE TABLE table_name_32 ( frequency VARCHAR, city_of_license VARCHAR )
what is the Frequency that has a fairview City of license
SELECT frequency FROM table_name_32 WHERE city_of_license = "fairview"
sql_create_context
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 jybgb ( BBCJBW text, BBDM tex...
内有几个科室在2007年3月29日到2008年4月25日之间在医院1746368门诊就诊中开出超过28张检验报告单啊?
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 people ( people_id number, name text, age number, height number, hometown text ) CREATE TABLE gymnast ( gymnast_id number, floor_exercise_points number, pommel_horse_points number, rings_points number, vault_points number, parallel_bars_points number, horizo...
Show the hometowns shared by people older than 23 and younger than 20.
SELECT hometown FROM people WHERE age > 23 INTERSECT SELECT hometown FROM people WHERE age < 20
spider
CREATE TABLE airlines ( alid number, name text, iata text, icao text, callsign text, country text, active text ) CREATE TABLE airports ( apid number, name text, city text, country text, x number, y number, elevation number, iata text, icao text ) CREATE ...
Find the number of different airports which are the destinations of the American Airlines.
SELECT COUNT(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
spider
CREATE TABLE table_34184 ( "Game" real, "December" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Which Game has a Score of 4 0 and Points of 44?
SELECT "Game" FROM table_34184 WHERE "Score" = '4–0' AND "Points" = '44'
wikisql
CREATE TABLE table_46989 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
What away team has a Tie no of 5?
SELECT "Away team" FROM table_46989 WHERE "Tie no" = '5'
wikisql
CREATE TABLE table_name_90 ( pick__number INTEGER, player VARCHAR, reg_gp VARCHAR )
What is the lowest Pick # with michael grabner and less than 20 Reg GP?
SELECT MIN(pick__number) FROM table_name_90 WHERE player = "michael grabner" AND reg_gp < 20
sql_create_context
CREATE TABLE table_22879323_6 ( high_assists VARCHAR, record VARCHAR )
When the record was 2-29 who had the most assists?
SELECT high_assists FROM table_22879323_6 WHERE record = "2-29"
sql_create_context
CREATE TABLE table_name_55 ( freq INTEGER, owner VARCHAR, day_power___w__ VARCHAR )
What is the WPW freq with a day power of 250?
SELECT SUM(freq) FROM table_name_55 WHERE owner = "wpw" AND day_power___w__ > 250
sql_create_context
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients stayed in hospital for more than 16 days and were diagnosed with icd9 code v489?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "16" AND diagnoses.icd9_code = "V489"
mimicsql_data
CREATE TABLE table_name_79 ( last_title VARCHAR, country VARCHAR, wins VARCHAR, first_title VARCHAR )
What is the total of Last title that has Wins smaller than 71 and a First title larger than 1968 and a Country of fiji?
SELECT COUNT(last_title) FROM table_name_79 WHERE wins < 71 AND first_title > 1968 AND country = "fiji"
sql_create_context
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswe...
Questions with recent activity - including activity on answers.
SELECT COALESCE(p.ParentId, p.Id) AS "post_link", MAX(p.LastActivityDate) FROM Posts AS p GROUP BY COALESCE(p.ParentId, p.Id) ORDER BY MAX(p.LastActivityDate) DESC LIMIT 100
sede
CREATE TABLE table_10285 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What date did the Home team score 11.21 (87)?
SELECT "Date" FROM table_10285 WHERE "Home team score" = '11.21 (87)'
wikisql
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, Du...
Highest scoring answers with at least one image.
SELECT Id AS "post_link", Score, CreationDate, LENGTH(Body) FROM Posts WHERE PostTypeId = 2 AND Body LIKE '%<img%' ORDER BY Score DESC, LENGTH(Body)
sede
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and the sum of code , and group by attribute name, and sort Y-axis in descending order.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code DESC
nvbench
CREATE TABLE allergy_type ( allergy text, allergytype text ) CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
What are the average ages for male and female students?
SELECT AVG(age), sex FROM student GROUP BY sex
spider
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 ...
what's the five most frequent input event since 2105?
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 STRFTIME('%y', inputevents_cv.charttime) >= '2105' GROUP BY inputevents_cv.itemid) AS t1 WHERE t1.c1 <= 5)
mimic_iii
CREATE TABLE table_55628 ( "Year" real, "Network" text, "Play-by-play" text, "Colour commentator(s)" text, "Studio host" text )
Which network has a play-by-play announcer of John Wells?
SELECT "Network" FROM table_55628 WHERE "Play-by-play" = 'john wells'
wikisql
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...
what does fare code QO mean
SELECT DISTINCT fare_basis_code FROM fare_basis WHERE fare_basis_code = 'QO'
atis
CREATE TABLE table_12689 ( "Matches" real, "Wins" real, "Draw" real, "Losses" real, "Against" real )
What is the total number of Against, when Losses is less than 52, when Matches is greater than 4, and when Draw is less than 2?
SELECT COUNT("Against") FROM table_12689 WHERE "Losses" < '52' AND "Matches" > '4' AND "Draw" < '2'
wikisql