context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_204_883 ( id number, "pos." text, "name" text, "place of birth" text, "date of birth" text, "previous club" text, "date joined" text, "fee" text )
is arthur kaye older or younger than brian hill ?
SELECT (SELECT "date of birth" FROM table_204_883 WHERE "name" = 'arthur kaye') < (SELECT "date of birth" FROM table_204_883 WHERE "name" = 'brian hall')
squall
CREATE TABLE person_info ( RYBH text, XBDM number, XBMC text, XM text, CSRQ time, CSD text, MZDM text, MZMC text, GJDM text, GJMC text, JGDM text, JGMC text, XLDM text, XLMC text, ZYLBDM text, ZYMC text ) CREATE TABLE jybgb ( YLJGDM text, YLJGDM_M...
看看这个门诊的中医诊断编码是什么?就是37329151718的哪个住院就诊
SELECT MZZYZDZZBM FROM zyjzjlb WHERE JZLSH = '37329151718'
css
CREATE TABLE table_name_44 ( laps VARCHAR, grid VARCHAR )
How many laps were there with #9 grid?
SELECT COUNT(laps) FROM table_name_44 WHERE grid = 9
sql_create_context
CREATE TABLE table_14562722_1 ( directed_by VARCHAR, written_by VARCHAR )
Who directed all the episodes that were written by aaron ehasz & john o'bryan?
SELECT directed_by FROM table_14562722_1 WHERE written_by = "Aaron Ehasz & John O'Bryan"
sql_create_context
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 ...
Get me the number of patients who had urgent hospital admission along with a creatinine lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Creatinine"
mimicsql_data
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,...
褚欣合这位参保人从0五年十二月三日到一六年十月十九日,门诊开出的手术总共有多少金额
SELECT SUM(t_kc22.AMOUNT) FROM t_kc21 JOIN t_kc22 JOIN t_kc21_t_kc22 ON t_kc21.MED_CLINIC_ID = t_kc21_t_kc22.MED_CLINIC_ID AND t_kc21_t_kc22.MED_EXP_DET_ID = t_kc22.MED_EXP_DET_ID WHERE t_kc21.PERSON_NM = '褚欣合' AND t_kc21.CLINIC_TYPE = '门诊' AND t_kc22.STA_DATE BETWEEN '2005-12-03' AND '2016-10-19' AND t_kc22.MED_INV_IT...
css
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Questions with one tag and all-lowercase title.
SELECT Id AS "post_link", Score, AnswerCount AS "answers", Tags AS "tag" FROM Posts WHERE NOT Tags LIKE '%><%' AND Title = LOWER(Title) AND ClosedDate IS NULL ORDER BY Score
sede
CREATE TABLE table_name_20 ( swing_to_gain VARCHAR, constituency VARCHAR )
how many times is the constituency edinburgh northern and leith?
SELECT COUNT(swing_to_gain) FROM table_name_20 WHERE constituency = "edinburgh northern and leith"
sql_create_context
CREATE TABLE table_52866 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many people watched the game at Lake Oval?
SELECT SUM("Crowd") FROM table_52866 WHERE "Venue" = 'lake oval'
wikisql
CREATE TABLE table_13427 ( "Name" text, "Type" text, "Relation" text, "Length" text, "Year" real )
Which Relation has a Year larger than 2000, and a Length of 8 x 20 mins?
SELECT "Relation" FROM table_13427 WHERE "Year" > '2000' AND "Length" = '8 x 20 mins'
wikisql
CREATE TABLE table_name_77 ( order VARCHAR, goals VARCHAR )
What is total orders for goals of 239?
SELECT COUNT(order) FROM table_name_77 WHERE goals = 239
sql_create_context
CREATE TABLE mzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH text, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZZMC ...
二零零六年十二月二十二日到二零一五年三月五日,编号为8585428的医院中有多少科室在门诊就诊中开了7张以上检验报告单
SELECT COUNT(*) FROM (SELECT jybgb.KSBM FROM mzjzjlb JOIN jybgb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_inf...
css
CREATE TABLE table_74727 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the smallest crowd that watched an away team score 3.10 (28)?
SELECT MIN("Crowd") FROM table_74727 WHERE "Away team score" = '3.10 (28)'
wikisql
CREATE TABLE table_51645 ( "Club" text, "City" text, "Stadium" text, "Capacity" real, "2011\u201312 season" text )
What city houses the Ciro Vigorito stadium?
SELECT "City" FROM table_51645 WHERE "Stadium" = 'ciro vigorito'
wikisql
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE ground_service ( city_code text, airport_code text, tr...
i need an early flight from DENVER to SAN FRANCISCO please and i would like BREAKFAST served on that
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, flight, food_service WHERE (((flight.departure_time <= 1000 AND flight.departure_time >= 0) AND food_service.meal_code = flight.meal_code AND food_service.meal_description = ...
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
find the number of patients with admission location as clinic referral/premature who have drug code niac100.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND prescriptions.formulary_drug_cd = "NIAC100"
mimicsql_data
CREATE TABLE table_2259502_2 ( partner VARCHAR, score VARCHAR )
Who were the partners in games where the score was 1-6, 2-6?
SELECT partner FROM table_2259502_2 WHERE score = "1-6, 2-6"
sql_create_context
CREATE TABLE table_60871 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
What is the highest goals against when points are larger than 31, the goal difference is smaller than 9, wins are 13, and draws are larger than 6?
SELECT MAX("Goals against") FROM table_60871 WHERE "Points" > '31' AND "Goal Difference" < '9' AND "Wins" = '13' AND "Draws" > '6'
wikisql
CREATE TABLE table_name_50 ( country VARCHAR, town VARCHAR )
what country is dubai in
SELECT country FROM table_name_50 WHERE town = "dubai"
sql_create_context
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnon...
Tags with highest average answer scores (among tags with at least 1000 questions).
SELECT t.TagName, COUNT(a.Id) AS NumAnswers, SUM(a.Score) AS TotalScore, AVG(a.Score + 0.0) AS AvgScore FROM Posts AS a JOIN Posts AS q ON a.ParentId = q.Id JOIN PostTags AS pt ON pt.PostId = q.Id JOIN Tags AS t ON t.Id = pt.TagId WHERE a.PostTypeId = 2 GROUP BY t.TagName, t.Id HAVING COUNT(a.Id) >= 1000 ORDER BY AvgSc...
sede
CREATE TABLE table_204_121 ( id number, "year" text, "game" text, "developer" text, "setting" text, "platform" text, "notes" text )
what is the last platform listed on this chart ?
SELECT "platform" FROM table_204_121 ORDER BY id DESC LIMIT 1
squall
CREATE TABLE table_name_87 ( home_team VARCHAR, venue VARCHAR )
Who was the home team for the game played at Victoria Park?
SELECT home_team FROM table_name_87 WHERE venue = "victoria park"
sql_create_context
CREATE TABLE table_204_394 ( id number, "year" number, "album" text, "label" text, "peak chart\npositions\nus" number, "peak chart\npositions\nus r&b" number )
album released after emotion
SELECT "album" FROM table_204_394 WHERE "year" > (SELECT "year" FROM table_204_394 WHERE "album" = 'emotion') ORDER BY "year" LIMIT 1
squall
CREATE TABLE table_name_34 ( location VARCHAR, game VARCHAR )
What location did game 64 take place
SELECT location FROM table_name_34 WHERE game = 64
sql_create_context
CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE airline ( airline_code...
i'd like to fly from DENVER to ATLANTA with a stop in PITTSBURGH
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND CITY_2.ci...
atis
CREATE TABLE table_67934 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What was the Loss when the opponent was the Rangers and the attendance was greater than 43,211?
SELECT "Loss" FROM table_67934 WHERE "Opponent" = 'rangers' AND "Attendance" > '43,211'
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...
A pie chart shows the proportion of All_Games and All_Games_Percent.
SELECT All_Games, All_Games_Percent FROM basketball_match
nvbench
CREATE TABLE table_name_99 ( opponents VARCHAR, surface VARCHAR )
Who did he play on a hard surface?
SELECT opponents FROM table_name_99 WHERE surface = "hard"
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...
what is the procedure icd9 code and procedure long title of subject id 31066?
SELECT procedures.icd9_code, procedures.long_title FROM procedures WHERE procedures.subject_id = "31066"
mimicsql_data
CREATE TABLE table_17369472_2 ( won VARCHAR, points VARCHAR )
How many were won when there were 49 points?
SELECT won FROM table_17369472_2 WHERE points = "49"
sql_create_context
CREATE TABLE table_name_90 ( model VARCHAR, byte_string VARCHAR, floating_point VARCHAR )
What model has both a standard byte string and floating-point?
SELECT model FROM table_name_90 WHERE byte_string = "standard" AND floating_point = "standard"
sql_create_context
CREATE TABLE table_53758 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
Which was the team 1 that had a team 2 which was avigliano (basilicata)?
SELECT "Team 1" FROM table_53758 WHERE "Team 2" = 'avigliano (basilicata)'
wikisql
CREATE TABLE table_name_17 ( date VARCHAR, home_away VARCHAR, opponent VARCHAR )
On what date were the opponents the Bayhawks at a home game?
SELECT date FROM table_name_17 WHERE home_away = "home" AND opponent = "bayhawks"
sql_create_context
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 admission year is less than 2195 and item id is 50836?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2195" AND lab.itemid = "50836"
mimicsql_data
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate...
Who claims to be from Greenland?.
SELECT Id AS "user_link" FROM Users WHERE Location = 'Greenland'
sede
CREATE TABLE table_name_22 ( set_1 VARCHAR, time VARCHAR, set_3 VARCHAR )
Which Set 1 has a Time of 14:00, and a Set 3 of 19 25?
SELECT set_1 FROM table_name_22 WHERE time = "14:00" AND set_3 = "19–25"
sql_create_context
CREATE TABLE table_name_80 ( away_team VARCHAR, tie_no VARCHAR )
Which away team has Tie no 3?
SELECT away_team FROM table_name_80 WHERE tie_no = "3"
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...
today, when was the first time that the sao2 of patient 022-78423 was less than 97.0?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-78423')) AND vitalperiodic.sao2 < 97.0 AND NOT ...
eicu
CREATE TABLE table_25773116_2 ( winning_driver VARCHAR, date VARCHAR )
Who won the April 11 race?
SELECT winning_driver FROM table_25773116_2 WHERE date = "April 11"
sql_create_context
CREATE TABLE table_24340 ( "Type of Record" text, "Attendance" real, "Date/Year" text, "Stadium" text, "Result/Games" text )
Name the result/games for 52521
SELECT "Result/Games" FROM table_24340 WHERE "Attendance" = '52521'
wikisql
CREATE TABLE table_name_91 ( games VARCHAR, event VARCHAR )
What games have the event of Men's Slalom?
SELECT games FROM table_name_91 WHERE event = "men's slalom"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text, RYBH text ) CREATE TABLE mzjzjlb ( YLJGDM text, JZLSH text, KH text, KLX number, MJZH text, HZXM text, NLS number, NLY number, ZSEBZ number, JZZTDM number, JZZTMC text, JZJSSJ time, TXBZ number,...
从2006年10月22日到2014年7月12日期间里,号码是08644482的病人所有检验报告单的审核日期是什么时候吗?
(SELECT jybgb.SHSJ FROM hz_info JOIN mzjzjlb JOIN jybgb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE hz_info.RYBH = '08644482' AND jybgb.BGRQ BETWEEN '2006-10-22' AND '2014-07-12') UNI...
css
CREATE TABLE table_name_11 ( silver VARCHAR, total VARCHAR, bronze VARCHAR, rank VARCHAR )
What is the total number of silvers associated with 3 bronzes, a total over 6, and a rank of 3?
SELECT COUNT(silver) FROM table_name_11 WHERE bronze = "3" AND rank = "3" AND total > 6
sql_create_context
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptio...
what is the monthly minimum amount of stool out stool that patient 61339 had until 71 months ago?
SELECT MIN(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61339)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sto...
mimic_iii
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the sum of code , and group by attribute headquarter, and rank bar from high to low order.
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T2.Headquarter DESC
nvbench
CREATE TABLE table_6016 ( "Type" text, "wheelbase" text, "M39 series" text, "M809 series" text, "M939 series" text )
Name the M939 series for short wheelbase and M809 series of m817
SELECT "M939 series" FROM table_6016 WHERE "M809 series" = 'm817' AND "wheelbase" = 'short'
wikisql
CREATE TABLE table_203_724 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
how many total medals did belarus win ?
SELECT "total" FROM table_203_724 WHERE "nation" = 'belarus'
squall
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE status ( station_i...
Show me the correlation about what are the ids of the trips that lasted the longest and how long did they last?
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
give the number of patients primarily diagnosed for guillan barre syndrome who underwent the procedure titled int insert 1-cham, rate.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "GUILLAIN BARRE SYNDROME" AND procedures.short_title = "Int insert 1-cham, rate"
mimicsql_data
CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_by_staff_id INTEGER, fault_log_entry_datetime DATETIME, fault_description VARCHAR(255), other_fault_details VARCHAR(255) ) CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARC...
Give me a pie chart showing the number of engineers for different skill description.
SELECT skill_description, COUNT(skill_description) FROM Maintenance_Engineers AS T1 JOIN Engineer_Skills AS T2 ON T1.engineer_id = T2.engineer_id JOIN Skills AS T3 ON T2.skill_id = T3.skill_id GROUP BY skill_description
nvbench
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city v...
For the Fall or Winter term , are there any 100 -level classes ?
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number BETWEEN 100 AND 100 + 100 AND semester.semester IN ('FA', 'WN') AND semester.semester_id = course_of...
advising
CREATE TABLE table_3215 ( "Region" text, "HDI" text, "Life expectancy at birth (2001-2002)" text, "Adult literacy rate (2009)" text, "Combined gross enrollment ratio (2009)" text, "GDP (PPP) per capita (2008)" real )
How many regions had a life expectancy at birth in 2001-2002 of 75.9?
SELECT COUNT("HDI") FROM table_3215 WHERE "Life expectancy at birth (2001-2002)" = '75.9'
wikisql
CREATE TABLE financial_transactions ( transaction_id number, previous_transaction_id number, account_id number, card_id number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text ) CREATE TABLE accounts (...
Count the number of credit cards that the customer with first name Blanche and last name Huels has.
SELECT COUNT(*) FROM customers_cards AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Blanche" AND T2.customer_last_name = "Huels" AND T1.card_type_code = "Credit"
spider
CREATE TABLE table_name_43 ( races VARCHAR, position VARCHAR, series VARCHAR, fl VARCHAR )
What races have gp2 series, 0 F.L. and a 17th position?
SELECT races FROM table_name_43 WHERE series = "gp2 series" AND fl = "0" AND position = "17th"
sql_create_context
CREATE TABLE table_name_26 ( name VARCHAR, date VARCHAR, ownership VARCHAR, condition VARCHAR )
What is the Name of the private Castle of the 16th century which is occupied?
SELECT name FROM table_name_26 WHERE ownership = "private" AND condition = "occupied" AND date = "16th century"
sql_create_context
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE outputevents ( ...
when was the last time patient 65401 was prescribed medication through the ed route in 10/2105?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65401) AND prescriptions.route = 'ed' AND STRFTIME('%y-%m', prescriptions.startdate) = '2105-10' ORDER BY prescriptions.startdate DESC LIMIT 1
mimic_iii
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
how many female patients had morbid obesity/sda as their primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "MORBID OBESITY/SDA"
mimicsql_data
CREATE TABLE table_55791 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
What is the highest Roll of Orere School with a Decile less than 8 with a State Authority?
SELECT MAX("Roll") FROM table_55791 WHERE "Decile" < '8' AND "Authority" = 'state' AND "Name" = 'orere school'
wikisql
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
has patient 007-2498 received a procedure of nephrostomy - right in other hospitals in this year?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '007-2498' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '007-2498' AND patient.hospitaldischargetime IS NULL)) AND trea...
eicu
CREATE TABLE zyjybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH number, 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, ...
在编号为62645586的病人检查中有哪些检验报告单对应的检验结果指标全都异常?检验报告上面的单号是什么?
SELECT zyjybgb.BGDH FROM hz_info JOIN mzjzjlb JOIN zyjybgb ON 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 hz_info.RYBH = '62645586' AND NOT zyjybgb.BGDH IN (SELECT jyjgzbb.BGDH FROM ...
css
CREATE TABLE table_57889 ( "Name" text, "League" real, "FA Cup" real, "League Cup" real, "Europe" real, "Total" real )
What is the low FA cup goals for viduka with under 2 europe goals?
SELECT MIN("FA Cup") FROM table_57889 WHERE "Name" = 'viduka' AND "Europe" < '2'
wikisql
CREATE TABLE table_name_73 ( lost VARCHAR, drawn VARCHAR, played VARCHAR )
What is the total number of losses of the player that has drawn 1 and played smaller than 12?
SELECT COUNT(lost) FROM table_name_73 WHERE drawn = 1 AND played < 12
sql_create_context
CREATE TABLE table_20855452_4 ( points VARCHAR, player VARCHAR )
How many points did shahar pe'er score?
SELECT points AS won FROM table_20855452_4 WHERE player = "Shahar Pe'er"
sql_create_context
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARC...
How many dorms are there for each gender? Show me a bar chart, I want to list from high to low by the y-axis.
SELECT gender, COUNT(*) FROM Dorm GROUP BY gender ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, ...
When is 847 being offered ?
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM semester INNER JOIN course_offering ON semester.semester_id = course_o...
advising
CREATE TABLE table_48713 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Attendance" real, "Record" text, "Points" real )
Which Score has an Opponent of washington capitals, and a Record of 24-34-17?
SELECT "Score" FROM table_48713 WHERE "Opponent" = 'washington capitals' AND "Record" = '24-34-17'
wikisql
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...
编号为09476292的这位患者被门诊诊断为疾病S98.901,查一下他游离甲状腺素(三代)的结果定量及其单位
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM hz_info JOIN mzjzjlb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJZJLB WHERE mzjzjlb.JZZDBM = 'S98.901' AND hz_info.RYB...
css
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
when was patient 73206 prescribed with a drug via im route for the first time since 05/2101?
SELECT prescriptions.startdate FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73206) AND prescriptions.route = 'im' AND STRFTIME('%y-%m', prescriptions.startdate) >= '2101-05' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
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 ) ...
how many patients whose primary disease is acidosis and admission year is less than 2139?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACIDOSIS" AND demographic.admityear < "2139"
mimicsql_data
CREATE TABLE table_15187735_18 ( episode INTEGER, segment_d VARCHAR )
Name the least episode for fibre cement siding
SELECT MIN(episode) FROM table_15187735_18 WHERE segment_d = "Fibre Cement Siding"
sql_create_context
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) 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 TA...
what 's the lowest one way fare from PITTSBURGH to DENVER
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.c...
atis
CREATE TABLE table_name_3 ( Id VARCHAR )
What shows for 202 when the 1994 is A, the 1989 is NME, and the 199 is 2R?
SELECT 2002 FROM table_name_3 WHERE 1994 = "a" AND 1989 = "nme" AND 1999 = "2r"
sql_create_context
CREATE TABLE table_4647 ( "Name" text, "Dates active" text, "Windspeeds" text, "Pressure" text, "Deaths" text )
What dates was the storm called 07 active?
SELECT "Dates active" FROM table_4647 WHERE "Name" = '07'
wikisql
CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) )...
How many documents in different ending date? Return a bar chart binning ending date by weekday, and rank by the total number in descending.
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations ORDER BY COUNT(Date_in_Locaton_To) DESC
nvbench
CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostNotices ( Id number, PostId numb...
Top 10 question askers in Meta Stack Exchange.
SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS "row_number", OwnerUserId AS "user_link", COUNT(PostTypeId) AS "questions_count" FROM Posts WHERE NOT OwnerUserId IS NULL AND OwnerUserId != -1 AND PostTypeId = 1 GROUP BY OwnerUserId ORDER BY COUNT(PostTypeId) DESC LIMIT 10
sede
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
calculate the difference between patient 20898's total output and the total input amount on 12/24/this year.
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 = 20898)) AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT...
mimic_iii
CREATE TABLE table_name_3 ( males VARCHAR, language VARCHAR )
How many males speak Russian?
SELECT males FROM table_name_3 WHERE language = "russian"
sql_create_context
CREATE TABLE table_24064 ( "Episode" text, "Broadcast date" text, "Run time" text, "Viewers (in millions)" text, "Archive" text )
What episode had a run time of 24:53?
SELECT "Episode" FROM table_24064 WHERE "Run time" = '24:53'
wikisql
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, h...
what the last height of patient 011-31779 on their first hospital encounter.
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '011-31779' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionheight IS NULL ORDER BY p...
eicu
CREATE TABLE table_name_40 ( played INTEGER, points VARCHAR, position VARCHAR )
What is the largest number played with 16 points in a position over 4?
SELECT MAX(played) FROM table_name_40 WHERE points = 16 AND position > 4
sql_create_context
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
has patient 002-4486 been prescribed with morphine 4 mg/ml syringe : 1 ml syringe, chlorhexidine gluconate 0.12% or amlodipine 5 mg tab this month?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-4486')) AND medication.drugname IN ('morphine 4 mg/ml syringe : 1 ml s...
eicu
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) 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...
排列出就诊结算日期在01年4月14日到07年1月10日内的病人42713502所有医疗就诊记录编号都分别是哪些?
SELECT t_kc21.MED_CLINIC_ID FROM t_kc24 JOIN t_kc21_t_kc24 JOIN t_kc21 ON t_kc21_t_kc24.MED_SAFE_PAY_ID = t_kc24.MED_SAFE_PAY_ID AND t_kc21_t_kc24.MED_CLINIC_ID = t_kc21.MED_CLINIC_ID WHERE t_kc24.PERSON_ID = '42713502' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2001-04-14' AND '2007-01-10'
css
CREATE TABLE table_75394 ( "Game" real, "March" real, "Opponent" text, "Score" text, "Record" text, "Points" real )
Which Opponent has a Record of 45 21 4?
SELECT "Opponent" FROM table_75394 WHERE "Record" = '45–21–4'
wikisql
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownV...
Number of answers outscoring a given user's answers. Rank users by the number of answers that outscore the target user's answer on the same question. Only answers posted at most 24 hours earlier are considered.
SELECT b.OwnerUserId AS "user_link", COUNT(*) AS "count", MIN(b.Id) AS "post_link" FROM Posts AS a, Posts AS b WHERE a.OwnerUserId = '##User##' AND b.OwnerUserId != a.OwnerUserId AND b.ParentId = a.ParentId AND b.Score > a.Score AND a.CreationDate <= DATE(b.CreationDate, '24 hour') GROUP BY b.OwnerUserId ORDER BY 'coun...
sede
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, find founder and the sum of price , and group by attribute founder, and visualize them by a bar chart, rank by the y-axis from low to high please.
SELECT Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Price)
nvbench
CREATE TABLE table_201 ( "Round" real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
Who was the winning driver when the pole position was held by Ayrton Senna and the Fastest lap was Michael Schumacher?
SELECT "Winning Driver" FROM table_201 WHERE "Pole Position" = 'Ayrton Senna' AND "Fastest Lap" = 'Michael Schumacher'
wikisql
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
在医院5565030中的85281827号病患其就诊了哪些名称不包含ICU的科室,其所有门诊就诊记录的流水号是多少?
SELECT zzmzjzjlb.JZLSH FROM hz_info JOIN zzmzjzjlb ON hz_info.YLJGDM = zzmzjzjlb.YLJGDM AND hz_info.KH = zzmzjzjlb.KH AND hz_info.KLX = zzmzjzjlb.KLX WHERE hz_info.RYBH = '85281827' AND hz_info.YLJGDM = '5565030' AND NOT zzmzjzjlb.JZKSMC LIKE '%ICU%' UNION SELECT fzzmzjzjlb.JZLSH FROM hz_info JOIN fzzmzjzjlb ON hz_info...
css
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...
从在2003年2月7日至2010年3月27日期间医院4645126医疗记录一共多少?
SELECT COUNT(*) FROM gwyjzb WHERE gwyjzb.MED_SER_ORG_NO = '4645126' AND gwyjzb.IN_HOSP_DATE BETWEEN '2003-02-07' AND '2010-03-27' UNION SELECT COUNT(*) FROM fgwyjzb WHERE fgwyjzb.MED_SER_ORG_NO = '4645126' AND fgwyjzb.IN_HOSP_DATE BETWEEN '2003-02-07' AND '2010-03-27'
css
CREATE TABLE table_34425 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
Which game has houston as the road team, and june 15 as the date?
SELECT "Game" FROM table_34425 WHERE "Road Team" = 'houston' AND "Date" = 'june 15'
wikisql
CREATE TABLE table_38719 ( "Route" text, "Terminus" text, "Operated by" text, "Corridors served" text, "Total trips (AM/PM)" text, "Operating since" text )
What trips are operated by Atlantic coast charters?
SELECT "Total trips (AM/PM)" FROM table_38719 WHERE "Operated by" = 'atlantic coast charters'
wikisql
CREATE TABLE wine ( no number, grape text, winery text, appelation text, state text, name text, year number, price number, score number, cases number, drink text ) CREATE TABLE appellations ( no number, appelation text, county text, state text, area text,...
What are the names of all wines produced in 2008?
SELECT name FROM wine WHERE year = "2008"
spider
CREATE TABLE table_27704187_8 ( high_rebounds VARCHAR, game VARCHAR )
How many high rebounds are listed for game 35?
SELECT COUNT(high_rebounds) FROM table_27704187_8 WHERE game = 35
sql_create_context
CREATE TABLE table_1909647_2 ( year VARCHAR, team_s_ VARCHAR )
In what year did the #14 FitzBradshaw Racing compete?
SELECT year FROM table_1909647_2 WHERE team_s_ = "#14 FitzBradshaw Racing"
sql_create_context
CREATE TABLE table_name_21 ( aam_member VARCHAR, city VARCHAR, astc_member VARCHAR, aam_accredited VARCHAR, state VARCHAR )
What is AAM Member, when AAM Accredited is No, when State is California, when ASTC Member is Yes, and when City is Sacramento?
SELECT aam_member FROM table_name_21 WHERE aam_accredited = "no" AND state = "california" AND astc_member = "yes" AND city = "sacramento"
sql_create_context
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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(...
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and employee_id , and visualize them by a bar chart, sort total number from low to high order.
SELECT FIRST_NAME, 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
nvbench
CREATE TABLE table_71573 ( "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text )
When was the tournament of bologna?
SELECT "Date" FROM table_71573 WHERE "Tournament" = 'bologna'
wikisql
CREATE TABLE table_name_56 ( film VARCHAR, actor VARCHAR )
What film was Dianne Wiest in?
SELECT film FROM table_name_56 WHERE actor = "dianne wiest"
sql_create_context
CREATE TABLE table_203_164 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
how many games did the winning team score above 3 points ?
SELECT COUNT(*) FROM table_203_164 WHERE "result" = 'won' AND "score" > 3
squall
CREATE TABLE table_204_35 ( id number, "season" text, "tier" number, "division" text, "place" text )
which season was more successful , 1995/96 or 1996/97 ?
SELECT "season" FROM table_204_35 WHERE "season" IN ('1995/96', '1996/97') ORDER BY "place" LIMIT 1
squall
CREATE TABLE table_53767 ( "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the sum of the Bronze medals when the Gold medals are larger than 0, Silver medals are smaller than 1, and the total is smaller than 1?
SELECT SUM("Bronze") FROM table_53767 WHERE "Gold" > '0' AND "Silver" < '1' AND "Total" < '1'
wikisql