context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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, ...
give the number of patients of white ethnicity under diagnoses icd9 code 56721.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.icd9_code = "56721"
mimicsql_data
CREATE TABLE table_65119 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
In what week was the December 21, 1969 game?
SELECT AVG("Week") FROM table_65119 WHERE "Date" = 'december 21, 1969'
wikisql
CREATE TABLE table_name_7 ( score VARCHAR, opponent VARCHAR )
Opponent of andry laffita had what score?
SELECT score FROM table_name_7 WHERE opponent = "andry laffita"
sql_create_context
CREATE TABLE table_name_85 ( party VARCHAR, member VARCHAR )
What party was the member peter howson part of?
SELECT party FROM table_name_85 WHERE member = "peter howson"
sql_create_context
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 varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varc...
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the average of employee_id bin hire_date by weekday.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
nvbench
CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id num...
ashleedawg's animated gif's as html.
SELECT * FROM Posts WHERE Body LIKE '%http://couill.art/wp-content/uploads/2018/05/Thicc-girls-slim-boi.gif%' AND YEAR(CreationDate) = 2018
sede
CREATE TABLE table_203_630 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
what is the total number of medals between south korea , north korea , sweden , and brazil ?
SELECT SUM("total") FROM table_203_630 WHERE "nation" IN ('south korea', 'north korea', 'sweden', 'brazil')
squall
CREATE TABLE table_38936 ( "Season" real, "Bowl game" text, "Result" text, "Opponent" text, "Stadium" text, "Location" text, "Attendance" text )
At what Location was the Attendance 70,283?
SELECT "Location" FROM table_38936 WHERE "Attendance" = '70,283'
wikisql
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 ) ...
give me the number of patients whose primary disease is atrial fibrillation\thoracoscopic maze procedure bilateral/sda and admission year is less than 2190?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" AND demographic.admityear < "2190"
mimicsql_data
CREATE TABLE table_name_7 ( place VARCHAR, money___$__ VARCHAR, player VARCHAR )
What is the place of player peter oosterhuis, who has $7,500?
SELECT place FROM table_name_7 WHERE money___$__ = "7,500" AND player = "peter oosterhuis"
sql_create_context
CREATE TABLE table_name_98 ( transcription VARCHAR, english_name VARCHAR )
What is the transcription for the English March?
SELECT transcription FROM table_name_98 WHERE english_name = "march"
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 number of patients whose marital status is single and diagnoses long title is malignant neoplasm of middle third of esophagus?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.long_title = "Malignant neoplasm of middle third of esophagus"
mimicsql_data
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
count the number of hospital visits patient 021-240586 was since 5 years ago.
SELECT COUNT(DISTINCT patient.patienthealthsystemstayid) FROM patient WHERE patient.uniquepid = '021-240586' AND DATETIME(patient.hospitaladmittime) >= DATETIME(CURRENT_TIME(), '-5 year')
eicu
CREATE TABLE table_27730_9 ( ikavian VARCHAR, ijekavian VARCHAR )
What's the Ikavian translation of the Ijekavian word lijep?
SELECT ikavian FROM table_27730_9 WHERE ijekavian = "lijep"
sql_create_context
CREATE TABLE table_228973_5 ( title VARCHAR, original_air_date VARCHAR )
What is the name of the episode that aired originally on November 10, 1998?
SELECT title FROM table_228973_5 WHERE original_air_date = "November 10, 1998"
sql_create_context
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
Bar chart x axis job y axis the average of age, display by the x axis from low to high.
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job
nvbench
CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE ReviewTaskResults ( Id number, Review...
Questions in a given tag, ordered by number of answers.
SELECT question.Id AS "post_link", question.Score, question.AnswerCount FROM Posts AS question WHERE question.AnswerCount > 100 ORDER BY question.AnswerCount DESC
sede
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE icustays ( row_id number, s...
how many days was it since patient 95892 stayed in ward 14 for the first time on this hospital visit?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', transfers.intime)) FROM transfers WHERE transfers.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 95892 AND admissions.dischtime IS NULL)) AND transfers....
mimic_iii
CREATE TABLE table_1342149_43 ( party VARCHAR, incumbent VARCHAR )
What party did incumbent Wright Patman belong to?
SELECT party FROM table_1342149_43 WHERE incumbent = "Wright Patman"
sql_create_context
CREATE TABLE table_71716 ( "Rank" real, "Player" text, "Games" real, "Goals" real, "Goal Ratio" real, "Debut in Europe" real )
What's the average goal ratio with Goals larger than 1, Games larger than 161, and a Debut in Europe smaller than 1985?
SELECT AVG("Goal Ratio") FROM table_71716 WHERE "Goals" > '1' AND "Games" > '161' AND "Debut in Europe" < '1985'
wikisql
CREATE TABLE table_name_69 ( attendance VARCHAR, date VARCHAR )
What Attendance has a Date that is november 1, 1993?
SELECT attendance FROM table_name_69 WHERE date = "november 1, 1993"
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 average age of patients whose gender is m and admission type is newborn?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "M" AND demographic.admission_type = "NEWBORN"
mimicsql_data
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
get the number of office admission patients who were female.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_location = "CLINIC REFERRAL/PREMATURE"
mimicsql_data
CREATE TABLE table_72188 ( "Rank" real, "Gymnast" text, "Floor Exercise" text, "Pommel Horse" text, "Rings" text, "Vault" text, "Parallel Bars" text, "Horizontal Bar" text, "Total" text )
What is the total score when the score for floor exercise was 9.287?
SELECT "Total" FROM table_72188 WHERE "Floor Exercise" = '9.287'
wikisql
CREATE TABLE table_name_84 ( type VARCHAR, name_of_mill VARCHAR )
What is the Type of Mill at Molen de Stud?
SELECT type FROM table_name_84 WHERE name_of_mill = "molen de stud"
sql_create_context
CREATE TABLE table_204_246 ( id number, "department" text, "total deputies" number, "uninominal deputies" number, "plurinominal deputies" number, "special indigenous\nor campesino deputies" number, "senators" number )
how many more total deputies does benji have than state senators ?
SELECT ABS((SELECT "total deputies" FROM table_204_246 WHERE "department" = 'beni') - (SELECT "senators" FROM table_204_246 WHERE "department" = 'beni'))
squall
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 ) ...
what number of male patients have been given fentanyl citrate?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.drug = "Fentanyl Citrate"
mimicsql_data
CREATE TABLE table_9783 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
what is the rank when bronze is less than 1 and silver is less than 1?
SELECT "Rank" FROM table_9783 WHERE "Bronze" < '1' AND "Silver" < '1'
wikisql
CREATE TABLE table_name_26 ( tournament VARCHAR )
What is the tournament when 2007 is WTA Premier 5 tournaments?
SELECT tournament FROM table_name_26 WHERE 2007 = "wta premier 5 tournaments"
sql_create_context
CREATE TABLE table_name_4 ( crowd VARCHAR, venue VARCHAR )
What is the listed crowd at windy hill?
SELECT crowd FROM table_name_4 WHERE venue = "windy hill"
sql_create_context
CREATE TABLE table_68094 ( "Year" real, "Group" text, "Award" text, "Film/Show" text, "Result" text )
What is the total number of Years that has the Group, Method Fest Independent Film Festival?
SELECT COUNT("Year") FROM table_68094 WHERE "Group" = 'method fest independent film festival'
wikisql
CREATE TABLE table_204_190 ( id number, "rank" number, "city" text, "county" text, "state" text, "percentage" text )
what is the number of cities in new jersey on the top ten list ?
SELECT COUNT("city") FROM table_204_190 WHERE "state" = 'new jersey' AND "rank" <= 10
squall
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
give me the number of patients whose marital status is divorced and procedure long title is other open incisional hernia repair with graft or prosthesis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "DIVORCED" AND procedures.long_title = "Other open incisional hernia repair with graft or prosthesis"
mimicsql_data
CREATE TABLE table_73722 ( "Stage" real, "Winner" text, "General Classification" text, "Youth Classification" text, "Mountains Classification" text, "Sprint Classification" text, "Most Courageous" text, "Team Classification" text )
When Mark Cavendish wins sprint classification and Maarten Tjallingii wins most courageous, who wins youth classification?
SELECT "Youth Classification" FROM table_73722 WHERE "Sprint Classification" = 'Mark Cavendish' AND "Most Courageous" = 'Maarten Tjallingii'
wikisql
CREATE TABLE table_1488 ( "Pick #" real, "CFL Team" text, "Player" text, "Position" text, "College" text )
Where did Dante Luciani attend college?
SELECT "College" FROM table_1488 WHERE "Player" = 'Dante Luciani'
wikisql
CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_city_affected real ) CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Nu...
Return a bar chart on how many regions were affected by each storm?, show in desc by the Y please.
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID ORDER BY COUNT(*) DESC
nvbench
CREATE TABLE table_name_55 ( identifier VARCHAR, city_of_license VARCHAR )
What is Identifier, when City of License is Hornepayne?
SELECT identifier FROM table_name_55 WHERE city_of_license = "hornepayne"
sql_create_context
CREATE TABLE table_63586 ( "Language" text, "Artist" text, "Song" text, "Place" real, "Points" real )
What is the highest place of a song by Henri D s that has fewer than 8 points?
SELECT MAX("Place") FROM table_63586 WHERE "Artist" = 'henri dès' AND "Points" < '8'
wikisql
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE code_description ( code varchar, description text ) CREATE...
show me the nonstop flights from TORONTO to ST. PETERSBURG
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 WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'TORONTO' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ST. P...
atis
CREATE TABLE table_32664 ( "Round" real, "Overall" real, "Player" text, "Position" text, "School/Club Team" text )
Which school(s) had a wide receiver drafted in round 4?
SELECT "School/Club Team" FROM table_32664 WHERE "Round" > '4' AND "Position" = 'wide receiver'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_items ( ...
what were the three most commonly ordered specimen tests for patients who were diagnosed with dieulafoy les,stom&duod before within the same month since 2100?
SELECT t3.spec_type_desc FROM (SELECT t2.spec_type_desc, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_...
mimic_iii
CREATE TABLE Products ( product_id INTEGER, color_code VARCHAR(15), product_category_code VARCHAR(15), product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255) ) CREATE TABLE Ref_P...
A bar chart for finding the number of the category descriptions of the products whose descriptions include letter 't', and I want to display by the bar from high to low please.
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description ORDER BY product_category_description DESC
nvbench
CREATE TABLE table_17319931_1 ( laps INTEGER, points VARCHAR )
What is the highest number of laps led with 16 points?
SELECT MAX(laps) AS Led FROM table_17319931_1 WHERE points = "16"
sql_create_context
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 jyjgzbb ( BGDH text, BGRQ tim...
在2002年7月29日到2003年2月5日这段时间内患者60923283被开出的所有检验报告单的科室编码是什么?科室名称是啥啊?
SELECT jybgb.KSBM, jybgb.KSMC 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 = '60923283' AND jybgb.BGRQ BETWEEN '2002-07-29' AND '2003-...
css
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_items ( row_id number, ...
show me the five most frequent output events since 2105?
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE STRFTIME('%y', outputevents.charttime) >= '2105' GROUP BY outputevents.itemid) AS t1 WHERE t1.c1 <= 5)
mimic_iii
CREATE TABLE table_46049 ( "Player" text, "Nationality" text, "Position" text, "Years for Grizzlies" text, "School/Club Team" text )
Which player played for Western Kentucky?
SELECT "Player" FROM table_46049 WHERE "School/Club Team" = 'western kentucky'
wikisql
CREATE TABLE table_13792 ( "Name" text, "Position" text, "League Apps" text, "League Goals" real, "FA Cup Apps" text, "FA Cup Goals" real, "League Cup Apps" text, "League Cup Goals" real, "Total Apps" text, "Total Goals" real )
Which League Goals have FA Cup Apps of 2, and Total Goals smaller than 0?
SELECT AVG("League Goals") FROM table_13792 WHERE "FA Cup Apps" = '2' AND "Total Goals" < '0'
wikisql
CREATE TABLE table_15465 ( "Ride Name" text, "Type" text, "Opened in" real, "Themed Land" text, "Manufacture" text )
Who is the manufacturer of the mini jet red baron ride that opened before 2001?
SELECT "Manufacture" FROM table_15465 WHERE "Opened in" < '2001' AND "Type" = 'mini jet red baron'
wikisql
CREATE TABLE table_178381_1 ( location_of_the_church VARCHAR, year_built VARCHAR, church_name VARCHAR )
On how many locations is there a church named Askrova Bedehuskapell, built in 1957?
SELECT COUNT(location_of_the_church) FROM table_178381_1 WHERE year_built = "1957" AND church_name = "Askrova bedehuskapell"
sql_create_context
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, draw a scatter chart about the correlation between code and revenue , and group by attribute founder.
SELECT T1.Code, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
nvbench
CREATE TABLE table_28195898_1 ( production_code VARCHAR, us_viewers__millions_ VARCHAR )
What is the production code for the episode with 5.5 million u.s. viewers?
SELECT production_code FROM table_28195898_1 WHERE us_viewers__millions_ = "5.5"
sql_create_context
CREATE TABLE table_name_68 ( goals_for INTEGER, wins VARCHAR, goal_difference VARCHAR, club VARCHAR )
What was the average number of 'goals for', scored in the club Real Oviedo that had a 'goal difference' lower than -16 and fewer than 9 wins?
SELECT AVG(goals_for) FROM table_name_68 WHERE goal_difference < -16 AND club = "real oviedo" AND wins < 9
sql_create_context
CREATE TABLE jyjgzbb ( BGDH text, BGRQ time, CKZFWDX text, CKZFWSX number, CKZFWXX number, JCFF text, JCRGH text, JCRXM text, JCXMMC text, JCZBDM text, JCZBJGDL number, JCZBJGDW text, JCZBJGDX text, JCZBMC text, JLDW text, JYRQ time, JYZBLSH text, ...
通过门诊诊断出这个N08.618疾病人他们的籍贯代码、名称以及相应人数各是多少?
SELECT person_info.JGDM, person_info.JGMC, COUNT(person_info.RYBH) FROM person_info JOIN hz_info JOIN mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX WHERE mzjzjlb.JZZDBM = 'N08.618' GROUP BY person_info.JGDM
css
CREATE TABLE table_train_195 ( "id" int, "gender" string, "pregnancy_or_lactation" bool, "allergy_to_perflutren" bool, "heart_disease" bool, "body_mass_index_bmi" float, "age" float, "NOUSE" float )
male or female 20 _ 75 years of age inclusive.
SELECT * FROM table_train_195 WHERE (gender = 'male' OR gender = 'female') AND (age >= 20 AND age <= 75)
criteria2sql
CREATE TABLE table_15990 ( "Case/Suffix" text, "we two" text, "you and I" text, "you two" text, "them two (the two)" text, "who-two" text )
What is them two (the two) when we two is ngalbelpa?
SELECT "them two (the two)" FROM table_15990 WHERE "we two" = 'ngalbelpa'
wikisql
CREATE TABLE ship ( ship_id number, name text, type text, nationality text, tonnage number ) CREATE TABLE mission ( mission_id number, ship_id number, code text, launched_year number, location text, speed_knots number, fate text )
What is the number of ships?
SELECT COUNT(*) FROM ship
spider
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
list patient identifications of patients who were diagnosed with hx-rectal & anal malign in 2101.
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hx-rectal & anal malign') AND STRFTIME('%y', diagnoses_icd.charttime) = '2...
mimic_iii
CREATE TABLE table_10873 ( "Date" text, "Round" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real )
Who was the opponent of the match in round sf with a result of 0-0?
SELECT "Opponent" FROM table_10873 WHERE "Round" = 'sf' AND "Result" = '0-0'
wikisql
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text,...
Members by Rep in Ireland.
SELECT DisplayName, Reputation, Location FROM Users WHERE UPPER(Location) LIKE '%IRELAND%' ORDER BY Reputation DESC
sede
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE patients ( row_id number, subject_id number, ...
what were the drugs which were added to patient 2518 today compared to the ones yesterday?
SELECT prescriptions.drug FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2518) AND DATETIME(prescriptions.startdate, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') EXCEPT SELECT prescriptions.drug FROM prescriptions WHERE ...
mimic_iii
CREATE TABLE table_315 ( "Player" text, "Position" text, "School" text, "Hometown" text, "College" text )
What is the hometown of trinity high school?
SELECT "Hometown" FROM table_315 WHERE "School" = 'Trinity High 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...
when did patient 031-24513 last receive a ultrasonography - abdomen, until 2104?
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-24513')) AND treatment.treatmentname = 'ultrasonography - abd...
eicu
CREATE TABLE table_name_98 ( drawn INTEGER, games VARCHAR, lost VARCHAR, points VARCHAR )
Which Drawn has a Lost larger than 0, and Points smaller than 11, and Games smaller than 7?
SELECT AVG(drawn) FROM table_name_98 WHERE lost > 0 AND points < 11 AND games < 7
sql_create_context
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate...
until 3 years ago what were the top three most frequent procedures that patients received within the same month after being diagnosed with ac myl leuk wo achv rmsn?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissi...
mimic_iii
CREATE TABLE Addresses ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50) ) CREATE TABLE Lessons ( lesson_id INTEGER, customer_id INTEGER, lesson_status_code VARCHAR(15), st...
Bar chart x axis customer status code y axis the total number
SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code
nvbench
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) 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 ...
what are all flights from DENVER to PHILADELPHIA on saturday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND date_day.day_number = 26 AND date_day.month_number = 7 ...
atis
CREATE TABLE table_8632 ( "Place" real, "Star" text, "Average" real, "Best score" real, "Worst score" real )
WHAT IS THE WORST SCORE WHEN THE BEST SCORE WAS 8.8 AND AVERAGE WAS LARGER THAN 6.2?
SELECT COUNT("Worst score") FROM table_8632 WHERE "Best score" = '8.8' AND "Average" > '6.2'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ...
since 4 years ago, how many patients were prescribed simvastatin 40 mg po tabs?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'simvastatin 40 mg po tabs' AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(), '-4 year'))
eicu
CREATE TABLE table_18367694_2 ( original_air_date VARCHAR, production_code VARCHAR )
What is the original air date of the episode with the production code 1115?
SELECT original_air_date FROM table_18367694_2 WHERE production_code = 1115
sql_create_context
CREATE TABLE table_12108_1 ( gdp___bn__ VARCHAR )
what is the gdp ( bn ) where capital is capital?
SELECT gdp___bn__ FROM table_12108_1 WHERE "capital" = "capital"
sql_create_context
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) 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...
患者37544109在2015年2月26日到2020年8月30日内所做的检测丙戊酸的检查是哪个医务人员工号及姓名都是什么?
SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN jybgb_jyjgzbb 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 AND jybgb.YLJGDM = jybgb_jyjgzbb.YLJGDM ...
css
CREATE TABLE table_203_116 ( id number, "no." number, "player" text, "birth date" text, "weight" number, "height" number, "position" text, "current club" text )
who is the tallest member of estonia 's men 's national volleyball team ?
SELECT "player" FROM table_203_116 ORDER BY "height" DESC LIMIT 1
squall
CREATE TABLE table_203_436 ( id number, "year" number, "competition" text, "venue" text, "position" text, "notes" text )
the 2009 asian championships were located in guangzhou , china . what city and country were the asian championships held in before guangzhou , china ?
SELECT "venue" FROM table_203_436 WHERE "competition" = 'asian championships' AND "year" < 2009
squall
CREATE TABLE table_name_79 ( team_2 VARCHAR )
What was the 1st leg for Team 2, Slovan Liberec?
SELECT 1 AS st_leg FROM table_name_79 WHERE team_2 = "slovan liberec"
sql_create_context
CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationD...
Average Score of posts created within two days of user creation date in 2019.
SELECT Posts.Score FROM Posts INNER JOIN Users ON Posts.OwnerUserId = Users.Id WHERE Posts.CreationDate < DATEADD(Day, 2, Users.CreationDate) AND YEAR(Users.CreationDate) = 2019
sede
CREATE TABLE table_24492 ( "Week of" text, "Tournament" text, "Champion" text, "Runner-up" text, "Semifinalists" text, "Quarterfinalists" text )
How many weeks are shown for the champion of john mcenroe 6 2, 6 3?
SELECT COUNT("Week of") FROM table_24492 WHERE "Champion" = 'John McEnroe 6–2, 6–3'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id...
what is the monthly maximum value of patient 25796's monocytes until 4 years ago?
SELECT MAX(labevents.valuenum) FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25796) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'monocytes') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '...
mimic_iii
CREATE TABLE table_name_63 ( figures INTEGER, placings VARCHAR, total VARCHAR )
Can you tell me the average Figures that has the Placings of 34, and the Total larger than 1247.51?
SELECT AVG(figures) FROM table_name_63 WHERE placings = 34 AND total > 1247.51
sql_create_context
CREATE TABLE table_name_13 ( pick INTEGER, player VARCHAR, position VARCHAR, team VARCHAR )
What is the lowest pick number for Arturo McDowell, who plays the OF position for the San Francisco Giants?
SELECT MIN(pick) FROM table_name_13 WHERE position = "of" AND team = "san francisco giants" AND player = "arturo mcdowell"
sql_create_context
CREATE TABLE table_name_16 ( home_team VARCHAR, away_team VARCHAR )
Who played against the away team hereford united?
SELECT home_team FROM table_name_16 WHERE away_team = "hereford united"
sql_create_context
CREATE TABLE table_name_10 ( result VARCHAR, week VARCHAR, date VARCHAR )
What was the Result of the game on December 14, 1986 after Week 11?
SELECT result FROM table_name_10 WHERE week > 11 AND date = "december 14, 1986"
sql_create_context
CREATE TABLE table_69683 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text )
Round of 9 involved what name?
SELECT "Name" FROM table_69683 WHERE "Round" = '9'
wikisql
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_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 ...
自2015.7.29起,止2017.10.29止,自费金额高于2206.93元的药品一共给患者41409860开出了多少
SELECT COUNT(*) 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_ID = '41409860' AND t_kc22.STA_DATE BETWEEN '2015-07-29' AND '2017-10-29' AND t_kc22.SELF_PAY_AMO > 2206.93
css
CREATE TABLE table_name_12 ( year__ceremony_ VARCHAR, result VARCHAR, original_title VARCHAR )
What is the year of the ceremony with a not nominated result and ni iji sin as the original title?
SELECT year__ceremony_ FROM table_name_12 WHERE result = "not nominated" AND original_title = "ničiji sin"
sql_create_context
CREATE TABLE wdmzjzjlb ( HXPLC number, HZXM text, JLSJ time, JZJSSJ time, JZKSBM text, JZKSMC text, JZKSRQ time, JZLSH number, JZZDBM text, JZZDSM text, JZZTDM number, JZZTMC text, KH text, KLX number, MJZH text, ML number, MZZYZDZZBM text, MZZYZDZ...
在二零零一年五月二十八日到二零二一年九月二十一日的这二十年里,查一下医疗机构9694993新生儿门诊的就诊记录数量
SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.YLJGDM = '9694993' AND wdmzjzjlb.JZKSRQ BETWEEN '2001-05-28' AND '2021-09-21' AND wdmzjzjlb.ZSEBZ > 0 UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.YLJGDM = '9694993' AND bdmzjzjlb.JZKSRQ BETWEEN '2001-05-28' AND '2021-09-21' AND bdmzjzjlb.ZSEBZ > 0
css
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, ...
how many patients have undergone aortocor bypas-2 cor art within 2 months during this year after the previous procedure of parent infus nutrit sub?
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'parent infu...
mimic_iii
CREATE TABLE table_name_95 ( visitor VARCHAR, date VARCHAR )
Who is the visitor on the date december 31?
SELECT visitor FROM table_name_95 WHERE date = "december 31"
sql_create_context
CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, availa...
Show the facility codes of apartments with more than 4 bedrooms, and count them by a bar chart, list facility_code from high to low order.
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 facility_code DESC
nvbench
CREATE TABLE table_name_42 ( driver VARCHAR, year VARCHAR )
Who is the driver from 1969?
SELECT driver FROM table_name_42 WHERE year = "1969"
sql_create_context
CREATE TABLE table_37371 ( "Date" text, "League position" text, "Opponents" text, "Venue" text, "Result" text, "Score F\u2013A" text, "Attendance" real )
How many were in attendance when the league position was 16th and the score was F A of 0 3?
SELECT COUNT("Attendance") FROM table_37371 WHERE "League position" = '16th' AND "Score F\u2013A" = '0–3'
wikisql
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ...
when was the last microbiological test of patient 031-3355 performed in 12/2105?
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355')) AND STRFTIME('%y-%m', microlab.culturetakentime) = '2...
eicu
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 027-95744 been diagnosed with anything since 2105.
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-95744')) AND STRFTIME('%y', diagnosis.diagnosistime) >= '2105'
eicu
CREATE TABLE table_22893781_6 ( date VARCHAR, team VARCHAR )
Name the number of date for dallas
SELECT COUNT(date) FROM table_22893781_6 WHERE team = "Dallas"
sql_create_context
CREATE TABLE table_name_56 ( surface VARCHAR, tournament VARCHAR )
What kind of surface was the tournament at Pune played on?
SELECT surface FROM table_name_56 WHERE tournament = "pune"
sql_create_context
CREATE TABLE table_47814 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
What team played the Jazz at game 68?
SELECT "Team" FROM table_47814 WHERE "Game" = '68'
wikisql
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text,...
what's the name of the drug that patient 41393's been prescribed two or more times until 03/2103?
SELECT t1.drug FROM (SELECT prescriptions.drug, COUNT(prescriptions.startdate) AS c1 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 41393) AND STRFTIME('%y-%m', prescriptions.startdate) <= '2103-03' GROUP BY prescriptions.drug) AS t1 WHERE t1.c...
mimic_iii
CREATE TABLE table_28617 ( "#" real, "Player" text, "Points" real, "Rebounds" real, "Assists" real, "Opponent" text, "Date" text )
List the lowest number of assists.
SELECT MIN("Assists") FROM table_28617
wikisql
CREATE TABLE table_32498 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
Who was the home team when Hawthorn was the away team?
SELECT "Home team" FROM table_32498 WHERE "Away team" = 'hawthorn'
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
how many patients admitted before the year 2156 have diagnosis icd9 code 76518?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2156" AND diagnoses.icd9_code = "76518"
mimicsql_data
CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE head ( head_ID int, name text, born_state text, age real ) CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num...
Show sum of budget in each year and bin creation time by year in a line chart, and could you rank from low to high by the X?
SELECT Creation, SUM(Budget_in_Billions) FROM department ORDER BY Creation
nvbench