context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_98 ( team VARCHAR, coach VARCHAR, location VARCHAR )
Which team has an unknown coach and location of Athelstone?
SELECT team FROM table_name_98 WHERE coach = "unknown" AND location = "athelstone"
sql_create_context
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, ...
把患者许浩歌在编号为8126391的医院中入院诊断疾病名称不包含肺的医疗就诊记录编号列出来
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_NM = '许浩歌' AND gwyjzb.MED_SER_ORG_NO = '8126391' AND NOT gwyjzb.IN_DIAG_DIS_NM LIKE '%肺%' UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '许浩歌' AND fgwyjzb.MED_SER_ORG_NO = '8126391' AND NOT fgwyjzb.IN_DIAG_DIS_NM LIKE '%肺%'
css
CREATE TABLE table_3013 ( "Institution" text, "Nickname" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Sport" text )
Name the enrollment with cougars
SELECT "Enrollment" FROM table_3013 WHERE "Nickname" = 'Cougars'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_...
since 2104 what was the four most common specimen test?
SELECT t1.spec_type_desc FROM (SELECT microbiologyevents.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM microbiologyevents WHERE STRFTIME('%y', microbiologyevents.charttime) >= '2104' GROUP BY microbiologyevents.spec_type_desc) AS t1 WHERE t1.c1 <= 4
mimic_iii
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM t...
病人袁康安有过哪些住院诊断证明
SELECT zyjzjlb.ZYZDBM, zyjzjlb.ZYZDMC 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 = '袁康安'
css
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
count the number of times patient 006-80884 has had a output (ml)-chest tube #1 right lateral output since 08/2102.
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 = '006-80884')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.ce...
eicu
CREATE TABLE table_58272 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
I want to see the away team the has a home team of richmond
SELECT "Away team" FROM table_58272 WHERE "Home team" = 'richmond'
wikisql
CREATE TABLE table_name_80 ( record VARCHAR, date VARCHAR )
What's the record of the game on Nov 13?
SELECT record FROM table_name_80 WHERE date = "nov 13"
sql_create_context
CREATE TABLE table_203_589 ( id number, "protein" text, "natural host" text, "normal function" text, "prion state" text, "prion phenotype" text, "year identified" number )
how many prions were identified in 2012 ?
SELECT COUNT("protein") FROM table_203_589 WHERE "year identified" = 2012
squall
CREATE TABLE table_203_671 ( id number, "name" text, "rank" text, "age" number, "years until mandatory retirement" text, "appointed by" text, "year appointed" number )
who was the only associate justice appointed in 2010 ?
SELECT "name" FROM table_203_671 WHERE "rank" = 'associate justice' AND "year appointed" = 2010
squall
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 procedures ( ...
what is the number of patients whose marital status is single and diagnoses long title is other chronic pulmonary heart diseases?
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 = "Other chronic pulmonary heart diseases"
mimicsql_data
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, u...
what is the difference between the weights last measured on the first hospital visit compared to the first value measured on the first hospital visit of patient 006-35134?
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-35134' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL OR...
eicu
CREATE TABLE table_200_1 ( id number, "year" number, "title" text, "role" text, "notes" text )
what was the name of the girl on sixth sense played by mischa barton ?
SELECT "role" FROM table_200_1 WHERE "title" = 'the sixth sense'
squall
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
how many times was metoprolol tartrate (lopressor) inj 5 mg prescribed during their first hospital encounter for patient 030-44598.
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-44598' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hosp...
eicu
CREATE TABLE table_12571 ( "Central Murray" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real )
What is the highest number of losses of the central murray of lake boga, which has less than 10 wins?
SELECT MAX("Losses") FROM table_12571 WHERE "Central Murray" = 'lake boga' AND "Wins" < '10'
wikisql
CREATE TABLE table_3331 ( "Settlement" text, "Cyrillic Name Other Names" text, "Type" text, "Population (2011)" real, "Largest ethnic group (2002)" text, "Dominant religion (2002)" text )
Name the dominant religion for village for
SELECT "Dominant religion (2002)" FROM table_3331 WHERE "Type" = 'village' AND "Cyrillic Name Other Names" = 'Бачко Добро Поље'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE prescriptions ( row_id number, subject_id number,...
make a count of the number of times patient 58730 has received a vasc shunt & bypass nec when they came to the hospital first time.
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'vasc shunt & bypass nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 58730 AND NOT admissions.di...
mimic_iii
CREATE TABLE table_74013 ( "District" text, "Incumbent" text, "Party" text, "First elected" text, "Result" text, "Candidates" text )
Name the first elected for kentucky 3
SELECT "First elected" FROM table_74013 WHERE "District" = 'Kentucky 3'
wikisql
CREATE TABLE table_name_3 ( school_club_team VARCHAR, player VARCHAR )
Who did mark eaton play for?
SELECT school_club_team FROM table_name_3 WHERE player = "mark eaton"
sql_create_context
CREATE TABLE table_59475 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
Which home team has 44 ties?
SELECT "Home team" FROM table_59475 WHERE "Tie no" = '44'
wikisql
CREATE TABLE table_203_547 ( id number, "ship" text, "built" number, "in service for cunard" text, "type" text, "tonnage" text, "notes" text )
what is the date that the last ship was built ?
SELECT MAX("built") FROM table_203_547
squall
CREATE TABLE table_name_75 ( stuffit VARCHAR, lha_lzh VARCHAR, gzip VARCHAR, iso_cd_image VARCHAR )
What is the Stuffit ability that has a gzip of yes, ISO/CD images of no and LHA/LZH of no?
SELECT stuffit FROM table_name_75 WHERE gzip = "yes" AND iso_cd_image = "no" AND lha_lzh = "no"
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...
病患云芷文在2004年8月29日到2011年7月14日这七年里,买了几次西药?
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_NM = '云芷文' AND t_kc22.STA_DATE BETWEEN '2004-08-29' AND '2011-07-14' AND t_kc22.MED_INV_ITEM_TYPE = '西药费'
css
CREATE TABLE lives_in ( stuid number, dormid number, room_number number ) CREATE TABLE has_amenity ( dormid number, amenid number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CRE...
Find the number of dorms that have some amenity.
SELECT COUNT(DISTINCT dormid) FROM has_amenity
spider
CREATE TABLE table_58200 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the Home Team Score at VFL Park?
SELECT "Home team score" FROM table_58200 WHERE "Venue" = 'vfl park'
wikisql
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
列出在医院4464986中就诊科室名称不包含伤科的属于患者方安安的有哪些医疗就诊记录?
SELECT * FROM gwyjzb WHERE gwyjzb.PERSON_NM = '方安安' AND gwyjzb.MED_SER_ORG_NO = '4464986' AND NOT gwyjzb.MED_ORG_DEPT_NM LIKE '%伤科%' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '方安安' AND fgwyjzb.MED_SER_ORG_NO = '4464986' AND NOT fgwyjzb.MED_ORG_DEPT_NM LIKE '%伤科%'
css
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, find name and code , and group by attribute founder, and visualize them by a bar chart, and display by the x axis in desc.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name ORDER BY T1.Name DESC
nvbench
CREATE TABLE table_789 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
What is the last year on this list someone was first elected?
SELECT MAX("First elected") FROM table_789
wikisql
CREATE TABLE table_name_60 ( stadium VARCHAR, visiting_team VARCHAR )
What stadium did the Denver Broncos visit?
SELECT stadium FROM table_name_60 WHERE visiting_team = "denver broncos"
sql_create_context
CREATE TABLE table_25284864_3 ( june_10_11 VARCHAR, march_27_29 VARCHAR )
What June 10-11 is is that corresponds to March 28, 1968?
SELECT june_10_11 FROM table_25284864_3 WHERE march_27_29 = "March 28, 1968"
sql_create_context
CREATE TABLE table_51162 ( "Actor" text, "Character" text, "Title/Rank" text, "Series" text, "Years" text )
What is the title rank of actor pauline moran?
SELECT "Title/Rank" FROM table_51162 WHERE "Actor" = 'pauline moran'
wikisql
CREATE TABLE txmzjzjlb ( 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, MZZYZDZ...
在二零一五年一月六日到二零一八年二月十日的这三年里,查一下在医疗机构3630935特需门诊的就诊记录数量
SELECT COUNT(*) FROM ftxmzjzjlb WHERE ftxmzjzjlb.ZSEBZ = '3630935' AND ftxmzjzjlb.JZKSRQ BETWEEN '2015-01-06' AND '2018-02-10'
css
CREATE TABLE table_name_48 ( score VARCHAR, to_par VARCHAR, player VARCHAR )
With a To par of 1, what is Player Henrik Stenson's Score?
SELECT score FROM table_name_48 WHERE to_par = "–1" AND player = "henrik stenson"
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
How many white ethnic background patients had a protein/creatinine ratio lab test?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "WHITE" AND lab.label = "Protein/Creatinine Ratio"
mimicsql_data
CREATE TABLE table_7167 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What is High Points, when Location Attendance is Staples Center 18,964?
SELECT "High points" FROM table_7167 WHERE "Location Attendance" = 'staples center 18,964'
wikisql
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, draw a scatter chart about the correlation between price and code , and group by attribute name.
SELECT T1.Price, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Name
nvbench
CREATE TABLE table_204_183 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
how many total gold medals were awarded ?
SELECT SUM("gold") FROM table_204_183
squall
CREATE TABLE table_22142 ( "Year [e ] (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Director" text, "Main Language(s)" text, "Result" text )
when was otar iosseliani's film selected
SELECT "Year [e ] (Ceremony)" FROM table_22142 WHERE "Director" = 'Otar Iosseliani'
wikisql
CREATE TABLE table_name_21 ( total VARCHAR, set_2 VARCHAR )
What is the total when the score for set 2 is 20 25?
SELECT total FROM table_name_21 WHERE set_2 = "20–25"
sql_create_context
CREATE TABLE table_35202 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real )
Which class has fewer than 89 points and the Honda team later than 1987?
SELECT "Class" FROM table_35202 WHERE "Points" < '89' AND "Team" = 'honda' AND "Year" > '1987'
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, ...
when did patient 031-15417 first get a microbiology test until 25 months ago?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-15417')) AND DATETIME(microlab.culturetakentime) <= DATETIME(...
eicu
CREATE TABLE table_26738 ( "Series No." real, "Episode No." real, "Title" text, "Directed by" text, "Written by" text, "UK Ratings (BBC2 Rank)" text, "Original air date" text )
What is the title of episode 2?
SELECT "Title" FROM table_26738 WHERE "Episode No." = '2'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
provide the number of asian patients who are taking glyburide medication.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "ASIAN" AND prescriptions.drug = "GlyBURIDE"
mimicsql_data
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time...
Top 200 users from Uganda.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%uganda%' OR UPPER(Location) LIKE '%UGA' ORDER BY Reputation DESC LIMIT 200
sede
CREATE TABLE apartments ( apt_id number, building_id number, apt_type_code text, apt_number text, bathroom_count number, bedroom_count number, room_count text ) CREATE TABLE apartment_buildings ( building_id number, building_short_name text, building_full_name text, building...
What are the top three apartment types in terms of the average room count? Give me the
SELECT apt_type_code FROM apartments GROUP BY apt_type_code ORDER BY AVG(room_count) DESC LIMIT 3
spider
CREATE TABLE table_name_35 ( year_s__of_manufacture VARCHAR, railway_number_s_ VARCHAR )
What are the year(s) of manufacture for railway number(s) 26 (ii) 63 (ii) , 188 193?
SELECT year_s__of_manufacture FROM table_name_35 WHERE railway_number_s_ = "26 (ii) …63 (ii) , 188–193"
sql_create_context
CREATE TABLE MediaType ( MediaTypeId integer, Name varchar(120) ) CREATE TABLE PlaylistTrack ( PlaylistId integer, TrackId integer ) CREATE TABLE Genre ( GenreId integer, Name varchar(120) ) CREATE TABLE Artist ( ArtistId integer, Name varchar(120) ) CREATE TABLE Track ( TrackId ...
Show me a bar chart for what are the titles and ids for albums containing tracks with unit price greater than 1?, and rank in desc by the x axis.
SELECT T1.Title, T1.AlbumId FROM Album AS T1 JOIN Track AS T2 ON T1.AlbumId = T2.AlbumId WHERE T2.UnitPrice > 1 ORDER BY T1.Title DESC
nvbench
CREATE TABLE table_name_48 ( city_location VARCHAR, race_name VARCHAR )
Where is the budweiser/g. i. joe's 200?
SELECT city_location FROM table_name_48 WHERE race_name = "budweiser/g. i. joe's 200"
sql_create_context
CREATE TABLE table_21481509_4 ( r1b1c__r_v88_ VARCHAR, total_percentage VARCHAR )
What percentage is listed in column r1b1c (r-v88) for the 4.5% total percentage?
SELECT r1b1c__r_v88_ FROM table_21481509_4 WHERE total_percentage = "4.5%"
sql_create_context
CREATE TABLE table_name_17 ( circuit VARCHAR, winning_driver VARCHAR )
Which circuit did Raymond Mays win?
SELECT circuit FROM table_name_17 WHERE winning_driver = "raymond mays"
sql_create_context
CREATE TABLE table_35447 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What was the score for the game on February 12?
SELECT "Score" FROM table_35447 WHERE "Date" = 'february 12'
wikisql
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Users with most asked questions today.
SELECT COUNT(*) AS counter, OwnerUserId FROM Posts GROUP BY OwnerUserId ORDER BY counter DESC
sede
CREATE TABLE table_21667 ( "Week" real, "Date" text, "Opponent" text, "Stadium" text, "Result" text, "Record" text, "Streak" text, "Attendance" real )
What was the result of the game that was played on Nov. 26, 1972?
SELECT "Result" FROM table_21667 WHERE "Date" = 'Nov. 26'
wikisql
CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paper ( paperid int, title...
Show me the papers on data cleaning
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'data cleaning' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid
scholar
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 number of patients whose admission location is trsf within this facility and procedure icd9 code is 8321?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND procedures.icd9_code = "8321"
mimicsql_data
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type t...
tell me the total amount of output that patient 13536 has had on 05/04/this year?
SELECT SUM(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 = 13536)) AND DATETIME(outputevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start o...
mimic_iii
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate ti...
is the value of calcium, total in patient 54825 last measured on the first hospital visit less than that the first value measured on the first hospital visit?
SELECT (SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 54825 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label ...
mimic_iii
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 ( ...
provide the number of patients whose admission year is less than 2114 and item id is 50949?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2114" AND lab.itemid = "50949"
mimicsql_data
CREATE TABLE table_61120 ( "Title" text, "Author" text, "Doctor" text, "Companion(s)" text, "Published" text )
What doctor published on June 2003?
SELECT "Doctor" FROM table_61120 WHERE "Published" = 'june 2003'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE labevents ( r...
how is patient 20898 first admitted to the hospital in 2105?
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 20898 AND STRFTIME('%y', admissions.admittime) = '2105' ORDER BY admissions.admittime LIMIT 1
mimic_iii
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id ...
how many hours have passed since patient 90663's first stay in ward 12 during their current hospital encounter?
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663 AND admissions.dischtime IS NULL)) AND transfers...
mimic_iii
CREATE TABLE table_name_51 ( rounds VARCHAR, team VARCHAR )
In what rounds was the featured team of Avanzza Rosso?
SELECT rounds FROM table_name_51 WHERE team = "avanzza rosso"
sql_create_context
CREATE TABLE flight ( flno number, origin text, destination text, distance number, departure_date time, arrival_date time, price number, aid number ) CREATE TABLE certificate ( eid number, aid number ) CREATE TABLE aircraft ( aid number, name text, distance number )...
What is the average distance and price for all flights from LA?
SELECT AVG(distance), AVG(price) FROM flight WHERE origin = "Los Angeles"
spider
CREATE TABLE table_46846 ( "Year" real, "Album" text, "Vocals" text, "Bass" text, "Drums" text, "Label" text )
Which album had Jay Bentley on bass and Bobby Schayer on drums?
SELECT "Album" FROM table_46846 WHERE "Bass" = 'jay bentley' AND "Drums" = 'bobby schayer'
wikisql
CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE departments ( department_id number, department_name text, manager_id number, location_id number ) CREATE TABLE employees ( employee_id number, first_name text, last_name tex...
What is all the information about the Marketing department?
SELECT * FROM departments WHERE department_name = 'Marketing'
spider
CREATE TABLE table_name_60 ( country VARCHAR, year_s__won VARCHAR )
Which Country has a Year(s) won of 1977?
SELECT country FROM table_name_60 WHERE year_s__won = "1977"
sql_create_context
CREATE TABLE table_name_39 ( town_city VARCHAR, name VARCHAR )
What city is Garfield County Museum located in?
SELECT town_city FROM table_name_39 WHERE name = "garfield county museum"
sql_create_context
CREATE TABLE Addresses ( City_Town VARCHAR, Address_ID VARCHAR ) CREATE TABLE Stores ( Address_ID VARCHAR, Store_Name VARCHAR )
Which city is the address of the store named 'FJA Filming' located in?
SELECT T1.City_Town FROM Addresses AS T1 JOIN Stores AS T2 ON T1.Address_ID = T2.Address_ID WHERE T2.Store_Name = "FJA Filming"
sql_create_context
CREATE TABLE table_204_625 ( id number, "model" text, "availability" text, "introduced" text, "length of use" text, "last of whiteness" text )
how many products have been discontinued ?
SELECT COUNT("model") FROM table_204_625 WHERE "availability" = 'discontinued'
squall
CREATE TABLE table_40971 ( "Player" text, "Nationality" text, "Position" text, "Years in Orlando" text, "School/Club Team" text )
Which School/Club Team does Vince Carter Play for?
SELECT "School/Club Team" FROM table_40971 WHERE "Player" = 'vince carter'
wikisql
CREATE TABLE table_61931 ( "Athlete" text, "Country" text, "Run 1" real, "Run 2" real, "Run 3" real )
Who is the athlete with a run 1 less than 54.13 and a 55.21 run 3?
SELECT "Athlete" FROM table_61931 WHERE "Run 1" < '54.13' AND "Run 3" = '55.21'
wikisql
CREATE TABLE student ( stu_num number, stu_lname text, stu_fname text, stu_init text, stu_dob time, stu_hrs number, stu_class text, stu_gpa number, stu_transfer number, dept_code text, stu_phone text, prof_num number ) CREATE TABLE employee ( emp_num number, emp_...
What is the total number of professors with a Ph.D. ?
SELECT COUNT(*) FROM professor WHERE prof_high_degree = 'Ph.D.'
spider
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
For all employees who have the letters D or S in their first name, return a line chart about the change of employee_id over hire_date , and order by the X in ascending.
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
nvbench
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...
provide the number of patients whose lab test name is cd4/cd8 ratio?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "CD4/CD8 Ratio"
mimicsql_data
CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
看一下患者21178041去医院9509335住院时的就诊记录,其中入院信息里面入院科室的名字要有针灸科的
SELECT * FROM hz_info JOIN zyjzjlb ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE hz_info.RYBH = '21178041' AND hz_info.YLJGDM = '9509335' AND zyjzjlb.JZKSMC LIKE '%针灸科%'
css
CREATE TABLE table_name_31 ( Id VARCHAR )
What is 2004, when 2005 is 'Not Tier I'?
SELECT 2004 FROM table_name_31 WHERE 2005 = "not tier i"
sql_create_context
CREATE TABLE txmzjzjlb ( 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, MZZYZDZ...
罗列出病患编号16591301在2004年5月15日到2008年3月25日内所有检验报告单的审核日期时间是什么?
SELECT jybgb.SHSJ FROM hz_info JOIN txmzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '16591301' AND jybgb.BGRQ BETWEEN '2004-05-15' AND '2008-...
css
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varc...
For those employees who did not have any job in the past, find hire_date and the average of employee_id bin hire_date by time, and visualize them by a bar chart.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_32695 ( "Year" text, "Date" text, "Stages" text, "Distance" text, "Winner" text )
Who won in 1965?
SELECT "Winner" FROM table_32695 WHERE "Year" = '1965'
wikisql
CREATE TABLE table_55190 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How big was the crowd for Essendon?
SELECT SUM("Crowd") FROM table_55190 WHERE "Home team" = 'essendon'
wikisql
CREATE TABLE table_56315 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
What is Pedro De La Rosa's total number of Grid?
SELECT COUNT("Grid") FROM table_56315 WHERE "Driver" = 'pedro de la rosa'
wikisql
CREATE TABLE table_203_76 ( id number, "pos" text, "no" number, "driver" text, "constructor" text, "laps" number, "time/retired" text, "grid" number, "points" number )
which driver has his grid at 2 ?
SELECT "driver" FROM table_203_76 WHERE "grid" = 2
squall
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
count the number of patients whose discharge location is disc-tran cancer/chldrn h and procedure short title is temporary colostomy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "DISC-TRAN CANCER/CHLDRN H" AND procedures.short_title = "Temporary colostomy"
mimicsql_data
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
Return a bar chart about the distribution of meter_400 and meter_100 .
SELECT meter_400, meter_100 FROM swimmer
nvbench
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE voting_record ( stuid number, registration_date text, election_cycle text, president_vote number, vice_president_vote number...
Find the number of students in total.
SELECT COUNT(*) FROM student
spider
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...
门诊诊断患者许智鑫为疾病P13.012的二氧化碳的单位和结果定量分别是什么呢?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZ...
css
CREATE TABLE zyjzjlb ( YLJGDM text, JZLSH text, MZJZLSH text, KH text, KLX number, HZXM text, WDBZ number, RYDJSJ time, RYTJDM number, RYTJMC text, JZKSDM text, JZKSMC text, RZBQDM text, RZBQMC text, RYCWH text, CYKSDM text, CYKSMC text, CYBQDM tex...
74199194476这次门诊的就诊科室是哪个?编码是什么
SELECT JZKSBM, JZKSMC FROM mzjzjlb WHERE JZLSH = '74199194476'
css
CREATE TABLE table_204_832 ( id number, "name" text, "nationality" text, "club" text, "from" number, "until" text )
what same country did marc dos santos coach as colin miller ?
SELECT "nationality" FROM table_204_832 WHERE "name" = 'marc dos santos'
squall
CREATE TABLE table_name_13 ( percentage__2011_ VARCHAR, population__2006_ VARCHAR, percentage__2006_ VARCHAR )
What percentage of the 2011 population had a mother tongue language that was spoken by 45.22% of the population in 2006 (over 120)?
SELECT percentage__2011_ FROM table_name_13 WHERE population__2006_ > 120 AND percentage__2006_ = "45.22%"
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
how many american indian/alaska native patients were born before the year 2130?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.dob_year < "2130"
mimicsql_data
CREATE TABLE table_dev_9 ( "id" int, "heart_disease" bool, "hba1c" float, "coronary_artery_disease_cad" bool, "triglyceride_tg" float, "hypertension" bool, "NOUSE" float )
hba1c greater than 12 %
SELECT * FROM table_dev_9 WHERE hba1c > 12
criteria2sql
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
For those employees who did not have any job in the past, a bar chart shows the distribution of hire_date and the average of employee_id bin hire_date by time, rank in desc by the total number.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID) DESC
nvbench
CREATE TABLE table_name_10 ( event_4 VARCHAR, event_3 VARCHAR, event_1 VARCHAR, event_2 VARCHAR )
What is event 4 when event one was gauntlet, event 2 was duel, and event 3 was pendulum?
SELECT event_4 FROM table_name_10 WHERE event_1 = "gauntlet" AND event_2 = "duel" AND event_3 = "pendulum"
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, chartti...
what is the name of the intake that patient 1784 first had today?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT inputevents_cv.itemid FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1784)) AND DATETIME(inputevents_cv.c...
mimic_iii
CREATE TABLE table_name_79 ( playoffs INTEGER, teams VARCHAR )
What is the highest playoffs that has tampa bay as the team?
SELECT MAX(playoffs) FROM table_name_79 WHERE teams = "tampa bay"
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...
对于不少于7265.59元的患者苗秀曼的医疗费总额医疗记录,列出入院诊断疾病编码以及名称分别是什么?
SELECT qtb.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_NM = '苗秀曼' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 7265.59) UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_NM = '苗秀曼' AND gyb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLI...
css
CREATE TABLE table_32933 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What is the average crowd size for games with north melbourne as the away side?
SELECT AVG("Crowd") FROM table_32933 WHERE "Away team" = 'north melbourne'
wikisql
CREATE TABLE table_name_60 ( year VARCHAR, name VARCHAR )
What year was Asi Peko?
SELECT year FROM table_name_60 WHERE name = "asi peko"
sql_create_context
CREATE TABLE table_203_673 ( id number, "#" number, "date" text, "opponent" text, "score" text, "win" text, "loss" text, "save" text, "attendance" number, "record" text )
which attendance was higher , july 1 or july 2 ?
SELECT "date" FROM table_203_673 WHERE "date" IN ('july 1', 'july 2') ORDER BY "attendance" DESC LIMIT 1
squall
CREATE TABLE qtb ( 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...
编号17340163122的医疗就诊需要住院多久
SELECT qtb.IN_HOSP_DAYS FROM qtb WHERE qtb.MED_CLINIC_ID = '17340163122' UNION SELECT gyb.IN_HOSP_DAYS FROM gyb WHERE gyb.MED_CLINIC_ID = '17340163122' UNION SELECT zyb.IN_HOSP_DAYS FROM zyb WHERE zyb.MED_CLINIC_ID = '17340163122' UNION SELECT mzb.IN_HOSP_DAYS FROM mzb WHERE mzb.MED_CLINIC_ID = '17340163122'
css