context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_name_23 ( position VARCHAR )
What position did Garion Weller hold in 2012?
SELECT position FROM table_name_23 WHERE 2012 = "garion weller"
sql_create_context
CREATE TABLE organization ( continent varchar, homepage varchar, name varchar, oid int ) CREATE TABLE domain ( did int, name varchar ) CREATE TABLE keyword ( keyword varchar, kid int ) CREATE TABLE domain_publication ( did int, pid int ) CREATE TABLE domain_journal ( did ...
return me the number of researchers in ' University of Michigan ' .
SELECT COUNT(DISTINCT (author.name)) FROM author, organization WHERE organization.name = 'University of Michigan' AND organization.oid = author.oid
academic
CREATE TABLE table_26986076_5 ( fri_27_aug VARCHAR, wed_25_aug VARCHAR )
When 21' 05.83 107.304mph is Wednesday August 25th what is Friday August 27th?
SELECT fri_27_aug FROM table_26986076_5 WHERE wed_25_aug = "21' 05.83 107.304mph"
sql_create_context
CREATE TABLE table_14144 ( "Manufacturer" text, "Transmission" text, "Engine Capacity" real, "Fuel Type" text, "L/100km Urban (Cold)" real, "L/100km Extra-Urban" real, "L/100km Combined" real, "mpg-UK Urban (Cold)" real, "mpg-UK Extra-Urban" real, "mpg-UK Combined" real, "mpg...
What is the average L/100km urban value having an L/100km extraurban under 7.2, mpg combined in the UK under 39.8, l/100km combined over 7.9, and mpg combined in the US under 25.1?
SELECT AVG("L/100km Urban (Cold)") FROM table_14144 WHERE "L/100km Extra-Urban" < '7.2' AND "mpg-UK Combined" < '39.8' AND "L/100km Combined" > '7.9' AND "mpg-US Combined" < '25.1'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
Look for the private health insurance patients who had an open liver biopsy procedure.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Open biopsy of liver"
mimicsql_data
CREATE TABLE mzjzjlb_jybgb ( YLJGDM_MZJZJLB text, BGDH number, YLJGDM number ) 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, ...
负责11994027078患者门诊就诊的首诊医生还有其他所有接诊医生的工号是啥啊?
SELECT mzjzjlb.ZZYSGH, mzjzjlb.QTJZYSGH FROM mzjzjlb WHERE mzjzjlb.JZLSH = '11994027078'
css
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 demographic ...
provide the number of patients whose ethnicity is hispanic or latino and item id is 51044?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND lab.itemid = "51044"
mimicsql_data
CREATE TABLE table_train_184 ( "id" int, "gender" string, "systolic_blood_pressure_sbp" int, "heart_disease" bool, "renal_disease" bool, "hematocrit_hct" float, "allergy_to_insulin_lispro" bool, "diastolic_blood_pressure_dbp" int, "serum_creatinine" float, "hypertension" bool, ...
renal insufficiency: serum creatinine > 1.3 mg / dl ( male ) or > 1.2 mg / dl ( female )
SELECT * FROM table_train_184 WHERE renal_disease = 1 OR ((gender = 'male' AND serum_creatinine > 1.3) OR (gender = 'female' AND serum_creatinine > 1.2))
criteria2sql
CREATE TABLE table_47117 ( "Senator" text, "Party" text, "District" real, "Home Town" text, "Took Office" real )
What is the sum of District, when Took Office is greater than 1981, and when Senator is Cyndi Taylor Krier?
SELECT SUM("District") FROM table_47117 WHERE "Took Office" > '1981' AND "Senator" = 'cyndi taylor krier'
wikisql
CREATE TABLE table_65847 ( "Draw" real, "Artist" text, "Song" text, "Points" real, "Place" real )
What is the highest Place with more than 3 draws, for the Song 'dajana', with less than 31 points?
SELECT MAX("Place") FROM table_65847 WHERE "Draw" > '3' AND "Song" = 'dajana' AND "Points" < '31'
wikisql
CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIG...
How many students are in each department Visualize by bar chart, and I want to order by the names in ascending.
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE
nvbench
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年5月9日到10年3月17日这段时间,褚静婉患者在医院就诊的次数一共是多少次?
SELECT (SELECT COUNT(*) FROM person_info JOIN hz_info JOIN zzmzjzjlb 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 WHERE person_info.XM = '褚静婉' AND zzmzjzjlb.JZKSRQ BETWEEN '2000-05-09' AND '2010-03-17' UNION SELECT COUNT(*) FROM p...
css
CREATE TABLE table_name_55 ( location VARCHAR )
Tell me the average 1st prize for tennessee
SELECT AVG(1 AS st_prize__) AS $__ FROM table_name_55 WHERE location = "tennessee"
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquep...
what was the number of patients that were discharged from hospital until 2100?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) <= '2100'
eicu
CREATE TABLE table_57838 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the home score when the away team scored 16.11 (107)?
SELECT "Home team" FROM table_57838 WHERE "Away team score" = '16.11 (107)'
wikisql
CREATE TABLE table_16579 ( "#" real, "Episode" text, "Rating" text, "Share" real, "Rating/Share (18-49)" text, "Viewers (millions)" text, "Rank (timeslot)" real, "Rank (night)" real, "Rank (week)" text )
What is the lowest rank (night) for having viewers (millions) 5.25?
SELECT MIN("Rank (night)") FROM table_16579 WHERE "Viewers (millions)" = '5.25'
wikisql
CREATE TABLE table_name_30 ( year INTEGER, reg_season VARCHAR, division VARCHAR )
Which Year is the highest one that has a Reg Season of 3rd, western, and a Division larger than 2?
SELECT MAX(year) FROM table_name_30 WHERE reg_season = "3rd, western" AND division > 2
sql_create_context
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE days ( days_code varchar, ...
what are the flights between MEMPHIS and CINCINNATI on wednesday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CINCINNATI' AND date_day.day_number = 23 AND date_day.month_number = 4 AN...
atis
CREATE TABLE table_9931 ( "Round" real, "Pick" real, "Overall" real, "Name" text, "Position" text, "College" text )
What's the average round for the OT position from tulane college with an overall over 38?
SELECT AVG("Round") FROM table_9931 WHERE "Position" = 'ot' AND "College" = 'tulane' AND "Overall" > '38'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) ...
what are the four most commonly prescribed drugs that were prescribed to male patients in their 50s in the same hospital encounter after they were diagnosed with tobacco use disorder in 2105?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_...
mimic_iii
CREATE TABLE table_73921 ( "Outcome" text, "No." text, "Date" text, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
The score in the final is 2 6, 6 2, 6 0, on what surface?
SELECT "Surface" FROM table_73921 WHERE "Score in the final" = '2–6, 6–2, 6–0'
wikisql
CREATE TABLE table_46640 ( "Tournament" text, "Surface" text, "Week" text, "Winners" text, "Finalists" text, "Semifinalists" text )
What is Tournament, when Week is November 23?
SELECT "Tournament" FROM table_46640 WHERE "Week" = 'november 23'
wikisql
CREATE TABLE table_63502 ( "Iteration" text, "Year" real, "Dates" text, "Location" text, "Theme" text )
What is the Location of the 'My Pacific' Theme?
SELECT "Location" FROM table_63502 WHERE "Theme" = 'my pacific'
wikisql
CREATE TABLE Sportsinfo ( StuID VARCHAR ) CREATE TABLE Student ( StuID VARCHAR )
Show student ids who don't have any sports.
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo
sql_create_context
CREATE TABLE table_46089 ( "Year" real, "Dates" text, "Champion" text, "Country" text, "Winning score" text, "To par" text, "Margin of victory" text, "Tournament location" text, "Purse ( $ )" text, "Winner's share ($)" text )
What tournament location has south korea as the country?
SELECT "Tournament location" FROM table_46089 WHERE "Country" = 'south korea'
wikisql
CREATE TABLE table_15972 ( "Formula" text, "Notation" text, "T c (K)" real, "No. of Cu-O planes in unit cell" real, "Crystal structure" text )
What is the crystal structure for the formula yba 2 cu 3 o 7?
SELECT "Crystal structure" FROM table_15972 WHERE "Formula" = 'YBa 2 Cu 3 O 7'
wikisql
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
what is the smallest aircraft available flying from PITTSBURGH to BALTIMORE arriving on 5 7
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, equipment_sequence, flight WHERE (((((flight.arrival_time < 41 OR flight.time_elapsed >= 60) AND flight.departure_time > flight.arrival_time) ...
atis
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
Give the number of patients whose marital status is married and were admitted before the year 2194.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear < "2194"
mimicsql_data
CREATE TABLE table_40341 ( "Venue" text, "Location" text, "Capacity" text, "Owner" text, "Environment" text, "Year Built" text )
What year was transamerica field built in?
SELECT "Year Built" FROM table_40341 WHERE "Venue" = 'transamerica field'
wikisql
CREATE TABLE table_16381914_1 ( affiliation VARCHAR, location VARCHAR )
What affiliation is Erie, Pennsylvania?
SELECT affiliation FROM table_16381914_1 WHERE location = "Erie, Pennsylvania"
sql_create_context
CREATE TABLE table_204_498 ( id number, "location" text, "building" text, "year" number, "km" number, "monument" number )
which location has the most km ?
SELECT "location" FROM table_204_498 ORDER BY "km" DESC LIMIT 1
squall
CREATE TABLE table_name_79 ( drawn INTEGER, goals_for VARCHAR, lost VARCHAR )
For entries with lost larger than 21 and goals for smaller than 36, what is the average drawn?
SELECT AVG(drawn) FROM table_name_79 WHERE goals_for < 36 AND lost > 21
sql_create_context
CREATE TABLE table_25981 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "F/Laps" real, "Podiums" real, "Points" text, "Position" text )
How many seasons have motopark team?
SELECT COUNT("Season") FROM table_25981 WHERE "Team" = 'Motopark'
wikisql
CREATE TABLE table_name_16 ( dubose_porter VARCHAR, roy_barnes VARCHAR )
What is the DuBose Porter with Roy Barnes at 54%?
SELECT dubose_porter FROM table_name_16 WHERE roy_barnes = "54%"
sql_create_context
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress ...
Percentage of closed question per tag (among the posts that were not deleted).
WITH closed_cte AS (SELECT t.TagName AS tag, COUNT(q.Id) AS totalcount, COUNT(q.ClosedDate) AS closedcount, ROUND(COUNT(q.ClosedDate) * 100.0 / COUNT(q.Id), 2) AS percentage FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE q.PostTypeId = 1 GROUP BY t.TagName) S...
sede
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 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.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_462 ( "Name" text, "Pennant" text, "Builder" text, "Laid Down" text, "Launched" text, "Commissioned" text, "Fate" text )
What is the pennant for 4 may 1943?
SELECT "Pennant" FROM table_462 WHERE "Laid Down" = '4 May 1943'
wikisql
CREATE TABLE table_1341522_36 ( status VARCHAR, incumbent VARCHAR )
How many districts are respresented by Alex McMillan?
SELECT COUNT(status) FROM table_1341522_36 WHERE incumbent = "Alex McMillan"
sql_create_context
CREATE TABLE table_38752 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" real, "Date" text, "Report" text )
What was the home team score for essendon?
SELECT "Home team score" FROM table_38752 WHERE "Home team" = 'essendon'
wikisql
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 date of death and admission time of subject id 15898?
SELECT demographic.dod, demographic.admittime FROM demographic WHERE demographic.subject_id = "15898"
mimicsql_data
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) ...
A bar chart shows the distribution of meter_500 and ID , list by the X-axis in descending.
SELECT meter_500, ID FROM swimmer ORDER BY meter_500 DESC
nvbench
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
请查出医疗就诊42183982937中检测人姓尤的负责的所有检测指标名称,还有检测指标的结果定量与结果定量单位的详细信息
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM jybgb JOIN jyjgzbb ON jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE jybgb.JZLSH = '42183982937' AND jyjgzbb.JCRXM LIKE '尤%'
css
CREATE TABLE table_name_53 ( grid VARCHAR, laps VARCHAR )
What grid features 6 laps?
SELECT grid FROM table_name_53 WHERE laps = 6
sql_create_context
CREATE TABLE table_29554 ( "Season" text, "Points per Game" text, "Total Yards per Game" text, "Rushing Yards per Game" text, "Passing Yards per Game" text, "Sacks" text, "Interceptions" text )
What is every value for passing yards per game if rushing yards per game is 113.6?
SELECT "Passing Yards per Game" FROM table_29554 WHERE "Rushing Yards per Game" = '113.6'
wikisql
CREATE TABLE tweets ( id number, uid number, text text, createdate time ) CREATE TABLE user_profiles ( uid number, name text, email text, partitionid number, followers number ) CREATE TABLE follows ( f1 number, f2 number )
Find the number of users who posted some tweets.
SELECT COUNT(DISTINCT uid) FROM tweets
spider
CREATE TABLE table_69979 ( "Name" text, "Date of Execution" text, "Crime" text, "Method" text, "Race" text )
How was the native american executed in July 1836?
SELECT "Method" FROM table_69979 WHERE "Race" = 'native american' AND "Date of Execution" = 'july 1836'
wikisql
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id...
what were the five most common drugs prescribed to the female patients 20s within 2 months after being diagnosed with nephritis nos in oth dis since 5 years ago?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
mimic_iii
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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, visualize a line chart about the change of salary over hire_date , order by the x-axis from high to low please.
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC
nvbench
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE lab ( labid number, pa...
what is the number of patients that sodium chloride 0.9% is prescribed to?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'sodium chloride 0.9%')
eicu
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, ...
查一下患者朱高翰在医院2154200中从二零年一月二十五日到二一年九月十五日的这段时间里开的所有的药和药品编码
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '朱高翰' AND t_kc21.MED_SER_ORG_NO = '2154200' AND t_kc21.IN_HOSP_DATE BETWEEN '2020-01-25' AND '2021-09-15')
css
CREATE TABLE table_name_86 ( interview INTEGER, state VARCHAR, average VARCHAR )
What is the lowest interview of Texas, with an average larger than 9.531?
SELECT MIN(interview) FROM table_name_86 WHERE state = "texas" AND average > 9.531
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...
give me the number of patients born before 2126 who are still alive.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.dob_year < "2126"
mimicsql_data
CREATE TABLE table_name_56 ( median_household_income VARCHAR, median_family_income VARCHAR )
What is the Median household income associated with a median family income of $46,616?
SELECT median_household_income FROM table_name_56 WHERE median_family_income = "$46,616"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
how many patients are admitted before the year 2166 and followed the procedure exteriorization of small intestine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2166" AND procedures.long_title = "Exteriorization of small intestine"
mimicsql_data
CREATE TABLE table_71533 ( "name" text, "type" text, "elevation" text, "USGS Map" text, "GNIS ID" real )
Which name has a USGS Map of clear lake?
SELECT "name" FROM table_71533 WHERE "USGS Map" = 'clear lake'
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, ...
何阳夏患者的检验报告单对应的检验结果指标均异常有哪些?列出异常的检验报告单号都是哪些?
SELECT zyjybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN zyjybgb 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 AND mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB WHERE person_info.XM = '何阳夏' ...
css
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...
列出在医院6343102中就诊科室名称包含产前诊断的所有医疗就诊记录有哪些属于患者沈清妍?
SELECT * FROM gwyjzb WHERE gwyjzb.PERSON_NM = '沈清妍' AND gwyjzb.MED_SER_ORG_NO = '6343102' AND gwyjzb.MED_ORG_DEPT_NM LIKE '%产前诊断%' UNION SELECT * FROM fgwyjzb WHERE fgwyjzb.PERSON_NM = '沈清妍' AND fgwyjzb.MED_SER_ORG_NO = '6343102' AND fgwyjzb.MED_ORG_DEPT_NM LIKE '%产前诊断%'
css
CREATE TABLE table_28753 ( "Episode number (Production number)" text, "Title" text, "Original air date" text, "Total viewers on FX" text, "Total viewers on FX+" text, "Total viewers" text, "Rank on channel" text )
Name the total viewers on fx+ for 583,000 total viewers
SELECT "Total viewers on FX+" FROM table_28753 WHERE "Total viewers" = '583,000'
wikisql
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
Question Count or Score growth over time by tag comparison. Plots total questions over time or total score over time, comparing up to 4 tags. Reference: http://meta.stackoverflow.com/q/260570/331508
SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS "month", COUNT(q.Id) AS NumQuests FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE q.PostTypeId = 1 AND q.CreationDate >= '2016-01-01 00:00:00' AND t.TagName IN (@Tag1) GROUP BY DATEADD(month, DATEDI...
sede
CREATE TABLE table_73716 ( "Year" text, "Superintendent" text, "Middlesex Principal" text, "Gorham Principal" text, "Middle School Principal" text, "High School Principal" text )
How many years was lynn muscarella the high school principal and charlie wiltse the superintendent?
SELECT COUNT("Year") FROM table_73716 WHERE "High School Principal" = 'Lynn Muscarella' AND "Superintendent" = 'Charlie Wiltse'
wikisql
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_typ...
calculate the difference between patient 8016's total output and the total input on last month/23.
SELECT (SELECT SUM(inputevents_cv.amount) 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 = 8016)) AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT...
mimic_iii
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE weather ( date TEXT, ...
Please show the trend about the number of days with max temperature reaches 80 change over dates.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80 GROUP BY date
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
provide the number of patients whose diagnoses short title is routine circumcision and drug route is ng?
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.short_title = "Routine circumcision" AND prescriptions.route = "NG"
mimicsql_data
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2), end_hr numeric(2), end_min numeric(2) ) CREATE TABLE prereq ( ...
Find the total number of students in each department Show bar chart, and I want to show in descending by the total number.
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_26323 ( "Episode number Production number" text, "Title" text, "Original airing" text, "Rating" text, "Share" real, "Rating/share (18\u201349)" text, "Total viewers (in millions)" text )
If the rating is 9.1, what was the total viewers?
SELECT "Total viewers (in millions)" FROM table_26323 WHERE "Rating" = '9.1'
wikisql
CREATE TABLE table_75802 ( "Name" text, "Novelty" text, "Status" text, "Authors" text, "Location" text, "Notes" text )
What is the Status of the dinosaur, whose notes are, 'n coelurosauria'?
SELECT "Status" FROM table_75802 WHERE "Notes" = 'n coelurosauria'
wikisql
CREATE TABLE table_5188 ( "Maryland Counties" text, "Fall 05" real, "Fall 06" real, "Fall 07" real, "Fall 08" real, "Fall 09" real )
What is the sum of all values in Fall 09 in Allegany county with Fall 07 less than 751?
SELECT SUM("Fall 09") FROM table_5188 WHERE "Maryland Counties" = 'allegany' AND "Fall 07" < '751'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id nu...
among patients who were prescribed with tromethamine, what is the five most frequently prescribed drug at the same time,?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'tromethamine') AS t1 JOIN (SELECT admissions.subject_id, prescrip...
mimic_iii
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE procedures_icd ( r...
what is the difference between the total output and the input sum of patient 19175 on 11/04/2105?
SELECT (SELECT SUM(inputevents_cv.amount) 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 = 19175)) AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) = '2105-11-04') - (SELE...
mimic_iii
CREATE TABLE table_76804 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What was the attendance when the Cincinnati Bengals were the opponents?
SELECT "Attendance" FROM table_76804 WHERE "Opponent" = 'cincinnati bengals'
wikisql
CREATE TABLE table_51492 ( "Games" text, "Gold" text, "Silver" text, "Bronze" text, "Total" text, "Rank" text )
How many golds were there in a game that has 17 bronze and a total of 31?
SELECT "Gold" FROM table_51492 WHERE "Bronze" = '17' AND "Total" = '31'
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 demographic ...
Get the admission time and procedure icd9 code for the patient with patient id 2560.
SELECT demographic.admittime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
mimicsql_data
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dis...
what are the five most commonly given microbiology tests for patients who have previously had their unilat ing hern rep nos done within 2 months until 2104?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FR...
mimic_iii
CREATE TABLE table_3456 ( "Year" real, "Starts" real, "Wins" real, "Top 5" real, "Top 10" real, "Poles" real, "Avg. Start" text, "Avg. Finish" text, "Winnings" text, "Position" text, "Team(s)" text )
What is every value of Top 10 when team is #10 Phil Parsons Racing and average finish is 22.9?
SELECT "Top 10" FROM table_3456 WHERE "Team(s)" = '#10 Phil Parsons Racing' AND "Avg. Finish" = '22.9'
wikisql
CREATE TABLE table_name_65 ( score VARCHAR, date VARCHAR )
What was the score on August 19?
SELECT score FROM table_name_65 WHERE date = "august 19"
sql_create_context
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
whats the last ward id of patient 81783 during the first hospital encounter?
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 81783 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1) AND NOT transfers.wardid IS NULL ORDER BY transfers.intime DESC LIMIT 1
mimic_iii
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...
患者13034482在2003年4月25日到2009年2月2日内曾在医院一共就诊多少次?
SELECT (SELECT COUNT(*) FROM hz_info JOIN mzjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND p...
css
CREATE TABLE table_name_16 ( engine VARCHAR, tire VARCHAR, sponsor VARCHAR )
What is the engine of the goodyear tire and Herdez as a sponsor?
SELECT engine FROM table_name_16 WHERE tire = "goodyear" AND sponsor = "herdez"
sql_create_context
CREATE TABLE table_78578 ( "Rider" text, "Bike" text, "Laps" real, "Time" text, "Grid" real )
What is the time of Troy Bayliss with less than 8 grids?
SELECT "Time" FROM table_78578 WHERE "Grid" < '8' AND "Rider" = 'troy bayliss'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, ic...
tell me the maximum sao2 for patient 004-13127's body today?
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 = '004-13127')) AND NOT vitalperiodic.sao2 IS NULL AND DATET...
eicu
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE cour...
What is the easiest class available that meets the Other requirement ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_c...
advising
CREATE TABLE table_name_71 ( date VARCHAR, event VARCHAR )
What is the Date for the Event ept copenhagen?
SELECT date FROM table_name_71 WHERE event = "ept copenhagen"
sql_create_context
CREATE TABLE table_7587 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
When did the Chargers play the Denver Broncos before Week 10?
SELECT "Date" FROM table_7587 WHERE "Week" < '10' AND "Opponent" = 'denver broncos'
wikisql
CREATE TABLE table_name_95 ( result VARCHAR, game_site VARCHAR )
What was the result of the game played at Jeppesen Stadium?
SELECT result FROM table_name_95 WHERE game_site = "jeppesen stadium"
sql_create_context
CREATE TABLE staff ( staff_id number, staff_gender text, staff_name text ) CREATE TABLE order_items ( order_item_id number, order_id number, product_id number ) CREATE TABLE customer_addresses ( customer_id number, address_id number, date_from time, date_to time ) CREATE TABLE...
What are id and name of the products whose price is lower than 600 or higher than 900?
SELECT product_id, product_name FROM products WHERE product_price < 600 OR product_price > 900
spider
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) 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...
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, and sort by the y axis in desc please.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) DESC
nvbench
CREATE TABLE farm_competition ( competition_id number, year number, theme text, host_city_id number, hosts text ) CREATE TABLE competition_record ( competition_id number, farm_id number, rank number ) CREATE TABLE city ( city_id number, official_name text, status text, ...
What is the official name and status of the city with the most residents?
SELECT official_name, status FROM city ORDER BY population DESC LIMIT 1
spider
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEP...
For those employees who did not have any job in the past, draw a bar chart about the distribution of hire_date and the sum of salary bin hire_date by weekday.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
CREATE TABLE table_67200 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
What is the score with a place of t6 for the player k.j. choi?
SELECT "Score" FROM table_67200 WHERE "Place" = 't6' AND "Player" = 'k.j. choi'
wikisql
CREATE TABLE campuses ( id number, campus text, location text, county text, year number ) CREATE TABLE enrollments ( campus number, year number, totalenrollment_ay number, fte_ay number ) CREATE TABLE discipline_enrollments ( campus number, discipline number, year numbe...
In the year 2000, what is the campus fee for San Francisco State University?
SELECT t1.campusfee FROM csu_fees AS t1 JOIN campuses AS t2 ON t1.campus = t2.id WHERE t2.campus = "San Francisco State University" AND t1.year = 2000
spider
CREATE TABLE table_75339 ( "Station" text, "Services" text, "Local authority" text, "Zone 2007" text, "Zone 2008" text, "Zone 2010" text, "Zone 2013" text )
Which Services have a Local authority of chiltern, and a Zone 2010 of 9?
SELECT "Services" FROM table_75339 WHERE "Local authority" = 'chiltern' AND "Zone 2010" = '9'
wikisql
CREATE TABLE table_204_25 ( id number, "rank" number, "mountain peak" text, "mountain range" text, "elevation" text, "prominence" text, "isolation" text, "location" text )
which is taller , mount humphreys or mount kaweah .
SELECT "mountain peak" FROM table_204_25 WHERE "mountain peak" IN ('mount humphreys', 'mount kaweah') ORDER BY "elevation" DESC LIMIT 1
squall
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10), payment_method_description VARCHAR(80) ) CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL...
Show all payment method codes and the number of orders for each code in a bar chart, show by the y axis from low to high please.
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code ORDER BY COUNT(*)
nvbench
CREATE TABLE table_name_28 ( place VARCHAR, player VARCHAR )
What Place has a Player of tony jacklin?
SELECT place FROM table_name_28 WHERE player = "tony jacklin"
sql_create_context
CREATE TABLE table_name_49 ( overall VARCHAR, player VARCHAR )
When was petter ronnquist picked?
SELECT overall FROM table_name_49 WHERE player = "petter ronnquist"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
tell me the total number of patients in the 508 wards since 2102?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.wardid = 508 AND STRFTIME('%y', patient.unitadmittime) >= '2102'
eicu
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...
以往患者79096915门诊诊断呢都有什么?
SELECT mzjzjlb.JZZDBM, mzjzjlb.JZZDSM FROM hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLS...
css
CREATE TABLE table_55855 ( "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 with a crowd relevant to footscray?
SELECT "Crowd" FROM table_55855 WHERE "Home team" = 'footscray'
wikisql
CREATE TABLE table_24603 ( "Week" real, "Date" text, "Opponent" text, "Location" text, "Final Score" text, "Attendance" real, "Record" text )
What was the final score when the game was @ roughriders?
SELECT "Final Score" FROM table_24603 WHERE "Opponent" = '@ Roughriders'
wikisql
CREATE TABLE table_1557974_1 ( ring_name VARCHAR, current_rank VARCHAR )
Which ring names are currently ranked f0 j ry 3 west?
SELECT ring_name FROM table_1557974_1 WHERE current_rank = "f0 Jūryō 3 West"
sql_create_context