context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE T...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of email and manager_id , and show by the y axis in desc.
SELECT EMAIL, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY MANAGER_ID DESC
nvbench
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
let me know the number of patients on ih route of drug administration who have diagnoses icd9 code 81201.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "81201" AND prescriptions.route = "IH"
mimicsql_data
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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype tex...
how many coronar arteriogr-1 cath procedures has been performed until 2 years ago?
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 = 'coronar arteriogr-1 cath') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-2 year')
mimic_iii
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTas...
Number of Posts by Number of Users.
SELECT Posts, COUNT(*) AS Qty FROM (SELECT OwnerUserId, COUNT(OwnerUserId) AS Posts FROM Posts AS P WHERE P.PostTypeId = 1 OR P.PostTypeId = 2 GROUP BY OwnerUserId) AS SUB WHERE Posts > 0 GROUP BY Posts ORDER BY Posts
sede
CREATE TABLE mzb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
医院6176731一共诊治过多少住院病人,在09-12-18到11-08-05这期间
SELECT COUNT(*) FROM zyb WHERE zyb.MED_TYPE = '6176731' AND zyb.IN_HOSP_DAYS BETWEEN '2009-12-18' AND '2011-08-05'
css
CREATE TABLE table_21497 ( "Season" text, "Games" real, "GS" real, "Points" text, "Rebounds" text, "Assists" text, "Blocks" text, "Steals" text, "Turnovers" text )
Name the assists for 157 games
SELECT "Assists" FROM table_21497 WHERE "Games" = '157'
wikisql
CREATE TABLE table_name_51 ( fcc_info VARCHAR, city_of_license VARCHAR )
What is the FCC info of the translator with an Irmo, South Carolina city license?
SELECT fcc_info FROM table_name_51 WHERE city_of_license = "irmo, south carolina"
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...
患者奚嘉珍的游离前列腺特异性抗原在09年6月17日到17年5月2日的这段时间情况咋样啊?
SELECT * FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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 = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM...
css
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) 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, H...
那些年龄不超过16岁的患者的医疗记录中其平均的医疗费一共是多少钱?
SELECT AVG(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_AGE <= 16)
css
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_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 countries ( COUNTRY...
Compare the total salary by each hire date (bin it into month interval) of employees using a bar chart, and show in ascending by the total number.
SELECT HIRE_DATE, SUM(SALARY) FROM employees ORDER BY SUM(SALARY)
nvbench
CREATE TABLE table_name_50 ( losses VARCHAR, goals_for VARCHAR, team VARCHAR )
What is the total number of losses for the Team of Montreal with Goals For larger than 29?
SELECT COUNT(losses) FROM table_name_50 WHERE goals_for > 29 AND team = "montreal"
sql_create_context
CREATE TABLE table_12526990_1 ( gayndah INTEGER, perry VARCHAR )
What is the gayndah when perry is 304?
SELECT MAX(gayndah) FROM table_12526990_1 WHERE perry = 304
sql_create_context
CREATE TABLE table_24224647_2 ( main_presenter VARCHAR, region_country VARCHAR )
Who is every main presenter for the Estonia region/country?
SELECT main_presenter FROM table_24224647_2 WHERE region_country = "Estonia"
sql_create_context
CREATE TABLE table_48596 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
What was the resolution of the fight against steve schneider?
SELECT "Res." FROM table_48596 WHERE "Opponent" = 'steve schneider'
wikisql
CREATE TABLE table_16857_2 ( mls_cup_playoffs VARCHAR, concacaf_champions_cup___champions_league VARCHAR, us_open_cup VARCHAR )
How did the team place when they did not qualify for the Concaf Champions Cup but made it to Round of 16 in the U.S. Open Cup?
SELECT mls_cup_playoffs FROM table_16857_2 WHERE concacaf_champions_cup___champions_league = "Did not qualify" AND us_open_cup = "Round of 16"
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...
provide the number of patients whose diagnoses long title is insomnia, unspecified and drug type is additive?
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.long_title = "Insomnia, unspecified" AND prescriptions.drug_type = "ADDITIVE"
mimicsql_data
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester i...
Inform me of what 's needed for a CS-LSA degree .
SELECT DISTINCT program_requirement.additional_req, program_requirement.category, program_requirement.min_credit, program.name FROM program, program_requirement WHERE program.name LIKE '%CS-LSA%' AND program.program_id = program_requirement.program_id
advising
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_DIRE_CD text, MED_DIRE_NM text,...
医疗机构的哪个科室是负责医疗就诊29957080275中费用明细项目71120230685的,把科室的编码和名称找出来
SELECT t_kc22.MED_ORG_DEPT_CD, t_kc22.MED_ORG_DEPT_NM FROM t_kc22 WHERE t_kc22.MED_EXP_DET_ID = '71120230685'
css
CREATE TABLE table_29584 ( "Represent" real, "Contestant" text, "Age" real, "Sizes" text, "Height" text, "Hometown" text, "Agency" text )
who are the participants that wear clothing in 33-23-36
SELECT "Contestant" FROM table_29584 WHERE "Sizes" = '33-23-36'
wikisql
CREATE TABLE table_23987362_2 ( world_record VARCHAR )
How many of 3:26.00 have a championship record?
SELECT COUNT(3) AS :2600 FROM table_23987362_2 WHERE world_record = "Championship record"
sql_create_context
CREATE TABLE table_name_61 ( play VARCHAR, company VARCHAR )
what is the play when the company is cyprus theatre organisation?
SELECT play FROM table_name_61 WHERE company = "cyprus theatre organisation"
sql_create_context
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )...
Short comment with thanks askdiff.
SELECT 'https://apple.stackexchange.com/questions/' + CAST(PostId AS TEXT), Text, Score, Comments.CreationDate, Users.DisplayName, Users.Reputation FROM Comments INNER JOIN Users ON Comments.UserId = Users.Id WHERE LENGTH(Text) < 20 AND (Text LIKE '%thanks%' OR Text LIKE '%welcome%' OR Text LIKE '%works%') ORDER BY Cre...
sede
CREATE TABLE table_14050 ( "Event" text, "Record" text, "Nationality" text, "Date" text, "Games" text )
What's the record of Barbados?
SELECT "Record" FROM table_14050 WHERE "Nationality" = 'barbados'
wikisql
CREATE TABLE table_name_65 ( part_4 VARCHAR, part_2 VARCHAR )
What is Part 4, when Part 2 is 'hlj p'?
SELECT part_4 FROM table_name_65 WHERE part_2 = "hljóp"
sql_create_context
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, ...
what airlines have BUSINESS class
SELECT DISTINCT airline.airline_code FROM airline, fare, fare_basis, flight, flight_fare WHERE fare_basis.class_type = 'BUSINESS' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.airline_code = airline.airline_code AND flight.flight_id = flight_fare.flight_id
atis
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 prescriptions...
find the name of subject id 65652.
SELECT demographic.name FROM demographic WHERE demographic.subject_id = "65652"
mimicsql_data
CREATE TABLE fires ( fire_year number, discovery_date number, discovery_doy number, discovery_time text, stat_cause_code number, stat_cause_descr text, cont_date text, cont_doy text, cont_time text, fire_size number, fire_size_class text, latitude number, longitude nu...
Show all fires caused by campfires in Texas.
SELECT * FROM fires WHERE state = "TX" AND stat_cause_descr LIKE "Campfire"
uswildfires
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, ...
号码是40176918的病人在2002年8月23日到2002年12月5日期间所使用的药品其编码、名称、数量、单价、金额都是什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.QTY, t_kc22.UNIVALENT, t_kc22.AMOUNT FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.PERSON_ID = '40176918' AND gwyjzb.IN_HOSP_DATE BETWEEN '2002-08-23' AND '2002-12-05' UNION SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_...
css
CREATE TABLE mzb ( CLINIC_ID text, COMP_ID text, DATA_ID text, DIFF_PLACE_FLG number, FERTILITY_STS number, FLX_MED_ORG_ID text, HOSP_LEV number, HOSP_STS number, IDENTITY_CARD text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, INSU_TYPE text, IN...
找出在一零年十二月二十七号到二一年十二月六号这些年里患者92724967在医院4295408开的所有药的编码和药名
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT qtb.MED_CLINIC_ID FROM qtb WHERE qtb.PERSON_ID = '92724967' AND qtb.MED_SER_ORG_NO = '4295408' AND qtb.IN_HOSP_DATE BETWEEN '2010-12-27' AND '2021-12-06' UNION SELECT gyb.MED_CLINIC_ID FROM gyb WHERE gyb.PERSON_ID = ...
css
CREATE TABLE table_15430606_1 ( no_disc INTEGER, directed_by VARCHAR )
Name the maximum number of disc for bill gereghty
SELECT MAX(no_disc) FROM table_15430606_1 WHERE directed_by = "Bill Gereghty"
sql_create_context
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
how many patients got dialysis access surgery two times during the previous year?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, COUNT(*) AS c1 FROM patient WHERE patient.patientunitstayid = (SELECT treatment.patientunitstayid FROM treatment WHERE treatment.treatmentname = 'dialysis access surgery' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(),...
eicu
CREATE TABLE table_4216 ( "Skip (Club)" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real )
When 52 is the ends won what is the skip(club)?
SELECT "Skip (Club)" FROM table_4216 WHERE "Ends Won" = '52'
wikisql
CREATE TABLE table_name_14 ( date VARCHAR, home_team VARCHAR )
Name the Home team of tranmere rovers?
SELECT date FROM table_name_14 WHERE home_team = "tranmere rovers"
sql_create_context
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
对于被门诊诊断为疾病号码E70.881的人来说甲胎蛋白的参考值范畴下限和上限为多少?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM mzjzjlb JOIN jybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'E70.881' AND jyjgzbb.JCZBMC = '甲胎蛋白'
css
CREATE TABLE table_33202 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Team Nickname" text )
The school nicknamed the wildcats has what sum of enrollment?
SELECT SUM("Enrollment") FROM table_33202 WHERE "Team Nickname" = 'wildcats'
wikisql
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...
有什么设备编码和仪器编号记录在检验结果指标49153085887中名称都是什么?
SELECT SBBM, YQBH, YQMC FROM jyjgzbb WHERE JYZBLSH = '49153085887'
css
CREATE TABLE table_63669 ( "School" text, "City" text, "Team Name" text, "Enrollment 08-09" real, "IHSAA Class" text, "IHSAA Class Football" text, "County" text, "Year Joined (Or Joining)" real, "Previous Conference" text )
What was the total enrollment 08-09 of Franklin County?
SELECT COUNT("Enrollment 08-09") FROM table_63669 WHERE "School" = 'franklin county'
wikisql
CREATE TABLE table_name_33 ( format VARCHAR, country VARCHAR, label VARCHAR, catalogue_number_s_ VARCHAR )
Which Format has a Label of eagle eye media, a Catalogue number(s) of , and a Country of united states?
SELECT format FROM table_name_33 WHERE label = "eagle eye media" AND catalogue_number_s_ = "—" AND country = "united states"
sql_create_context
CREATE TABLE table_77831 ( "Name" text, "Date of Birth" text, "Date of Death" text, "Age at Time of Disaster" text, "Age at Time of Death" text )
When did the person born 24 September 1851 pass away?
SELECT "Date of Death" FROM table_77831 WHERE "Date of Birth" = '24 september 1851'
wikisql
CREATE TABLE table_name_55 ( solvent VARCHAR, boiling_point VARCHAR )
What solvent has a boiling point of 100 103 c?
SELECT solvent FROM table_name_55 WHERE boiling_point = "100–103 °c"
sql_create_context
CREATE TABLE table_name_97 ( opponent VARCHAR, score VARCHAR )
Who was the opponent with a score of 141 102?
SELECT opponent FROM table_name_97 WHERE score = "141–102"
sql_create_context
CREATE TABLE table_name_83 ( class VARCHAR, number_in_class INTEGER )
Which class has more than 15 people in the class?
SELECT class FROM table_name_83 WHERE number_in_class > 15
sql_create_context
CREATE TABLE table_name_92 ( time_retired VARCHAR, driver VARCHAR )
What is the time/retired for thierry boutsen?
SELECT time_retired FROM table_name_92 WHERE driver = "thierry boutsen"
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...
how many patients aged below 83 years had the drug code albu5250?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "83" AND prescriptions.formulary_drug_cd = "ALBU5250"
mimicsql_data
CREATE TABLE table_37191 ( "Name" text, "Type" text, "Entered service" text, "Water depth" text, "Location" text, "Customer" text )
What is the name of the location and ship type in the Gulf of Mexico that entered service in 1999?
SELECT "Name" FROM table_37191 WHERE "Location" = 'gulf of mexico' AND "Type" = 'ship' AND "Entered service" = '1999'
wikisql
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 demographic (...
provide the number of patients whose item id is 51214 and lab test abnormal status is delta.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51214" AND lab.flag = "delta"
mimicsql_data
CREATE TABLE table_19026 ( "Rank" real, "Airport" text, "Total Passengers" real, "% Change 2005/2006" text, "International Passengers" real, "Domestic Passengers" real, "Transit Passengers" real, "Aircraft Movements" real, "Freight (Metric Tonnes)" real )
how many airport with rank being 4
SELECT COUNT("Airport") FROM table_19026 WHERE "Rank" = '4'
wikisql
CREATE TABLE table_31535 ( "Player" text, "Nationality" text, "Position" text, "Years in Toronto" text, "School/Club Team" text )
What year is United States school/club team from Arkansas play in Toronto
SELECT "Years in Toronto" FROM table_31535 WHERE "Nationality" = 'united states' AND "School/Club Team" = 'arkansas'
wikisql
CREATE TABLE table_49635 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
Which home team played against Los Angeles in game 1?
SELECT "Home Team" FROM table_49635 WHERE "Road Team" = 'los angeles' AND "Game" = 'game 1'
wikisql
CREATE TABLE table_1341586_26 ( candidates VARCHAR, district VARCHAR )
Which candidates are from the Missouri 3 district?
SELECT candidates FROM table_1341586_26 WHERE district = "Missouri 3"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is maximum age of patients whose admission type is urgent and insurance is government?
SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.insurance = "Government"
mimicsql_data
CREATE TABLE nuclear_power_plants ( id text, name text, latitude text, longitude text, country text, status text, reactortype text, reactormodel text, constructionstartat text, operationalfrom text, operationalto text, capacity text, lastupdatedat text, source tex...
What are the top 10 countries with most number of operational plants?
SELECT country FROM nuclear_power_plants WHERE status = "Operational" GROUP BY country ORDER BY COUNT(name) DESC LIMIT 10
geonucleardata
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 medication ( medication...
has patient 006-205326 undergone any medical procedure in a year before?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-205326')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATET...
eicu
CREATE TABLE table_2004 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Year Joined" real, "Nickname" text, "Conference" text )
How many University founded in 1863?
SELECT COUNT("Enrollment") FROM table_2004 WHERE "Founded" = '1863'
wikisql
CREATE TABLE table_name_4 ( quantity_rebuilt VARCHAR, type VARCHAR, railway_number_s_ VARCHAR )
What is the total of quantity rebuilt if the type is 1B N2T and the railway number is 88, 118?
SELECT COUNT(quantity_rebuilt) FROM table_name_4 WHERE type = "1b n2t" AND railway_number_s_ = "88, 118"
sql_create_context
CREATE TABLE employment ( Company_ID int, People_ID int, Year_working int ) CREATE TABLE people ( People_ID int, Age int, Name text, Nationality text, Graduation_College text ) CREATE TABLE company ( Company_ID real, Name text, Headquarters text, Industry text, Sale...
What is the number of companies for each headquarter? Visualize by bar chart, and could you order by the total number in ascending?
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters)
nvbench
CREATE TABLE train ( train_number VARCHAR, name VARCHAR, TIME VARCHAR )
show all train numbers and names ordered by their time from early to late.
SELECT train_number, name FROM train ORDER BY TIME
sql_create_context
CREATE TABLE table_66788 ( "Rank" text, "Goals" text, "Player" text, "Club" text, "Season" text )
What club scored 143 goals?
SELECT "Club" FROM table_66788 WHERE "Goals" = '143'
wikisql
CREATE TABLE table_73910 ( "Institution" text, "Location (all in Ohio)" text, "Nickname" text, "Founded" real, "Type" text, "Enrollment" text, "Joined" real, "Left" real, "Current Conference" text )
Which year did enrolled Gambier members leave?
SELECT MIN("Left") FROM table_73910 WHERE "Location (all in Ohio)" = 'Gambier'
wikisql
CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER, Address_ID INTEGER, Currency_Code CHAR(15), Marketing_Region_Code CHAR(15), Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Customer_Orders ( ...
A bar chart for giveing me the number of the descriptions of the service types that cost more than 100, and sort x-axis from high to low order please.
SELECT Service_Type_Description, COUNT(Service_Type_Description) FROM Ref_Service_Types AS T1 JOIN Services AS T2 ON T1.Service_Type_Code = T2.Service_Type_Code WHERE T2.Product_Price > 100 GROUP BY Service_Type_Description ORDER BY Service_Type_Description DESC
nvbench
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
how many patients are admitted in clinic referral/premature and diagnosed with primary disease left femur fracture?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "LEFT FEMUR FRACTURE"
mimicsql_data
CREATE TABLE table_test_5 ( "id" int, "systemic_lupus_erythematosus" bool, "anemia" bool, "gender" string, "pregnancy_or_lactation" bool, "serum_potassium" float, "hemoglobin_a1c_hba1c" float, "heart_disease" bool, "renal_disease" bool, "creatinine_clearance_cl" float, "estim...
severe renal, lung and liver disease
SELECT * FROM table_test_5 WHERE renal_disease = 1 OR lung_disease = 1 OR liver_disease = 1
criteria2sql
CREATE TABLE festival_detail ( festival_id number, festival_name text, chair_name text, location text, year number, num_of_audience number ) CREATE TABLE artwork ( artwork_id number, type text, name text ) CREATE TABLE nomination ( artwork_id number, festival_id number, ...
Show the names of artworks in ascending order of the year they are nominated in.
SELECT T2.name FROM nomination AS T1 JOIN artwork AS T2 ON T1.artwork_id = T2.artwork_id JOIN festival_detail AS T3 ON T1.festival_id = T3.festival_id ORDER BY T3.year
spider
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varcha...
For those employees who was hired before 2002-06-21, for commission_pct, hire_date, visualize the trend.
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21'
nvbench
CREATE TABLE table_30682 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text )
What is the title of the episode watched by 0.88 million U.S. viewers?
SELECT "Title" FROM table_30682 WHERE "U.S. viewers (million)" = '0.88'
wikisql
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, ...
what is the drug that patient 54386 was prescribed with within 2 days after having undergone entral infus nutrit sub on the last hospital encounter?
SELECT t2.drug FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 54386 AND procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = ...
mimic_iii
CREATE TABLE table_16857 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years for Jazz" text, "School/Club Team" text )
Who are the players that played for the jazz from 1979-86
SELECT "Player" FROM table_16857 WHERE "Years for Jazz" = '1979-86'
wikisql
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insuranc...
what would be the maximum daily number of patients diagnosed with fall from chair in this year?
SELECT MAX(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 = 'fall from chair') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 's...
mimic_iii
CREATE TABLE table_203_3 ( id number, "province" text, "capital" text, "population" number, "density" text, "municipalities" text, "legal districts" number )
how many municipalities exist in the province of cadiz ?
SELECT "municipalities" FROM table_203_3 WHERE "province" = 'cadiz'
squall
CREATE TABLE table_55864 ( "CERCLIS ID" text, "Name" text, "County" text, "Proposed" text, "Listed" text, "Construction completed" text, "Partially deleted" text, "Deleted" text )
In what county is the entry that has a Construction Completed date of 07/19/2000 and a Listed date of 09/21/1984 located?
SELECT "County" FROM table_55864 WHERE "Listed" = '09/21/1984' AND "Construction completed" = '07/19/2000'
wikisql
CREATE TABLE table_name_1 ( player VARCHAR, score VARCHAR, place VARCHAR )
What is the T4 Place Player with a Score of more than 66?
SELECT player FROM table_name_1 WHERE score > 66 AND place = "t4"
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
查查编号85275083957的费用明细项目的处方号和处方流水号,就是67150997441的那次医疗就诊
SELECT PRESCRIPTION_CODE, PRESCRIPTION_ID FROM t_kc22 WHERE MED_EXP_DET_ID = '85275083957'
css
CREATE TABLE table_45893 ( "Technology" text, "\u03b7 (%)" real, "V OC (V)" text, "I SC (A)" text, "W/m\u00b2" text, "t (\u00b5m)" real )
What is the sum of t ( m), when Technology is MJ?
SELECT SUM("t (\u00b5m)") FROM table_45893 WHERE "Technology" = 'mj'
wikisql
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 do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of email and employee_id , order y-axis from high to low order.
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMPLOYEE_ID DESC
nvbench
CREATE TABLE table_204_374 ( id number, "event" text, "gold" number, "silver" number, "bronze" number, "total" number, "ranking" text )
the 1984 paralympics had a total ranking of 5th , in what other year did the ranking fall above 6th ?
SELECT "event" FROM table_204_374 WHERE "event" <> '1984 winter paralympics' AND "ranking" < 6
squall
CREATE TABLE table_name_15 ( home_team VARCHAR, venue VARCHAR )
What was the home team that played at Corio Oval?
SELECT home_team FROM table_name_15 WHERE venue = "corio oval"
sql_create_context
CREATE TABLE table_52127 ( "Country" text, "Date" text, "Label" text, "Format" text, "Catalogue" text )
What was the Date of Country of United States?
SELECT "Date" FROM table_52127 WHERE "Country" = 'united states'
wikisql
CREATE TABLE table_69466 ( "Ranking" real, "Nationality" text, "Name" text, "Years" text, "Goals" real )
What is the lowest ranking for Paul Mctiernan?
SELECT MIN("Ranking") FROM table_69466 WHERE "Name" = 'paul mctiernan'
wikisql
CREATE TABLE table_34672 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" text, "Best" real )
What is the best time for marcus marshall?
SELECT AVG("Best") FROM table_34672 WHERE "Name" = 'marcus marshall'
wikisql
CREATE TABLE table_name_68 ( crowd INTEGER, away_team VARCHAR )
In games where st kilda was the away team, what was the smallest crowd?
SELECT MIN(crowd) FROM table_name_68 WHERE away_team = "st kilda"
sql_create_context
CREATE TABLE table_72380 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
Name the districk for larry mcdonald
SELECT "District" FROM table_72380 WHERE "Incumbent" = 'Larry McDonald'
wikisql
CREATE TABLE table_203_862 ( id number, "draw" number, "artist" text, "song" text, "points" number, "place" text )
what is the name of the first song listed on this chart ?
SELECT "song" FROM table_203_862 WHERE id = 1
squall
CREATE TABLE table_47758 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
On what Date was the Result of the game W 30 15?
SELECT "Date" FROM table_47758 WHERE "Result" = 'w 30–15'
wikisql
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 ( ...
calculate the maximum age of married patients who are aged 45 years or more.
SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "45"
mimicsql_data
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Facilities ( apt_id I...
A bar chart for what are the number of the facility codes of the apartments with more than four bedrooms?, and sort in ascending by the the number of facility code.
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code)
nvbench
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId nu...
questions only tagged with merge.
SELECT Id AS "post_link" FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '<cognito-forms>'
sede
CREATE TABLE table_name_99 ( location VARCHAR, method VARCHAR, res VARCHAR )
Which Location has a Method of decision (unanimous), and Res of win x?
SELECT location FROM table_name_99 WHERE method = "decision (unanimous)" AND res = "win x"
sql_create_context
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, ins...
How many classes in the Fall and Winter term are 500 -level classes ?
SELECT COUNT(DISTINCT course.course_id, semester.semester) FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'department0' AND course.number BETWEEN 500 AND 500 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_offering.semester...
advising
CREATE TABLE table_44420 ( "q > 1" real, "q > 1.05" real, "q > 1.1" real, "q > 1.2" real, "q > 1.3" real, "q > 1.4" real )
What is the sum of q > 1 when q > 1.05 is bigger than 18,233, and a q > 1.4 less than 112, and q > 1.1 is 13,266?
SELECT COUNT("q > 1") FROM table_44420 WHERE "q > 1.05" > '18,233' AND "q > 1.4" < '112' AND "q > 1.1" = '13,266'
wikisql
CREATE TABLE table_8026 ( "World Record" text, "Press" text, "92.5" text, "Hans W\u00f6lpert" text, "Mannheim ( GER )" text )
Which 92.5 holds the world record?
SELECT "World Record" FROM table_8026 WHERE "Press" = '92.5'
wikisql
CREATE TABLE Physician ( EmployeeID INTEGER, Name VARCHAR(30), Position VARCHAR(30), SSN INTEGER ) CREATE TABLE On_Call ( Nurse INTEGER, BlockFloor INTEGER, BlockCode INTEGER, OnCallStart DATETIME, OnCallEnd DATETIME ) CREATE TABLE Appointment ( AppointmentID INTEGER, Patie...
A bar chart for listing the number of the names of patients who have made appointments, I want to display x-axis in desc order.
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name ORDER BY Name DESC
nvbench
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 varc...
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, find hire_date and the amount of hire_date bin hire_date by time, and visualize them by a bar chart.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
nvbench
CREATE TABLE table_58137 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What date was the crowd larger than 16,000 people and the away team scored 8.11 (59)?
SELECT "Date" FROM table_58137 WHERE "Crowd" > '16,000' AND "Away team score" = '8.11 (59)'
wikisql
CREATE TABLE table_name_89 ( region VARCHAR, catalog VARCHAR )
What is the Region with a Catalog of alca-487?
SELECT region FROM table_name_89 WHERE catalog = "alca-487"
sql_create_context
CREATE TABLE table_name_19 ( original_channel VARCHAR, programme VARCHAR )
Which channel did Going for Gold air on?
SELECT original_channel FROM table_name_19 WHERE programme = "going for gold"
sql_create_context
CREATE TABLE table_name_15 ( bronze INTEGER, total INTEGER )
Which Bronze has a Total smaller than 1?
SELECT AVG(bronze) FROM table_name_15 WHERE total < 1
sql_create_context
CREATE TABLE table_31824 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Venue" text, "Attendance" real, "Record" text )
Tell mem the opponent for result of w 31-21
SELECT "Opponent" FROM table_31824 WHERE "Result" = 'w 31-21'
wikisql
CREATE TABLE table_name_60 ( played INTEGER, lost VARCHAR, drawn VARCHAR, difference VARCHAR )
What is the highest played that has a drawn less than 9, 36 as the difference, with a lost greater than 7?
SELECT MAX(played) FROM table_name_60 WHERE drawn < 9 AND difference = "36" AND lost > 7
sql_create_context
CREATE TABLE table_22032599_1 ( result VARCHAR, film_title_used_in_nomination VARCHAR )
What was the result for City of the Sun?
SELECT result FROM table_22032599_1 WHERE film_title_used_in_nomination = "City of the Sun"
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 ) ...
what is the number of patients whose gender is m and year of birth is less than 2060?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.dob_year < "2060"
mimicsql_data