context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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...
列出患者苏明知从06年8月16日到2010年2月4日内检测人为14927928的所有检验结果指标记录的检验指数流水编号都是啥?
SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX AND wdmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND wdmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jyb...
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...
自2007-07-22起,到2014-05-11,医疗机构1450643的病人对医疗项目自付比例的平均值是多少
SELECT AVG(t_kc22.SELF_PAY_PRO) FROM qtb JOIN t_kc22 ON qtb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE qtb.MED_SER_ORG_NO = '1450643' AND t_kc22.STA_DATE BETWEEN '2007-07-22' AND '2014-05-11' UNION SELECT AVG(t_kc22.SELF_PAY_PRO) FROM gyb JOIN t_kc22 ON gyb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gyb.MED_SER_ORG_NO ...
css
CREATE TABLE table_name_70 ( losses INTEGER, against INTEGER )
What is the sum of losses for Against values over 1510?
SELECT SUM(losses) FROM table_name_70 WHERE against > 1510
sql_create_context
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wa...
what was patient 006-47576's first prescribed time for 37.5 g tube : glucose 40 % po gel during this month?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-47576')) AND medication.drugname = '37.5 g tube : glucose ...
eicu
CREATE TABLE table_name_55 ( discovery___publication_of_name VARCHAR, fossil_record VARCHAR )
Tell me the discovery/publication for still living
SELECT discovery___publication_of_name FROM table_name_55 WHERE fossil_record = "still living"
sql_create_context
CREATE TABLE table_36652 ( "Pick #" text, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What Nationality has a Position of right wing, with a #20 pick?
SELECT "Nationality" FROM table_36652 WHERE "Position" = 'right wing' AND "Pick #" = '20'
wikisql
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, ...
how many patients whose procedure icd9 code is 8968 and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "8968" AND prescriptions.drug_type = "MAIN"
mimicsql_data
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number,...
List of top-level tags ordered by counts.
SELECT * FROM Tags WHERE ((TagName = 'ag.algebraic-geometry') OR (TagName = 'nt.number-theory')) ORDER BY Count DESC
sede
CREATE TABLE table_6305 ( "Match" real, "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
WHich Match has a Venue of h on 22 september 1888 with Attendances smaller than 4,000?
SELECT MAX("Match") FROM table_6305 WHERE "Venue" = 'h' AND "Date" = '22 september 1888' AND "Attendance" < '4,000'
wikisql
CREATE TABLE table_7364 ( "Vol. #" real, "Title" text, "Material collected" text, "Pages" real, "ISBN" text )
What is the title of the edition with more than 128 pages and a volume # of 5?
SELECT "Title" FROM table_7364 WHERE "Pages" > '128' AND "Vol. #" = '5'
wikisql
CREATE TABLE hz_info_mzjzjlb ( JZLSH number, YLJGDM number, mzjzjlb_id 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, ...
患者83706671的030972指标是什么情况在17年的10月30号到11月23号期间
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb 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.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH ...
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
how many patients whose marital status is divorced and gender is m?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.gender = "M"
mimicsql_data
CREATE TABLE documents_to_be_destroyed ( document_id number, destruction_authorised_by_employee_id number, destroyed_by_employee_id number, planned_destruction_date time, actual_destruction_date time, other_details text ) CREATE TABLE ref_document_types ( document_type_code text, docume...
Show the names of employees with role name Editor.
SELECT T1.employee_name FROM employees AS T1 JOIN roles AS T2 ON T1.role_code = T2.role_code WHERE T2.role_name = "Editor"
spider
CREATE TABLE table_41682 ( "Competition" text, "Total Matches" real, "Cardiff Win" real, "Draw" real, "Swansea Win" real )
How many cardiff wins have a draw greater than 27?
SELECT COUNT("Cardiff Win") FROM table_41682 WHERE "Draw" > '27'
wikisql
CREATE TABLE table_42918 ( "m\u00e5cha" text, "indicative" text, "imperative" text, "subjunctive" text, "inverse subjunctive" text )
With a subjunctive of du m chast what is the imperative?
SELECT "imperative" FROM table_42918 WHERE "subjunctive" = 'du måchast'
wikisql
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Give me the comparison about Team_ID over the ACC_Regular_Season by a bar chart, rank from high to low by the Team_ID.
SELECT ACC_Regular_Season, Team_ID FROM basketball_match ORDER BY Team_ID DESC
nvbench
CREATE TABLE table_20614109_1 ( net_profit__€m_ VARCHAR, earnings_per_share__€_ VARCHAR )
Name the net profit for eps beign 1.19
SELECT net_profit__€m_ FROM table_20614109_1 WHERE earnings_per_share__€_ = "1.19"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
how many days elapsed since patient 25733 received his bicarbonate lab test for the last time during the current hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', labevents.charttime)) FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25733 AND admissi...
mimic_iii
CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text ) CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text )
What is the total number of captains in each rank and class? Let class as X-axis, and categorize by rank with a stacked bar chart, I want to order total number from low to high order please.
SELECT Class, COUNT(Class) FROM captain GROUP BY Rank, Class ORDER BY COUNT(Class)
nvbench
CREATE TABLE table_name_24 ( total INTEGER, silver VARCHAR, bronze VARCHAR, rank VARCHAR )
Name the least total when bronze is less than 2 and rank is more than 2 with silver less than 1
SELECT MIN(total) FROM table_name_24 WHERE bronze < 2 AND rank > 2 AND silver < 1
sql_create_context
CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) CREATE TABLE flight_fare ...
give me flights from SEATTLE to CHICAGO that have meals on CO
SELECT DISTINCT flight_id FROM flight WHERE (((meal_code IN (SELECT FOOD_SERVICEalias0.meal_code FROM food_service AS FOOD_SERVICEalias0) AND to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM ...
atis
CREATE TABLE table_203_457 ( id number, "tramway" text, "country" text, "city" text, "height of pylons" text, "span width,\nleaning straight line" text, "span width,\nhorizontal measurement" text, "height of cable over ground" text, "year of inauguration" number, "notes" text )
how much longer is the peak 2 peak gondola than the 32 aerial tramway ?
SELECT (SELECT "span width,\nleaning straight line" FROM table_203_457 WHERE "tramway" = 'peak 2 peak gondola') - (SELECT "span width,\nleaning straight line" FROM table_203_457 WHERE "tramway" = '3s aerial tramway')
squall
CREATE TABLE table_name_89 ( venue VARCHAR, status VARCHAR, against VARCHAR )
What Venue has a Status of five nations, and Against of 0?
SELECT venue FROM table_name_89 WHERE status = "five nations" AND against = 0
sql_create_context
CREATE TABLE table_67239 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
Name the tournament for march 25, 2012
SELECT "Tournament" FROM table_67239 WHERE "Date" = 'march 25, 2012'
wikisql
CREATE TABLE table_name_9 ( country VARCHAR, singles_champions VARCHAR, tournament VARCHAR )
In what Country will Dennis Bl mke play the Germany F13 Futures Tournament?
SELECT country FROM table_name_9 WHERE singles_champions = "dennis blömke" AND tournament = "germany f13 futures"
sql_create_context
CREATE TABLE Transactions ( transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR(10), date_of_transaction DATETIME, amount_of_transaction DECIMAL(19,4), share_count VARCHAR(40), other_details VARCHAR(255) ) CREATE TABLE Sales ( sales_transaction_id INTEGER, sal...
What are the dates of transactions with at least 100 share count or amount bigger than 100, and count them by a bar chart, and I want to display Y-axis in ascending order.
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count >= 100 OR amount_of_transaction >= 100 ORDER BY COUNT(date_of_transaction)
nvbench
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number,...
what was the first bedside glucose value during the last hospital encounter for patient 028-39354?
SELECT lab.labresult FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-39354' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmit...
eicu
CREATE TABLE table_61517 ( "Region" text, "Date" text, "Label" text, "Format(s)" text, "Catalog" text )
What region is on 11 August 2008?
SELECT "Region" FROM table_61517 WHERE "Date" = '11 august 2008'
wikisql
CREATE TABLE table_40160 ( "Year" real, "Tournaments played" real, "Cuts made" real, "Wins" real, "Best finish" text, "Earnings ( $ )" text, "Scoring average" real )
What is the average number of cuts made when there were more than 2 tournaments played in 2011?
SELECT AVG("Cuts made") FROM table_40160 WHERE "Tournaments played" > '2' AND "Year" = '2011'
wikisql
CREATE TABLE table_24224991_2 ( l INTEGER )
What is the lowest amount of L in any season?
SELECT MIN(l) FROM table_24224991_2
sql_create_context
CREATE TABLE table_15817998_5 ( college VARCHAR, player VARCHAR )
What is the college that Jeffrey Simmer plays for?
SELECT college FROM table_15817998_5 WHERE player = "Jeffrey Simmer"
sql_create_context
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text...
titles with trailing space and duplicate title.
SELECT RTRIM(LOWER(p.Title)) FROM Posts AS p GROUP BY RTRIM(LOWER(p.Title)) HAVING (COUNT(RTRIM(LOWER(p.Title))) > 1) INTERSECT SELECT RTRIM(LOWER(Title)) FROM Posts WHERE DATALENGTH(RTRIM(Title)) != DATALENGTH(Title) AND PostTypeId = 1
sede
CREATE TABLE zyjzjlb_jybgb ( YLJGDM_ZYJZJLB text, BGDH number, YLJGDM number ) 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 n...
列出患者马展鹏被开出的所有检验报告单的检验报告单号有多少在2021-08-09到2021-11-14内?
SELECT jybgb.BGDH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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 WHERE person_info.XM = '马展鹏' AND jybg...
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 ...
tell me the admission time and diagnoses of chandra schulman.
SELECT demographic.admittime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Chandra Schulman"
mimicsql_data
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
在09年1月7日到14年9月23日期间病号陶寒香都有什么检查方法记录在检验结果指标记录中?
(SELECT jyjgzbb.JCFF 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 = jy...
css
CREATE TABLE table_16512 ( "Character" text, "Position" text, "Actor" text, "First Episode" text, "Final Episode" text, "Duration" text, "Final Episode Count" real )
What was the final episode for Dea Agent?
SELECT "Final Episode" FROM table_16512 WHERE "Position" = 'DEA Agent'
wikisql
CREATE TABLE table_name_97 ( laps VARCHAR, grid VARCHAR )
How many laps were in grid 4?
SELECT laps FROM table_name_97 WHERE grid = 4
sql_create_context
CREATE TABLE table_52384 ( "Hand" text, "1 credit" text, "2 credits" text, "3 credits" text, "4 credits" text, "5 credits" text )
What is the 2 credits of a hand that has a 3 credits of 180?
SELECT "2 credits" FROM table_52384 WHERE "3 credits" = '180'
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 prescription...
give me the number of patients whose days of hospital stay is greater than 27 and lab test name is magnesium?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "27" AND lab.label = "Magnesium"
mimicsql_data
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose diagnosis icd9 code is 76519 and drug route is replace.
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 = "76519" AND prescriptions.route = "REPLACE"
mimicsql_data
CREATE TABLE documents ( document_id number, document_type_code text, grant_id number, sent_date time, response_received_date time, other_details text ) CREATE TABLE tasks ( task_id number, project_id number, task_details text, eg agree objectives text ) CREATE TABLE organisati...
How many project staff worked as leaders or started working before '1989-04-24 23:51:54'?
SELECT COUNT(*) FROM project_staff WHERE role_code = 'leader' OR date_from < '1989-04-24 23:51:54'
spider
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar...
An offering of AUTO 513 has been made how many times ?
SELECT COUNT(DISTINCT course_offering.offering_id) FROM course, course_offering WHERE course.course_id = course_offering.course_id AND course.department = 'AUTO' AND course.number = 513
advising
CREATE TABLE table_19706 ( "Prefix size" text, "Network mask" text, "Available subnets" real, "Usable hosts per subnet" real, "Total usable hosts" real )
When the network mask is 255.255.255.224 what is the highest total usable host?
SELECT MAX("Total usable hosts") FROM table_19706 WHERE "Network mask" = '255.255.255.224'
wikisql
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varc...
how many seats in a 100
SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = '100'
atis
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 demographic ...
provide the the number of black/african american patients born before 2076.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2076"
mimicsql_data
CREATE TABLE airports ( city VARCHAR )
List the cities which have more than 2 airports sorted by the number of airports.
SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*)
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...
provide the number of patients whose admission type is urgent and procedure short title is int insert dual-cham dev?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Int insert dual-cham dev"
mimicsql_data
CREATE TABLE member ( Member_ID int, Member_Name text, Party_ID text, In_office text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID int, Event_Name text, P...
Return a pie on how many members are in each party?
SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID
nvbench
CREATE TABLE table_42292 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What the total of Week with attendance of 53,147
SELECT SUM("Week") FROM table_42292 WHERE "Attendance" = '53,147'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
find the number of male patients who have diagnoses icd9 code 70703.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "M" AND diagnoses.icd9_code = "70703"
mimicsql_data
CREATE TABLE table_11763 ( "Name" text, "Location" text, "Elevation + Height" text, "Delivery" text, "Purpose" text, "Yield" text )
Which Purpose has a Name of oak?
SELECT "Purpose" FROM table_11763 WHERE "Name" = 'oak'
wikisql
CREATE TABLE table_204_20 ( id number, "represent" text, "contestant" text, "age" number, "height" text, "hometown" text )
what delegate is the same age as rita elizabeth meda cojul n
SELECT "contestant" FROM table_204_20 WHERE "contestant" <> 'rita elizabeth meda cojulun' AND "age" = (SELECT "age" FROM table_204_20 WHERE "contestant" = 'rita elizabeth meda cojulun')
squall
CREATE TABLE table_14280 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
Who is the opponent at america west arena?
SELECT "Opponent" FROM table_14280 WHERE "Location" = 'america west arena'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
what is the number of patients whose gender is f and admission location is clinic referral/premature?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_location = "CLINIC REFERRAL/PREMATURE"
mimicsql_data
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...
what is the number of days since patient 021-95970 was admitted to the hospital?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', patient.hospitaladmittime)) FROM patient WHERE patient.uniquepid = '021-95970' AND patient.hospitaldischargetime IS NULL
eicu
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
能知道医疗机构8227829金额排在前二十四名的项目吗
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.t_kc21_MED_SER_ORG_NO = '8227829' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY SUM(t_kc22.AMOUNT) DESC LIMIT 24
css
CREATE TABLE people ( people_id number, name text, height number, weight number, home town text ) CREATE TABLE perpetrator ( perpetrator_id number, people_id number, date text, year number, location text, country text, killed number, injured number )
How many perpetrators are there?
SELECT COUNT(*) FROM perpetrator
spider
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
45700133患者被开出过金额不低于9202.16元的药品在哪几次医疗记录中和医疗就诊编号是多少?
SELECT gwyjzb.MED_CLINIC_ID FROM gwyjzb WHERE gwyjzb.PERSON_ID = '45700133' AND gwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT >= 9202.16) UNION SELECT fgwyjzb.MED_CLINIC_ID FROM fgwyjzb WHERE fgwyjzb.PERSON_ID = '45700133' AND fgwyjzb.MED_CLINIC_ID IN (SELECT t_kc22.MED_CLINIC_ID ...
css
CREATE TABLE table_name_6 ( opponent VARCHAR, result VARCHAR )
Who was the opponent with a result of l 14 6?
SELECT opponent FROM table_name_6 WHERE result = "l 14–6"
sql_create_context
CREATE TABLE table_22545 ( "Fuel gas" text, "Upper index Kcal/ Nm 3" real, "Lower index Kcal/ Nm 3" real, "Upper index MJ/ Nm 3" text, "Lower index MJ/ Nm 3" text )
Name the upper index kcal/nm3 for 62.47
SELECT "Upper index Kcal/ Nm 3" FROM table_22545 WHERE "Lower index MJ/ Nm 3" = '62.47'
wikisql
CREATE TABLE table_65826 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
How many silvers have more than 2 golds?
SELECT COUNT("Silver") FROM table_65826 WHERE "Gold" > '2'
wikisql
CREATE TABLE table_3962 ( "Operator" text, "Number purchased" real, "Variant" text, "Bodybuilder" text, "Year(s) purchased" text )
Who is the operator when Roe was the bodybuilder?
SELECT "Operator" FROM table_3962 WHERE "Bodybuilder" = 'Roe'
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 prescription...
what is the number of patients whose drug code is meth10sy and lab test fluid is cerebrospinal fluid (csf)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "METH10SY" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar ) CREATE TABLE category ( id int, business_id varchar, categor...
Find all cities in which there is a restaurant called ' MGM Grand Buffet
SELECT business.city FROM business, category WHERE business.name = 'MGM Grand Buffet' AND category.business_id = business.business_id AND category.category_name = 'restaurant'
yelp
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 ...
tell me the top five most frequent diagnoses for patients of age 40s in the previous year?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN...
mimic_iii
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city var...
Before I take AAS 385 , what other courses do I need to complete ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
advising
CREATE TABLE table_204_997 ( id number, "#" text, "title" text, "celebrity guest(s)" text, "directed by" text, "written by" text, "original airdate" text )
who was the last celebrity guest in the 2010 season ?
SELECT "celebrity guest(s)" FROM table_204_997 WHERE NOT "celebrity guest(s)" IS NULL ORDER BY id DESC LIMIT 1
squall
CREATE TABLE Band ( id VARCHAR ) CREATE TABLE Performance ( stageposition VARCHAR, bandmate VARCHAR )
Find all the stage positions of the musicians with first name 'Solveig
SELECT DISTINCT T1.stageposition FROM Performance AS T1 JOIN Band AS T2 ON T1.bandmate = T2.id WHERE Firstname = "Solveig"
sql_create_context
CREATE TABLE table_name_33 ( density VARCHAR, simplified VARCHAR )
What is the density when simplified shows ?
SELECT density FROM table_name_33 WHERE simplified = "南山区"
sql_create_context
CREATE TABLE table_203_862 ( id number, "draw" number, "artist" text, "song" text, "points" number, "place" text )
how many points does the artist rita have ?
SELECT "points" FROM table_203_862 WHERE "artist" = 'rita'
squall
CREATE TABLE table_35559 ( "Date" text, "Placing" text, "Beat by" text, "Location" text, "Distance" text )
What was the date in which Chic won at CHS?
SELECT "Date" FROM table_35559 WHERE "Beat by" = 'won' AND "Location" = 'chs'
wikisql
CREATE TABLE table_test_16 ( "id" int, "left_ventricular_ejection_fraction_lvef" int, "systolic_blood_pressure_sbp" int, "severe_hypertension" bool, "adrenaline" bool, "stroke" bool, "renal_disease" bool, "severe_uncontrolled_arterial_hypertension" bool, "hepatic_disease" bool, "...
left ventricular ejection fraction less than 40 %
SELECT * FROM table_test_16 WHERE left_ventricular_ejection_fraction_lvef < 40
criteria2sql
CREATE TABLE table_name_47 ( result VARCHAR, date VARCHAR )
What was the result of the game from 10 October 2009?
SELECT result FROM table_name_47 WHERE date = "10 october 2009"
sql_create_context
CREATE TABLE table_45976 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text )
WHAT IS THE APPOINTMENT DATE WITH A PRE-SEASON POSITION, AND REPLACED BY THOMAS THOMASBERG?
SELECT "Date of appointment" FROM table_45976 WHERE "Position in table" = 'pre-season' AND "Replaced by" = 'thomas thomasberg'
wikisql
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phon...
Return a histogram on what are the different transaction types, and how many transactions of each have taken place?, display total number from low to high order.
SELECT transaction_type, COUNT(*) FROM Financial_Transactions GROUP BY transaction_type ORDER BY COUNT(*)
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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
how many female patients use the drug code thor25?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.formulary_drug_cd = "THOR25"
mimicsql_data
CREATE TABLE table_25413 ( "Year" real, "Majors" real, "ATP wins" real, "Total wins" real, "Earnings ($)" real, "Money list rank" real )
How many years had a total earnings amount of 2254598?
SELECT COUNT("Year") FROM table_25413 WHERE "Earnings ($)" = '2254598'
wikisql
CREATE TABLE table_55389 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
What is the home team of the game where New Jersey was the visitor team and the record was 11-35-12?
SELECT "Home" FROM table_55389 WHERE "Visitor" = 'new jersey' AND "Record" = '11-35-12'
wikisql
CREATE TABLE Institution ( Institution_id text, Institution text, Location text, Founded real, Type text, Enrollment int, Team text, Primary_Conference text, building_id text ) CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real...
Show the names and heights of buildings with at least two institutions founded after 1880 Plot them as bar chart, and order by the bar from low to high.
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 ORDER BY Name
nvbench
CREATE TABLE table_5963 ( "Callsign" text, "Area served" text, "Frequency" text, "Band" text, "On-air ID" text, "Purpose" text )
Frequency of 100.1 has what on-air id?
SELECT "On-air ID" FROM table_5963 WHERE "Frequency" = '100.1'
wikisql
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperfield ( fieldid int, ...
acl papers in 2016 about Semantic Parsing
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase, venue WHERE keyphrase.keyphrasename = 'Semantic Parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year = 2016 AND venue.venueid = paper.venueid AND venue.venuename = 'acl'
scholar
CREATE TABLE table_59455 ( "Name" text, "Circuit" text, "Date" text, "Winning driver" text, "Winning constructor" text, "Report" text )
Name the Winning constructor on 31 may and a Circuit of madonie?
SELECT "Winning constructor" FROM table_59455 WHERE "Date" = '31 may' AND "Circuit" = 'madonie'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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 jobs ( JOB_ID varchar(10), JOB_...
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the trend about employee_id over hire_date , rank by the x axis in asc.
SELECT HIRE_DATE, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_221653_1 ( partial_thromboplastin_time VARCHAR, prothrombin_time VARCHAR, bleeding_time VARCHAR )
What is the result for partial thromboplastin time when prothrombin time and bleeding time are prolonged?
SELECT partial_thromboplastin_time FROM table_221653_1 WHERE prothrombin_time = "Prolonged" AND bleeding_time = "Prolonged"
sql_create_context
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, C...
在医院4072141中给患者74583279开出的单价最高的药品编号都是?药品名称都叫什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM, t_kc22.UNIVALENT 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_ID = '74583279' AND t_kc21.MED_SER_ORG_NO = '4072141') ORDER BY t_kc22.UNIVALENT DESC LIMIT 1
css
CREATE TABLE table_1342256_40 ( first_elected VARCHAR, district VARCHAR )
What is the first elected for south carolina 4?
SELECT first_elected FROM table_1342256_40 WHERE district = "South Carolina 4"
sql_create_context
CREATE TABLE table_58689 ( "Stage" text, "Winner" text, "General classification" text, "Mountains classification" text, "Points classification" text, "Team Classification" text )
What general classification has levi leipheimer as points classification?
SELECT "General classification" FROM table_58689 WHERE "Points classification" = 'levi leipheimer'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY...
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 sum of manager_id over the job_id , and group by attribute job_id by a bar chart, could you show in desc by the x axis please?
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_name_25 ( opponent VARCHAR, result VARCHAR )
What opponent has a Result of w 31 0?
SELECT opponent FROM table_name_25 WHERE result = "w 31–0"
sql_create_context
CREATE TABLE table_49671 ( "Season" real, "Series" text, "Team" text, "Races" real, "Wins" real, "Poles" real, "FLaps" real, "Podiums" real, "Points" real, "Position" text )
Which team after 2008, with less than 2 podium finished and more than 0 FLAPS, had the lowest numberof races?
SELECT MIN("Races") FROM table_49671 WHERE "Podiums" < '2' AND "FLaps" > '0' AND "Season" > '2008'
wikisql
CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId numb...
Questions answered by me without an accepted answer, with only one answer.
SELECT q.Id AS "post_link", a.CreationDate FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id WHERE a.OwnerUserId = '##UserId##' AND q.AnswerCount = 1 AND q.AcceptedAnswerId IS NULL
sede
CREATE TABLE table_name_42 ( to_par VARCHAR, player VARCHAR )
What is the to par for Gene Littler?
SELECT to_par FROM table_name_42 WHERE player = "gene littler"
sql_create_context
CREATE TABLE Bookings ( Booking_ID INTEGER, Customer_ID INTEGER, Workshop_Group_ID VARCHAR(100), Status_Code CHAR(15), Store_ID INTEGER, Order_Date DATETIME, Planned_Delivery_Date DATETIME, Actual_Delivery_Date DATETIME, Other_Order_Details VARCHAR(255) ) CREATE TABLE Invoices ( ...
Show all payment method codes and the number of orders for each code Show bar chart, display in ascending by the names.
SELECT payment_method_code, COUNT(*) FROM Invoices GROUP BY payment_method_code ORDER BY payment_method_code
nvbench
CREATE TABLE table_57052 ( "Round" real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
I want the fastest lap for round of 16
SELECT "Fastest Lap" FROM table_57052 WHERE "Round" = '16'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_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 time, itemid number, ...
what is the daily average of sao2 for patient 17694?
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17694)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2...
mimic_iii
CREATE TABLE table_name_55 ( population_millions INTEGER, influence VARCHAR )
What is the highest population in the millions that has an influence of 1.02?
SELECT MAX(population_millions) FROM table_name_55 WHERE influence = 1.02
sql_create_context
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, sh...
on 10/25/this year, when was the last time that patient 433 had a arterial bp [systolic] measured?
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 433)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial b...
mimic_iii
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
when was patient 025-5271 last having the minimum hct level since 108 months ago?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-5271')) AND lab.labname = 'hct' AND DATETIME(lab.labresulttime) >= DATETIME(CUR...
eicu
CREATE TABLE table_name_55 ( opponent_in_final VARCHAR, surface VARCHAR )
Who was the opponent on carpet in a final?
SELECT opponent_in_final FROM table_name_55 WHERE surface = "carpet"
sql_create_context
CREATE TABLE table_64248 ( "Year" real, "Title" text, "Director" text, "Studio(s)" text, "Notes" text )
What studio did Paul Greengrass direct in 2007?
SELECT "Studio(s)" FROM table_64248 WHERE "Year" = '2007' AND "Director" = 'paul greengrass'
wikisql