context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE station ( id INTEG...
Give me a bar chart to show how many dates with a max temperature greater than or equal to 80 for each day.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80
nvbench
CREATE TABLE table_12936521_2 ( current_conference VARCHAR, institution VARCHAR )
What current conference is Post University a member of?
SELECT current_conference FROM table_12936521_2 WHERE institution = "Post University"
sql_create_context
CREATE TABLE Addresses ( address_id INTEGER, line_1 VARCHAR(120), line_2 VARCHAR(120), line_3 VARCHAR(120), city VARCHAR(80), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50), other_address_details VARCHAR(255) ) CREATE TABLE Assessment_Notes ( no...
Show the number of date of notes from each date of notes, could you rank in ascending by the total number?
SELECT date_of_notes, COUNT(date_of_notes) FROM Assessment_Notes ORDER BY COUNT(date_of_notes)
nvbench
CREATE TABLE table_name_83 ( points INTEGER, chassis VARCHAR, year VARCHAR )
What is the number of points for the vehicle with a mp4-17d chassis earlier than 2003?
SELECT SUM(points) FROM table_name_83 WHERE chassis = "mp4-17d" AND year < 2003
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...
名为曹欣德的这位患者被门诊诊断为疾病Y51.041,查一下编号为909845检测指标的结果定量及其单位
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN zzmzjzjlb JOIN jybgb JOIN jyjgzbb 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.JZ...
css
CREATE TABLE table_name_47 ( date VARCHAR, competition VARCHAR, result VARCHAR )
When is the Competition of friendly match with a Result of 2 1?
SELECT date FROM table_name_47 WHERE competition = "friendly match" AND result = "2–1"
sql_create_context
CREATE TABLE table_name_96 ( points INTEGER, entrant VARCHAR, year VARCHAR )
What was Yardley-BRM's points high after 1971?
SELECT MAX(points) FROM table_name_96 WHERE entrant = "yardley-brm" AND year > 1971
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...
give me the number of patients whose primary disease is bradycardia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "BRADYCARDIA"
mimicsql_data
CREATE TABLE table_38127 ( "Pick #" real, "Round" text, "Player" text, "Position" text, "College" text )
What position(s) did the player(s) with a pick number of 125 play?
SELECT "Position" FROM table_38127 WHERE "Pick #" = '125'
wikisql
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ...
Percent of questions with a given tag per day.
WITH QuesTagInfo(quesId, quesCreationDate, quesHasTag) AS (SELECT Id AS quesId, DATE(CreationDate) AS quesCreationDate, CASE WHEN (Tags LIKE ('%<##TagName##>%')) THEN 1 ELSE 0 END AS quesHasTag FROM Posts WHERE PostTypeId = 1) SELECT quesCreationDate, COUNT(*) AS "total_questions", SUM(quesHasTag) AS "has_tag" FROM Que...
sede
CREATE TABLE table_1449176_1 ( population VARCHAR, common_of VARCHAR )
How may population figures are given for Settimo Torinese
SELECT COUNT(population) FROM table_1449176_1 WHERE common_of = "Settimo Torinese"
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 patients admitted to emergency died in or before the year 2180?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dod_year <= "2180.0"
mimicsql_data
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 ...
列出患者20499920在10年5月11日到20年4月9日内被开出的所有检验报告单的检验报告单号是多少?
SELECT jybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '20499920' AND jybgb.BGRQ BETWEEN '2010-05-11' AND '2020-04-09' UNION...
css
CREATE TABLE table_20277 ( "Name" text, "Overs Bowled" text, "Maidens" real, "Runs Conceded" real, "Wickets" real, "Extras" real, "E.R." text )
Name the least runs conceded for brett lee
SELECT MIN("Runs Conceded") FROM table_20277 WHERE "Name" = 'Brett Lee'
wikisql
CREATE TABLE table_name_88 ( bronze INTEGER, total VARCHAR, silver VARCHAR )
How many bronze medals did the country with 7 medals and over 5 silver medals receive?
SELECT SUM(bronze) FROM table_name_88 WHERE total = 7 AND silver > 5
sql_create_context
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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime ...
what is the average daily number of patients had helicobacter pylori since 4 years ago?
SELECT AVG(t1.c1) FROM (SELECT COUNT(DISTINCT diagnoses_icd.hadm_id) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'helicobacter pylori') AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-4 year') GRO...
mimic_iii
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
How many Posts are there on the website?.
SELECT se.OwnerUserId, COUNT(*) FROM SuggestedEdits AS se INNER JOIN Posts AS p ON p.Id = se.PostId WHERE se.OwnerUserId != p.OwnerUserId GROUP BY se.OwnerUserId ORDER BY COUNT(*) DESC
sede
CREATE TABLE table_75192 ( "Surname" text, "First" text, "D.O.B." text, "Uni#" real, "Bats" text, "Throws" text, "Position" text )
Which Surname has Throws of l, and a DOB of 5/02/79?
SELECT "Surname" FROM table_75192 WHERE "Throws" = 'l' AND "D.O.B." = '5/02/79'
wikisql
CREATE TABLE table_25418 ( "Year" real, "Majors" real, "ATP wins" real, "Total wins" real, "Earnings ($)" real, "Money list rank" real )
In what year was his money list rank 3?
SELECT MIN("Year") FROM table_25418 WHERE "Money list rank" = '3'
wikisql
CREATE TABLE table_204_297 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
which countries earned the same number of silver medals as germany ?
SELECT COUNT("nation") FROM table_204_297 WHERE "nation" <> 'germany' AND "silver" = (SELECT "silver" FROM table_204_297 WHERE "nation" = 'germany')
squall
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, ...
tell me the maximum sao2 in patient 027-214052 on the last intensive care unit visit?
SELECT MAX(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-214052') AND NOT patient.unitdischargetime IS NULL OR...
eicu
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
what is a drug that patient 61591 was prescribed for within the same hospital visit after receiving cont inv mec ven 96+ hrs in 05/this year?
SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 61591 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_proce...
mimic_iii
CREATE TABLE table_68988 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
What year shows 4 points?
SELECT "Year" FROM table_68988 WHERE "Points" = '4'
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...
患者柏泰初经常去哪家医院,在2015-08-27到2016-11-04期间?
SELECT qtb.MED_SER_ORG_NO FROM qtb WHERE qtb.PERSON_NM = '柏泰初' AND qtb.IN_HOSP_DATE BETWEEN '2015-08-27' AND '2016-11-04' GROUP BY qtb.MED_SER_ORG_NO ORDER BY COUNT(*) DESC LIMIT 1 UNION SELECT gyb.MED_SER_ORG_NO FROM gyb WHERE gyb.PERSON_NM = '柏泰初' AND gyb.IN_HOSP_DATE BETWEEN '2015-08-27' AND '2016-11-04' GROUP BY gy...
css
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
until 2103 what are the four most frequently prescribed medications for patients who were also prescribed midazolam (versed) 2 mg/2ml inj 1 mg at the same time?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'midazolam (versed) 2 mg/2ml inj 1 mg' AND STRFTIME(...
eicu
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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...
患者35125613493的检验报告单属于哪种类型的检验
SELECT zyjybgb.JYLX FROM zyjybgb WHERE zyjybgb.BGDH = '35125613493' UNION SELECT mzjybgb.JYLX FROM mzjybgb WHERE mzjybgb.BGDH = '35125613493'
css
CREATE TABLE table_name_52 ( opponent VARCHAR, attendance VARCHAR )
What is Opponent, when Attendance is 62,170?
SELECT opponent FROM table_name_52 WHERE attendance = "62,170"
sql_create_context
CREATE TABLE table_name_46 ( country VARCHAR, airport VARCHAR )
Paris-Charles de Gaulle airport is in which country?
SELECT country FROM table_name_46 WHERE airport = "paris-charles de gaulle airport"
sql_create_context
CREATE TABLE table_name_15 ( location VARCHAR, fatalities VARCHAR )
What location had 25/25 fatalities?
SELECT location FROM table_name_15 WHERE fatalities = "25/25"
sql_create_context
CREATE TABLE artists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE playlists ( id INTEGER, name VARCHAR(120) ) CREATE TABLE invoice_lines ( id INTEGER, invoice_id INTEGER, track_id INTEGER, unit_price NUMERIC(10,2), quantity INTEGER ) CREATE TABLE playlist_tracks ( playlist_i...
Return a histogram on how many invoices were billed from each state?, and sort x axis from low to high order.
SELECT billing_state, COUNT(*) FROM invoices WHERE billing_country = "USA" GROUP BY billing_state ORDER BY billing_state
nvbench
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
patient 016-34475 was diagnosed until 4 years ago for the last time with what?
SELECT diagnosis.diagnosisname FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-34475')) AND DATETIME(diagnosis.diagnosistime) <= DATETIME(CU...
eicu
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar...
Of all the courses which are worth 7 credits ?
SELECT DISTINCT name, number FROM course WHERE credits = 7 AND department = 'EECS'
advising
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE lab ( labid numbe...
when was the first hospital admission time when patient 035-20156 was admitted a year before via the direct admit?
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '035-20156' AND patient.hospitaladmitsource = 'direct admit' AND DATETIME(patient.hospitaladmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY patient.hospitaladmittime LIMIT 1
eicu
CREATE TABLE table_1965650_3 ( pick__number INTEGER, player VARCHAR )
Name the least pick # for doug gibson
SELECT MIN(pick__number) FROM table_1965650_3 WHERE player = "Doug Gibson"
sql_create_context
CREATE TABLE table_name_19 ( gold INTEGER, rank VARCHAR, bronze VARCHAR )
What is the highest number of gold medals for the team ranked 7 with less than 3 bronze?
SELECT MAX(gold) FROM table_name_19 WHERE rank = "7" AND bronze < 3
sql_create_context
CREATE TABLE table_16206 ( "Name" text, "Dates active" text, "Peak classification" text, "Windspeeds" text, "Pressure" text, "Areas affected" text, "Damage (USD)" text, "Deaths" text, "Refs" text )
When was Kamba active?
SELECT "Dates active" FROM table_16206 WHERE "Name" = 'Kamba'
wikisql
CREATE TABLE table_23921 ( "Number" text, "Previous BR No." real, "Taken into deptal stock" real, "Withdrawn" real, "Disposal" text )
Name the total number of previous br number for number 21
SELECT COUNT("Previous BR No.") FROM table_23921 WHERE "Number" = '21'
wikisql
CREATE TABLE table_train_99 ( "id" int, "mini_mental_state_examination_mmse" int, "language" string, "renal_disease" bool, "hepatic_disease" bool, "allergy_to_formoterol" bool, "geriatric_depression_scale_gds" int, "NOUSE" float )
known hypersensitivity or prior exposure to formoterol.
SELECT * FROM table_train_99 WHERE allergy_to_formoterol = 1
criteria2sql
CREATE TABLE table_name_8 ( gross_revenue__2011_ VARCHAR, state VARCHAR )
What is the gross revenue in 2011 for MO?
SELECT gross_revenue__2011_ FROM table_name_8 WHERE state = "mo"
sql_create_context
CREATE TABLE table_203_399 ( id number, "pos." text, "driver" text, "co-driver" text, "car" text, "time" text, "difference" text, "points" number )
pg andersson and toni gardemeister were both driving what type of car ?
SELECT "car" FROM table_203_399 WHERE "driver" = 'pg andersson'
squall
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
provide the number of patients whose insurance is private and year of birth is less than 2023?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Private" AND demographic.dob_year < "2023"
mimicsql_data
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
did patient 97330 have a obstructive sleep apnea diagnosis during their current hospital encounter?
SELECT COUNT(*) > 0 FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'obstructive sleep apnea') AND diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 97330 AND admissions.dischtim...
mimic_iii
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, ...
查一下37519458这个病人的就诊记录中,有哪几次医疗记录中被开出过3819.76元以上的药品?列出医疗就诊编号
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '37519458' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT > 3819.76)
css
CREATE TABLE table_13836704_4 ( airport VARCHAR, total_passengers_2009 VARCHAR )
what's the airport with total passengers 2009 being 157933
SELECT airport FROM table_13836704_4 WHERE total_passengers_2009 = 157933
sql_create_context
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Descr...
Distribution of users by the number of upvotes.
SELECT UpVotes AS upvotes, COUNT(*) AS total_users FROM Users WHERE Reputation >= 15 GROUP BY UpVotes ORDER BY UpVotes
sede
CREATE TABLE table_26787 ( "Contestant" text, "Starting Weight (kg)" text, "Final Weight (kg)" text, "Weight Lost (kg)" text, "Percentage Lost" text, "Position (out of Eliminated Contestants)" text )
Who is every contestant for the position of 4th?
SELECT "Contestant" FROM table_26787 WHERE "Position (out of Eliminated Contestants)" = '4th'
wikisql
CREATE TABLE table_name_48 ( opponent VARCHAR, attendance VARCHAR )
Which team did the Patriots play when there was a game attendance of 73,369?
SELECT opponent FROM table_name_48 WHERE attendance = "73,369"
sql_create_context
CREATE TABLE table_51790 ( "Election" text, "D\u00e1il" text, "Share of votes" text, "Seats" real, "Total seats" real )
With a dail of 24th and more than 57 seats, what is the election?
SELECT "Election" FROM table_51790 WHERE "Seats" > '57' AND "D\u00e1il" = '24th'
wikisql
CREATE TABLE table_47553 ( "Region (year)" text, "No. 1" text, "No. 2" text, "No. 3" text, "No. 4" text, "No. 5" text, "No. 6" text, "No. 7" text, "No. 8" text, "No. 9" text, "No. 10" text )
Who was number 7 when Olivia was number 5 and Emma was number 2?
SELECT "No. 7" FROM table_47553 WHERE "No. 5" = 'olivia' AND "No. 2" = 'emma'
wikisql
CREATE TABLE table_name_65 ( against INTEGER, points VARCHAR, played VARCHAR )
Which average Against has Points of 6, and a Played smaller than 9?
SELECT AVG(against) FROM table_name_65 WHERE points = 6 AND played < 9
sql_create_context
CREATE TABLE table_23822 ( "Barangay" text, "District" text, "Population (May 1, 2000)" real, "Population (August 1, 2007)" real, "Population (May 1, 2010)" text )
Name the total number of district for population may being 478
SELECT COUNT("District") FROM table_23822 WHERE "Population (May 1, 2010)" = '478'
wikisql
CREATE TABLE table_28037619_2 ( us_viewers__million_ VARCHAR, directed_by VARCHAR, written_by VARCHAR )
How many million u.s. viewers saw the episode that was directed by roger young and written by debra j. fisher?
SELECT us_viewers__million_ FROM table_28037619_2 WHERE directed_by = "Roger Young" AND written_by = "Debra J. Fisher"
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 of the patients admitted to emergency had item id 50902?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND lab.itemid = "50902"
mimicsql_data
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 ) ...
count the number of patients whose primary disease is abdominal abscess and admission year is less than 2162?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ABDOMINAL ABSCESS" AND demographic.admityear < "2162"
mimicsql_data
CREATE TABLE table_name_15 ( format VARCHAR, label VARCHAR, catalog VARCHAR, date VARCHAR )
What is the format for the album under the label, luaka bop, that had a catalog number of 3645 and dated after 1981?
SELECT format FROM table_name_15 WHERE catalog = "3645" AND date > 1981 AND label = "luaka bop"
sql_create_context
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, ...
哪些人被门诊诊断为慢性龈炎?并列举出这些的患者的籍贯代码、名称以及相应人数
SELECT person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE mzjzjlb.JZZDSM = '慢性龈炎' GROUP BY person_info.JGDM
css
CREATE TABLE table_2709_4 ( format VARCHAR, owner VARCHAR )
What is the format for the station owned by Dakota Broadcasting?
SELECT format FROM table_2709_4 WHERE owner = "Dakota Broadcasting"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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 te...
患者的a1酸性糖蛋白在门诊诊断为疾病K80.961的参考值范围有什么下限和上限?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND mzjzjlb_jybgb.YLJGDM = jybgb.YLJGDM AND mzjzjlb_jybgb.BGDH = jybgb....
css
CREATE TABLE table_1425948_1 ( number_in_fleet INTEGER, chassis_model VARCHAR )
Chassis model Scania K360ua has what minimum number in fleet?
SELECT MIN(number_in_fleet) FROM table_1425948_1 WHERE chassis_model = "Scania K360UA"
sql_create_context
CREATE TABLE table_22296 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real )
What is the original air date of the episode with the production code 1115?
SELECT "Original air date" FROM table_22296 WHERE "Production code" = '1115'
wikisql
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
00年6月2号到06年12月18号,患者方欣悦的236211指标是怎样的
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZ...
css
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of manager_id over the hire_date bin hire_date by weekday by a bar chart.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_name_82 ( venue VARCHAR, goal VARCHAR, result VARCHAR )
Which venue had more than 9 goals and a final result of 4-1?
SELECT venue FROM table_name_82 WHERE goal > 9 AND result = "4-1"
sql_create_context
CREATE TABLE table_58699 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
Which Date has a Road Team of chicago, and a Result of 88-85 (ot)?
SELECT "Date" FROM table_58699 WHERE "Road Team" = 'chicago' AND "Result" = '88-85 (ot)'
wikisql
CREATE TABLE table_34262 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Wins" real )
how many wins did players earning less than $10,484,065 have?
SELECT SUM("Wins") FROM table_34262 WHERE "Earnings ( $ )" < '10,484,065'
wikisql
CREATE TABLE table_name_84 ( winner_2nd VARCHAR, jockey VARCHAR )
WHo is Winner/2nd that has c. symons?
SELECT winner_2nd FROM table_name_84 WHERE jockey = "c. symons"
sql_create_context
CREATE TABLE table_name_35 ( l1_cache VARCHAR, fsb_speed VARCHAR, clock_speed VARCHAR )
Which L1 Cache has an FSB speed of 800mhz and a clock speed of 1.2ghz?
SELECT l1_cache FROM table_name_35 WHERE fsb_speed = "800mhz" AND clock_speed = "1.2ghz"
sql_create_context
CREATE TABLE diagnoses ( 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 ) C...
what is the number of patients whose ethnicity is american indian/alaska native and procedure icd9 code is 7761?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "7761"
mimicsql_data
CREATE TABLE table_41053 ( "Year" real, "Actor" text, "Award" text, "Motion Picture" text, "Result" text )
What is the latest year that Cicely Tyson is the Golden Globe Award actor?
SELECT MAX("Year") FROM table_41053 WHERE "Actor" = 'cicely tyson'
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...
编号是91530632的患者医疗费总额大于4446.07元的其医疗记录入院诊断疾病编码和名称,列出其都是什么?
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_ID = '91530632' AND t_kc24.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 4446.07)
css
CREATE TABLE table_name_33 ( silver INTEGER, rank VARCHAR, bronze VARCHAR, total VARCHAR )
What is the smallest silver with a Bronze smaller than 6, a Total of 3, and a Rank smaller than 9?
SELECT MIN(silver) FROM table_name_33 WHERE bronze < 6 AND total = 3 AND rank < 9
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
what are the top three common diagnoses of patients of age 30s?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
eicu
CREATE TABLE CUSTOMER ( FirstName VARCHAR, LastName VARCHAR, Email VARCHAR )
What is the first name and last name of the customer that has email 'luisg@embraer.com.br'?
SELECT FirstName, LastName FROM CUSTOMER WHERE Email = "luisg@embraer.com.br"
sql_create_context
CREATE TABLE table_16668 ( "Round" real, "Grand Prix" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
What is the location of thierry boutsen?
SELECT "Location" FROM table_16668 WHERE "Fastest Lap" = 'Thierry Boutsen'
wikisql
CREATE TABLE table_3203 ( "Team" text, "#" real, "Car Sponsor(s)" text, "Driver(s)" text, "Listed Owner(s)" text, "Engine" text, "Chassis" text )
What engine does the Fuzzy's Ultra Premium Vodka sponsored car use?
SELECT "Engine" FROM table_3203 WHERE "Car Sponsor(s)" = 'Fuzzy''s Ultra Premium Vodka'
wikisql
CREATE TABLE weather ( date VARCHAR, mean_temperature_f VARCHAR, mean_humidity VARCHAR, max_gust_speed_mph VARCHAR )
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds?
SELECT date, mean_temperature_f, mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
sql_create_context
CREATE TABLE table_name_92 ( score VARCHAR, january INTEGER )
What was the score in January that was less than 4?
SELECT score FROM table_name_92 WHERE january < 4
sql_create_context
CREATE TABLE table_name_67 ( to_par VARCHAR, player VARCHAR )
What is the To par has the presence of Vijay Singh?
SELECT to_par FROM table_name_67 WHERE player = "vijay singh"
sql_create_context
CREATE TABLE table_name_91 ( bronze INTEGER, total INTEGER )
What is the sum of Bronze when the total is more than 27?
SELECT SUM(bronze) FROM table_name_91 WHERE total > 27
sql_create_context
CREATE TABLE table_39056 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponent" text, "Score" text )
What person was played against when the playing surface was hard?
SELECT "Opponent" FROM table_39056 WHERE "Surface" = 'hard'
wikisql
CREATE TABLE table_name_95 ( runner_up VARCHAR, year VARCHAR )
What runner-up has 2008 as the year?
SELECT runner_up FROM table_name_95 WHERE year = "2008"
sql_create_context
CREATE TABLE table_42785 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
What team was the Away team when the Tie no was 3?
SELECT "Away team" FROM table_42785 WHERE "Tie no" = '3'
wikisql
CREATE TABLE table_55815 ( "Locomotive" text, "Serial No" text, "Entered service" text, "Gauge" text, "Livery" text )
What is the date of entered service for the locomotive with a broad gauge and a serial no of 83-1018?
SELECT "Entered service" FROM table_55815 WHERE "Gauge" = 'broad' AND "Serial No" = '83-1018'
wikisql
CREATE TABLE table_68581 ( "Frequency" real, "Callsign" text, "Brand" text, "Format" text, "City of License" text, "Website" text, "Webcast" text )
Name the sum of frequecy with brand of exa fm
SELECT SUM("Frequency") FROM table_68581 WHERE "Brand" = 'exa fm'
wikisql
CREATE TABLE table_203_134 ( id number, "place" text, "player" text, "country" text, "score" text, "to par" number )
how many players tied for fourth place ?
SELECT COUNT("player") FROM table_203_134 WHERE "place" = 4
squall
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 zyjzjlb ( CYBQDM text, CYBQMC...
列出首诊医生以及其他所有接诊医生在门诊就诊16949706262里面的工号都是什么?
SELECT zzmzjzjlb.ZZYSGH, zzmzjzjlb.QTJZYSGH FROM zzmzjzjlb WHERE zzmzjzjlb.JZLSH = '16949706262' UNION SELECT fzzmzjzjlb.ZZYSGH, fzzmzjzjlb.QTJZYSGH FROM fzzmzjzjlb WHERE fzzmzjzjlb.JZLSH = '16949706262'
css
CREATE TABLE table_name_73 ( appointed_by VARCHAR, judge VARCHAR )
Who appointed Judge Edward E. Cushman?
SELECT appointed_by FROM table_name_73 WHERE judge = "edward e. cushman"
sql_create_context
CREATE TABLE perpetrator ( Perpetrator_ID int, People_ID int, Date text, Year real, Location text, Country text, Killed int, Injured int ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, "Home Town" text )
Bar chart x axis country y axis the total number, and list by the total number from low to high.
SELECT Country, COUNT(*) FROM perpetrator GROUP BY Country ORDER BY COUNT(*)
nvbench
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...
in a day before what was the temperature minimum value of patient 033-22108?
SELECT MIN(vitalperiodic.temperature) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-22108')) AND NOT vitalperiodic.temperature IS ...
eicu
CREATE TABLE table_23555 ( "Year" real, "Starts" real, "Wins" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
state the winnings of yates racing front row motorsports where poles were 0
SELECT "Winnings" FROM table_23555 WHERE "Poles" = '0' AND "Team(s)" = 'Yates Racing Front Row Motorsports'
wikisql
CREATE TABLE table_53966 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What team has a Venue at Lake Oval?
SELECT "Away team" FROM table_53966 WHERE "Venue" = 'lake oval'
wikisql
CREATE TABLE table_204_291 ( id number, "rank" number, "name" text, "nation" text, "cp" number, "fp" number, "points" number, "placings" number )
how many skaters had points greater than 2600 ?
SELECT COUNT("name") FROM table_204_291 WHERE "points" > 2600
squall
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE Votes ( Id number, PostId number, ...
High rep through prolific bad answers. A list of the 100 above-30k users with the lowest average answer score excluding community wiki / closed posts or users with less than 100 answers
SELECT Users.Id AS "user_link", Users.Reputation AS Reputation, COUNT(Posts.Id) AS Answers, CAST(AVG(CAST(Score AS FLOAT)) AS FLOAT(6, 2)) AS "average_answer_score" FROM Posts INNER JOIN Users ON Users.Id = OwnerUserId WHERE PostTypeId = 2 AND CommunityOwnedDate IS NULL AND ClosedDate IS NULL AND Users.Reputation > 500...
sede
CREATE TABLE table_name_45 ( duration VARCHAR, soap_opera VARCHAR, actor VARCHAR )
What's the duration of the Archers with Pauline Seville acting?
SELECT duration FROM table_name_45 WHERE soap_opera = "the archers" AND actor = "pauline seville"
sql_create_context
CREATE TABLE table_26236 ( "Rank by Average" real, "Place" real, "Couple" text, "Total Points Earned" real, "Number of Dances" real, "Average" text )
What was the average score for the couple that had 4 dances?
SELECT "Average" FROM table_26236 WHERE "Number of Dances" = '4'
wikisql
CREATE TABLE PostTypes ( Id number, Name text ) 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, ProfileImage...
Find users who offered the most bounties per post.
SELECT UserId AS "user_link", PostId AS "post_link", COUNT(*) AS Bounties FROM Votes WHERE VoteTypeId = 8 AND CreationDate >= '2011-09-09 11:00:00' GROUP BY UserId, PostId ORDER BY Bounties DESC
sede
CREATE TABLE table_9971 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text )
What is the lowest Game, when Opponent is 'Boston Bruins'?
SELECT MIN("Game") FROM table_9971 WHERE "Opponent" = 'boston bruins'
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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
how many patients aged below 45 years have parenteral infusion of concentrated nutritional substances as the procedure long title?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "45" AND procedures.long_title = "Parenteral infusion of concentrated nutritional substances"
mimicsql_data
CREATE TABLE table_28540428_3 ( event_3_deadlift VARCHAR, name VARCHAR )
Name the event 3 deadlift for hennie jordan
SELECT event_3_deadlift FROM table_28540428_3 WHERE name = "Hennie Jordan"
sql_create_context
CREATE TABLE table_name_50 ( rank VARCHAR, year VARCHAR, chassis VARCHAR )
What is the rank of the reynard 2ki chassis before 2002?
SELECT rank FROM table_name_50 WHERE year < 2002 AND chassis = "reynard 2ki"
sql_create_context