context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
what was the name of the procedure that's been performed to patient 010-39202 two times during this month?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, COUNT(treatment.treatmenttime) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid ...
eicu
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patient...
what is patient 035-11731's last heartrate on 11/08/last year?
SELECT vitalperiodic.heartrate FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-11731')) AND NOT vitalperiodic.heartrate IS NULL AND ...
eicu
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 maximum days of hospital stay of patients whose primary disease is hypoxia?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "HYPOXIA"
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...
患者昌正平开出的药品在哪几次医疗记录中均不低于1846.9元?列出医疗就诊编号都是什么?
SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '昌正平' AND NOT t_kc22.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT < 1846.9)
css
CREATE TABLE table_73526 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
When was the game in which Deron Williams (13) did the high assists played?
SELECT "Date" FROM table_73526 WHERE "High assists" = 'Deron Williams (13)'
wikisql
CREATE TABLE table_65785 ( "Draw" real, "Language" text, "Song" text, "English translation" text, "Place" real, "Points" real )
What's the total number of points when the English translation is Long Live Life and the draw is less than 2?
SELECT COUNT("Points") FROM table_65785 WHERE "English translation" = 'long live life' AND "Draw" < '2'
wikisql
CREATE TABLE table_name_84 ( fcc_info VARCHAR, frequency_mhz INTEGER )
Which FCC info has a Frequency MHz larger than 102.3?
SELECT fcc_info FROM table_name_84 WHERE frequency_mhz > 102.3
sql_create_context
CREATE TABLE table_74565 ( "Area" text, "Advertisement date" text, "Block" text, "Winning applicant" text, "Ensemble name" text )
Who is the Winning Applicant of Block 10B in Derbyshire Area?
SELECT "Winning applicant" FROM table_74565 WHERE "Block" = '10b' AND "Area" = 'derbyshire'
wikisql
CREATE TABLE table_203_229 ( id number, "pick #" number, "nfl team" text, "player" text, "position" text, "college" text )
what team had the first pick in round 17 of the 1969 nfl draft ?
SELECT "nfl team" FROM table_203_229 ORDER BY "pick #" LIMIT 1
squall
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 t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '章乐悦' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC
css
CREATE TABLE office_locations ( building_id number, company_id number, move_in_year number ) CREATE TABLE companies ( id number, name text, headquarters text, industry text, sales_billion number, profits_billion number, assets_billion number, market_value_billion text ) CRE...
Please show the industries of companies in descending order of the number of companies.
SELECT industry FROM companies GROUP BY industry ORDER BY COUNT(*) DESC
spider
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Cou...
Search for comments by a user with particular text.
SELECT Id AS "comment_link", Score, Text FROM Comments WHERE UPPER(Text) LIKE UPPER('%##CommentText##%') AND UserId = '##userId##' ORDER BY Score DESC
sede
CREATE TABLE table_61198 ( "7:00 am" text, "7:30 am" text, "8:00 am" text, "9:00 am" text, "11:00 am" text, "noon" text, "12:30 pm" text, "1:00 pm" text, "1:30 pm" text, "2:00 pm" text, "3:00 pm" text, "3:30 pm" text, "4:00 pm" text, "4:30 pm" text, "5:00 pm" ...
What shows at 1:00 pm when 4:00 pm shows local programs, and 8:00 am is The Early Show?
SELECT "1:00 pm" FROM table_61198 WHERE "4:00 pm" = 'local programs' AND "8:00 am" = 'the early show'
wikisql
CREATE TABLE table_44664 ( "Rider" text, "Manufacturer" text, "Laps" text, "Time/Retired" text, "Grid" text )
Who is the rider for Honda with a grid of 25?
SELECT "Rider" FROM table_44664 WHERE "Manufacturer" = 'honda' AND "Grid" = '25'
wikisql
CREATE TABLE table_name_49 ( nationality VARCHAR, pick VARCHAR )
What nationality has a pick of 1?
SELECT nationality FROM table_name_49 WHERE pick = "1"
sql_create_context
CREATE TABLE table_64324 ( "Name" text, "Career" text, "Matches" real, "Overs" real, "Maidens" real, "Runs" real, "Wickets" real, "Average" real, "Best" text )
What is the largest number of wickets when there are more than 630 maidens and a best of 7/72?
SELECT MAX("Wickets") FROM table_64324 WHERE "Maidens" > '630' AND "Best" = '7/72'
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 ) ...
give me the number of patients whose drug code is kcl40i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "KCL40I"
mimicsql_data
CREATE TABLE table_name_35 ( school_club_team VARCHAR, player VARCHAR )
What school does John Crotty play for?
SELECT school_club_team FROM table_name_35 WHERE player = "john crotty"
sql_create_context
CREATE TABLE table_42248 ( "Event" text, "Record" text, "Nation" text, "Date" text, "Venue" text )
Which Date has a Record of 8:39.49?
SELECT "Date" FROM table_42248 WHERE "Record" = '8:39.49'
wikisql
CREATE TABLE table_76123 ( "Television service" text, "Country" text, "Language" text, "Content" text, "HDTV" text, "Package/Option" text )
What is the Country with Reteconomy as the Television service?
SELECT "Country" FROM table_76123 WHERE "Television service" = 'reteconomy'
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...
Out of total number of patients treated with dexamethasone, how many of them died in or before 2112?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2112.0" AND prescriptions.drug = "Dexamethasone"
mimicsql_data
CREATE TABLE table_31977 ( "Candidate" text, "Party" text, "Constituency" text, "Year" text, "Days" text )
What are the number of days in 1945 where the constituent was heywood and radcliffe?
SELECT "Days" FROM table_31977 WHERE "Year" = '1945' AND "Constituency" = 'heywood and radcliffe'
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 are the top four most frequent diagnoses that patients were given within the same month after being diagnosed with intracranial injury - with loss of consciousness >24 hours since 1 year ago?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'intracranial injury - with loss of consc...
eicu
CREATE TABLE table_62095 ( "Name" text, "Street address" text, "Years as tallest" text, "Height ft (m)" text, "Floors" real )
What is the height in ft and m of the regions bank building?
SELECT "Height ft (m)" FROM table_62095 WHERE "Name" = 'regions bank building'
wikisql
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...
在零六年五月十一日一四年二月三日期间,ID为0036659的医疗机构的总金额数和统筹总金额数怎么样
SELECT SUM(t_kc24.MED_AMOUT), SUM(t_kc24.OVE_PAY) FROM qtb JOIN t_kc24 ON qtb.MED_CLINIC_ID = t_kc24.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '0036659' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2006-05-11' AND '2014-02-03' UNION SELECT SUM(t_kc24.MED_AMOUT), SUM(t_kc24.OVE_PAY) FROM gyb JOIN t_kc24 ON gyb.MED_CLINIC_ID = t_k...
css
CREATE TABLE table_72511 ( "Round" real, "Pick #" text, "Player" text, "Position" text, "Nationality" text, "College/junior/club team (league)" text )
What is the college/junior/club team (league) of the player who was pick number 130?
SELECT "College/junior/club team (league)" FROM table_72511 WHERE "Pick #" = '130'
wikisql
CREATE TABLE table_22349 ( "State (class)" text, "Vacator" text, "Reason for change" text, "Successor" text, "Date of successors formal installation" text )
What was the state (class) where the new successor was formally installed on May 11, 1966?
SELECT "State (class)" FROM table_22349 WHERE "Date of successors formal installation" = 'May 11, 1966'
wikisql
CREATE TABLE table_203_119 ( id number, "jamo" text, "hangul compatibility" text, "hangul jamo area" text, "hanyang private use" text, "halfwidth" text )
which symbol is listed at the top of the jamo column ?
SELECT "jamo" FROM table_203_119 ORDER BY id LIMIT 1
squall
CREATE TABLE table_name_95 ( enrollment VARCHAR, _number___county VARCHAR, ihsaa_class VARCHAR )
What's the total enrollment in 57 Noble having a # and AA as the IHSAA Class?
SELECT COUNT(enrollment) FROM table_name_95 WHERE _number___county = "57 noble" AND ihsaa_class = "aa"
sql_create_context
CREATE TABLE table_name_91 ( date VARCHAR, label VARCHAR )
The release from Simply Vinyl label was on what date?
SELECT date FROM table_name_91 WHERE label = "simply vinyl"
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( c...
what was the first time that patient 005-4044 had p.o. taken on the last icu visit?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-4044') AND NOT patient.unitdischargetime IS NULL ...
eicu
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
what is minimum age of patients whose death status is 0 and primary disease is t5 fracture?
SELECT MIN(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "T5 FRACTURE"
mimicsql_data
CREATE TABLE Ref_document_types ( Id VARCHAR )
Show the number of document types.
SELECT COUNT(*) FROM Ref_document_types
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
count the number of patients whose admission type is urgent and ethnicity is american indian/alaska natives.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
mimicsql_data
CREATE TABLE table_38963 ( "Week 2 Sept 7" text, "Week 3 Sept 14" text, "Week 4 Sept 21" text, "Week 5 Sept 28" text, "Week 6 Oct 5" text, "Week 7 Oct 12" text, "Week 10 Nov 2" text, "Week 12 Nov 16" text, "Week 14 Nov 30" text, "Week 15 Dec 7" text, "Week 16 (Final) Jan 9" t...
What was the week 14 opponent for the year with a week 10 opponent of Michigan State (8-2)?
SELECT "Week 14 Nov 30" FROM table_38963 WHERE "Week 10 Nov 2" = 'michigan state (8-2)'
wikisql
CREATE TABLE table_49066 ( "Party" text, "Previous council" real, "Staying councillors" real, "Seats up for election" real, "Election result" real, "New council" real )
How many staying councillors were there when the election result was larger than 0, the new council less than 27 and the party conservatives?
SELECT AVG("Staying councillors") FROM table_49066 WHERE "Election result" > '0' AND "Party" = 'conservatives' AND "New council" < '27'
wikisql
CREATE TABLE table_name_32 ( event_2 VARCHAR, air_date VARCHAR )
What was the 2nd event aired on 8 June 2008?
SELECT event_2 FROM table_name_32 WHERE air_date = "8 june 2008"
sql_create_context
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...
姓苗名伟懋的患者治病记录上记的医疗费总额有多少次不少于6998.54元的,入院的时候做的诊断其疾病序列码和名称是啥?
SELECT t_kc24.t_kc21_IN_DIAG_DIS_CD, t_kc24.t_kc21_IN_DIAG_DIS_NM FROM t_kc24 WHERE t_kc24.t_kc21_PERSON_NM = '苗伟懋' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 6998.54)
css
CREATE TABLE table_name_23 ( date VARCHAR, week VARCHAR )
What is the date of week 8?
SELECT date FROM table_name_23 WHERE week = 8
sql_create_context
CREATE TABLE table_204_608 ( id number, "name" text, "elected party" text, "constituency" text, "elected date" text, "military service" text )
how many of these members were elected in october ?
SELECT COUNT("name") FROM table_204_608 WHERE "elected date" = 10
squall
CREATE TABLE table_name_84 ( loses VARCHAR, points VARCHAR, points_against VARCHAR, points_for VARCHAR, wins VARCHAR )
What losses have points for less than 1175, wins greater than 2, points against greater than 894, and 24 as the points?
SELECT loses FROM table_name_84 WHERE points_for < 1175 AND wins > 2 AND points_against > 894 AND points = 24
sql_create_context
CREATE TABLE table_55673 ( "Driver" text, "Constructor" text, "Laps" text, "Time/Retired" text, "Grid" text )
what is the grid when the time/retired is +27.112?
SELECT "Grid" FROM table_55673 WHERE "Time/Retired" = '+27.112'
wikisql
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
编号为8159857的这个医疗机构有多少住院时长超过26天的记录?时间为2010年8月9日到2018年2月21日
SELECT COUNT(*) FROM zyjzjlb WHERE YLJGDM = '8159857' AND RYDJSJ BETWEEN '2010-08-09' AND '2018-02-21' AND DATEDIFF(CYSJ, RYSJ) > 26
css
CREATE TABLE table_19052 ( "#" real, "Episode title" text, "Writer(s)" text, "Director" text, "Prod. Code" text, "Original airdate" text )
who is the the writer(s) with original airdate being february 7, 2001
SELECT "Writer(s)" FROM table_19052 WHERE "Original airdate" = 'February 7, 2001'
wikisql
CREATE TABLE table_name_29 ( pick VARCHAR, school VARCHAR, round VARCHAR )
How many picks did Central State have before round 2?
SELECT COUNT(pick) FROM table_name_29 WHERE school = "central state" AND round < 2
sql_create_context
CREATE TABLE table_23827 ( "Series #" real, "Season #" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (in millions)" text )
How many directors were in Season 2?
SELECT COUNT("Directed by") FROM table_23827 WHERE "Season #" = '2'
wikisql
CREATE TABLE table_52037 ( "Country" text, "OF-5" text, "OF-4" text, "OF-2" text, "OF-1" text )
Which OF-5 is in Ghana?
SELECT "OF-5" FROM table_52037 WHERE "Country" = 'ghana'
wikisql
CREATE TABLE table_18332845_2 ( calling_at VARCHAR, departure VARCHAR )
What is the calling at for the 09.50 departure?
SELECT calling_at FROM table_18332845_2 WHERE departure = "09.50"
sql_create_context
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...
从二0一六年十二月八日到二0二0年十二月二十九日,患者79918177的所有检验结果指标记录中的检测方法共有多少种,给全部列出来
SELECT jyjgzbb.JCFF FROM hz_info JOIN txmzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = txmzjzjlb.YLJGDM AND hz_info.KH = txmzjzjlb.KH AND hz_info.KLX = txmzjzjlb.KLX AND txmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND txmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH...
css
CREATE TABLE table_24023 ( "Ep." real, "Season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Prod. Code" text )
Who directed the episode that originally aired on March 18, 1988?
SELECT "Directed by" FROM table_24023 WHERE "Original air date" = 'March 18, 1988'
wikisql
CREATE TABLE table_name_89 ( score VARCHAR, team VARCHAR )
Can you tell me the Score that has the Team of memphis?
SELECT score FROM table_name_89 WHERE team = "memphis"
sql_create_context
CREATE TABLE table_79784 ( "Season" text, "Date" text, "Driver" text, "Chassis" text, "Engine" text, "Series" text, "Report" text )
Which engine is responsible for the USAC Championship Car?
SELECT "Engine" FROM table_79784 WHERE "Series" = 'usac championship car'
wikisql
CREATE TABLE table_name_38 ( pick__number INTEGER, nfl_team VARCHAR, college VARCHAR )
What draft pick number attended syracuse and was drafted by the Carolina panthers?
SELECT SUM(pick__number) FROM table_name_38 WHERE nfl_team = "carolina panthers" AND college = "syracuse"
sql_create_context
CREATE TABLE table_203_95 ( id number, "year" text, "democratic\nparty" number, "republican\nparty" number, "independent\n/ other" text, "majority" number )
what is the only years without representatives from either the democratic or republican party .
SELECT "year" FROM table_203_95 WHERE "democratic\nparty" = 0 AND "republican\nparty" = 0
squall
CREATE TABLE table_71806 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents in the final" text, "Score" text )
What was the outcome of the match opponents in the final of Marius C lug ru Ciprian Petre Porumb?
SELECT "Outcome" FROM table_71806 WHERE "Opponents in the final" = 'marius călugăru ciprian petre porumb'
wikisql
CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE stadium ( id int, name text, Home_Games int, Average_Attendance real, Total_Attendance real, Capacity_Percentage real ) CREATE TABLE game ( ...
Give me line charts of worldwide gross the number of season over year season by major genres Away_team, I want to display X in descending order please.
SELECT Season, COUNT(Season) FROM game GROUP BY Away_team, Season ORDER BY Season DESC
nvbench
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 ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
what is the average age of male patients with medicaid insurance?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.insurance = "Medicaid"
mimicsql_data
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 maximum theophylline value for patient 007-1517 on their first hospital visit.
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 = '007-1517' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitala...
eicu
CREATE TABLE table_57138 ( "Year" text, "Security Forces" text, "Insurgents" text, "Civilians" text, "Total:" text )
Name the security forces with civilians being 67
SELECT "Security Forces" FROM table_57138 WHERE "Civilians" = '67'
wikisql
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), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of phone_number and salary , and list by the Y in desc please.
SELECT PHONE_NUMBER, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY DESC
nvbench
CREATE TABLE table_name_1 ( record VARCHAR, date VARCHAR )
Date of October 25, 1964 involves what record?
SELECT record FROM table_name_1 WHERE date = "october 25, 1964"
sql_create_context
CREATE TABLE table_name_14 ( date VARCHAR, venue VARCHAR, opponent VARCHAR )
When did they play the swindon wildcats away?
SELECT date FROM table_name_14 WHERE venue = "away" AND opponent = "swindon wildcats"
sql_create_context
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 of the private patients had a lab test for total cholesterol?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Cholesterol, Total"
mimicsql_data
CREATE TABLE table_80430 ( "Season" text, "Team Name" text, "Games" real, "Losses" real, "Points" real )
What's the total number of games with more than 20 points for the 1976 season?
SELECT COUNT("Games") FROM table_80430 WHERE "Season" = '1976' AND "Points" > '20'
wikisql
CREATE TABLE table_182298_5 ( total VARCHAR, mens_open VARCHAR )
How many are the total winners if 7 won the Men's Open?
SELECT total FROM table_182298_5 WHERE mens_open = 7
sql_create_context
CREATE TABLE accounts ( custid number, name text ) CREATE TABLE checking ( custid number, balance number ) CREATE TABLE savings ( custid number, balance number )
What are the names of customers who have a savings balance lower than their checking balance, and what is the total of their checking and savings balances?
SELECT T1.name, T3.balance + T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid = T2.custid JOIN savings AS T3 ON T1.custid = T3.custid WHERE T3.balance < T2.balance
spider
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 lab ( subject_id text, hadm_id text, ...
for patient id 30011, specify the icd9 code and procedural long title.
SELECT diagnoses.long_title, procedures.long_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "30011"
mimicsql_data
CREATE TABLE table_54711 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the smallest crowd size for away team st kilda?
SELECT MIN("Crowd") FROM table_54711 WHERE "Away team" = 'st kilda'
wikisql
CREATE TABLE table_11869952_1 ( institutional_authority VARCHAR, rocket_launch VARCHAR )
Which authority has a rocket launch called rehnuma-8?
SELECT institutional_authority FROM table_11869952_1 WHERE rocket_launch = "Rehnuma-8"
sql_create_context
CREATE TABLE table_35376 ( "Previous season" text, "Team" text, "Town" text, "Arena (capacity)" text, "Website" text, "Head Coach" text, "Foreign Players (max. 2)" text )
What is the Head Coach of Novy Urengoy?
SELECT "Head Coach" FROM table_35376 WHERE "Town" = 'novy urengoy'
wikisql
CREATE TABLE table_58291 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
Name the location of record 5-3
SELECT "Location" FROM table_58291 WHERE "Record" = '5-3'
wikisql
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what are the differences in the rbc in patient 031-15417 second measured on the first hospital visit compared to the first value measured on the first hospital visit?
SELECT (SELECT 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 = '031-15417' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospi...
eicu
CREATE TABLE Addresses ( address_id INTEGER, address_details VARCHAR(255) ) CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id INTEGER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_purchased DECIMAL(19,4) ) CREATE...
Return the average price for each product type by a bar chart, and could you list the average of product price from high to low order?
SELECT product_type_code, AVG(product_price) FROM Products GROUP BY product_type_code ORDER BY AVG(product_price) DESC
nvbench
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 was the daily minimum amount of nasogastric given to patient 11064 in the last hospital visit?
SELECT MIN(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 11064 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND outpu...
mimic_iii
CREATE TABLE table_name_40 ( surface VARCHAR, score VARCHAR )
What is the surface of the score, 7 6 (7 3) , 6 3?
SELECT surface FROM table_name_40 WHERE score = "7–6 (7–3) , 6–3"
sql_create_context
CREATE TABLE table_name_79 ( position VARCHAR, cross_code_debut VARCHAR )
What position has a Cross-code debut of 1st ru test v ireland?
SELECT position FROM table_name_79 WHERE cross_code_debut = "1st ru test v ireland"
sql_create_context
CREATE TABLE table_69374 ( "Place" real, "Team" text, "Played" real, "Draw" real, "Lost" real, "Goals Scored" real, "Goals Conceded" real, "Points" real )
What is the sum of the place that has less than 2 losses?
SELECT SUM("Place") FROM table_69374 WHERE "Lost" < '2'
wikisql
CREATE TABLE table_name_9 ( to_par INTEGER, player VARCHAR )
What is the lowest par for Bobby Cruickshank?
SELECT MIN(to_par) FROM table_name_9 WHERE player = "bobby cruickshank"
sql_create_context
CREATE TABLE table_10222 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Leading scorer" text, "Attendance" text, "Record" text, "Streak" text )
What is the record that has the Rose Garden 20,126 as the attendance?
SELECT "Record" FROM table_10222 WHERE "Attendance" = 'rose garden 20,126'
wikisql
CREATE TABLE table_43200 ( "s Member state" text, "GDP 2012 millions of euro" text, "Population in millions" real, "GDP (PPP) per capita 2012 euro" text, "GDP (Nominal) per capita 2012 euro" text, "GDP (PPP) per capita 2012 EU27 = 100" text )
What is GDP (PPP) Per Capita 2012 Euro, when Population In Millions is greater than 10.8, and when GDP (Nominal) Per Capita 2012 Euro is 25,600?
SELECT "GDP (PPP) per capita 2012 euro" FROM table_43200 WHERE "Population in millions" > '10.8' AND "GDP (Nominal) per capita 2012 euro" = '25,600'
wikisql
CREATE TABLE table_204_200 ( id number, "iso/iec standard" text, "title" text, "status" text, "description" text, "wg" number )
how many iso/iec were published in 2011 ?
SELECT COUNT("iso/iec standard") FROM table_204_200 WHERE "status" = 2011
squall
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, give me the comparison about the average of code over the founder , and group by attribute founder, and show from high to low by the total number please.
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T1.Code DESC
nvbench
CREATE TABLE table_11727969_1 ( species_in_the_peruvian_amazon INTEGER, taxonomy VARCHAR )
what's the minimum species in the peruvian amazon with taxonomy s fern ( pteridophyta )
SELECT MIN(species_in_the_peruvian_amazon) FROM table_11727969_1 WHERE taxonomy = "s Fern ( Pteridophyta )"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
What is the death status and number of days of hospital stay for subject id 52012?
SELECT demographic.days_stay, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "52012"
mimicsql_data
CREATE TABLE table_23764 ( "Year ended" real, "Revenue (\u20acmillion)" real, "Earnings before interest and taxes (\u20acm)" text, "Net profit (\u20acm)" text, "Earnings per share (\u20ac)" text )
Name the revenue for eps being 1.19
SELECT MAX("Revenue (\u20acmillion)") FROM table_23764 WHERE "Earnings per share (\u20ac)" = '1.19'
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 ) ...
how many patients admitted in emergency were tested for ferritin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Ferritin"
mimicsql_data
CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(15), customer_name VARCHAR(80), customer_phone VARCHAR(80), customer_email VARCHAR(80), customer_address VARCHAR(255), customer_login VARCHAR(80), customer_password VARCHAR(10) ) CREATE TABLE Customer_Orders ( orde...
Show the of customer addresses and group by premises type and address type code in a stacked bar chart The x-axis is premises type, sort x-axis in ascending order.
SELECT premises_type, COUNT(premises_type) FROM Customer_Addresses AS T1 JOIN Premises AS T2 ON T1.premise_id = T2.premise_id GROUP BY address_type_code, premises_type ORDER BY premises_type
nvbench
CREATE TABLE table_45605 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" text, "Location" text )
How many rounds did the match last when his record was 6-6?
SELECT "Round" FROM table_45605 WHERE "Record" = '6-6'
wikisql
CREATE TABLE table_56045 ( "Rank" text, "Country (or dependent territory)" text, "July 1, 2013 projection" real, "% of pop." real, "Average relative annual growth (%)" real, "Average absolute annual growth" real )
What is the average % of population Tunisia, which has an average relative annual growth smaller than 1.03?
SELECT AVG("% of pop.") FROM table_56045 WHERE "Country (or dependent territory)" = 'tunisia' AND "Average relative annual growth (%)" < '1.03'
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...
get the number of patients who take drug via ed route and have diagnoses icd9 code 56212.
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.icd9_code = "56212" AND prescriptions.route = "ED"
mimicsql_data
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, ...
how many patients whose admission year is less than 2138 and diagnoses long title is adrenal cortical steroids causing adverse effects in therapeutic use?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2138" AND diagnoses.long_title = "Adrenal cortical steroids causing adverse effects in therapeutic use"
mimicsql_data
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...
what is the maximum age of patients whose admission type is emergency and the hospital stay is 2 days?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.days_stay = "2"
mimicsql_data
CREATE TABLE table_80268 ( "Episode title" text, "Villain(s)" text, "Identity(ies)" text, "Original airdate" text, "DVD volume" real )
Name the episode that aired october 8, 1988
SELECT "Episode title" FROM table_80268 WHERE "Original airdate" = 'october 8, 1988'
wikisql
CREATE TABLE table_name_62 ( notes VARCHAR, rank VARCHAR )
What notes have 2 as the rank?
SELECT notes FROM table_name_62 WHERE rank = 2
sql_create_context
CREATE TABLE greatermanchestercrime ( crimeid text, crimets time, location text, lsoa text, type text, outcome text )
What is the top 3 area of crime conducted?
SELECT location FROM greatermanchestercrime GROUP BY location ORDER BY COUNT(*) DESC LIMIT 3
greatermanchestercrime
CREATE TABLE table_19908313_2 ( team VARCHAR, listed_owner_s_ VARCHAR )
How many teams does Jeff Wyler own?
SELECT COUNT(team) FROM table_19908313_2 WHERE listed_owner_s_ = "Jeff Wyler"
sql_create_context
CREATE TABLE table_8620 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
What is the highest Pick that has a round greater than 6 and an overall greater than 216?
SELECT MAX("Pick") FROM table_8620 WHERE "Round" > '6' AND "Overall" > '216'
wikisql
CREATE TABLE table_204_572 ( id number, "rank" number, "county" text, "per capita\nincome" text, "median\nhousehold\nincome" text, "median\nfamily\nincome" text, "population" number, "number of\nhouseholds" number )
who has more households between fallon and phillips ?
SELECT "county" FROM table_204_572 WHERE "county" IN ('fallon', 'phillips') ORDER BY "number of\nhouseholds" DESC LIMIT 1
squall
CREATE TABLE table_10960 ( "Year" real, "Result" text, "Award" text, "Category" text, "Film or series" text, "Character" text )
In what category was character Jacqui Mcqueen nominated before 2011?
SELECT "Category" FROM table_10960 WHERE "Character" = 'jacqui mcqueen' AND "Year" < '2011'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
how many patients whose drug code is lido5t and lab test fluid is joint fluid?
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 = "LIDO5T" AND lab.fluid = "Joint Fluid"
mimicsql_data