context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 ...
门诊诊断为患者的检测指标569976疾病K19.872的数值的最值以及平均值都分别是多少?
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN zyjybgb JOIN jyjgzbb ON mzjzjlb.YLJGDM = zyjybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = zyjybgb.JZLSH_MZJZJLB AND zyjybgb.YLJGDM = jyjgzbb.YLJGDM AND zyjybgb.BGDH = jyjgzbb.BGDH WHERE mzjzjlb.JZZDBM = 'K19.872' AND jyjgzbb.JCZBDM =...
css
CREATE TABLE table_37470 ( "Airdate" text, "Celebrities" text, "Rating" real, "Share" real, "18\u201349" text, "Viewers (millions)" real, "Weekly rank" text, "Prod. code" real )
Which rating larger than 5 have the lowest amount of views in #3 rank with a share of 9?
SELECT MIN("Viewers (millions)") FROM table_37470 WHERE "Weekly rank" = '#3' AND "Share" = '9' AND "Rating" > '5'
wikisql
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...
let me know the type of admission and short title of diagnoses for patient with patient id 74032.
SELECT demographic.admission_type, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "74032"
mimicsql_data
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
what are the five frequently ordered treatments for patients with age 30s?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 5
eicu
CREATE TABLE table_name_76 ( machine VARCHAR, rider VARCHAR )
What machine did Keith T. Gawler ride?
SELECT machine FROM table_name_76 WHERE rider = "keith t. gawler"
sql_create_context
CREATE TABLE table_name_17 ( national_university_of_ireland VARCHAR, industrial_and_commercial_panel VARCHAR, cultural_and_educational_panel VARCHAR )
What is the total for National University of Ireland with an industrial and commercial panel less than 1, and the cultural and educational panel bigger than 0?
SELECT COUNT(national_university_of_ireland) FROM table_name_17 WHERE industrial_and_commercial_panel < 1 AND cultural_and_educational_panel > 0
sql_create_context
CREATE TABLE table_11900773_4 ( paper_type VARCHAR, theme VARCHAR )
What kind of paper were the stamps with the theme duck decoys, barrow's golden eye printed on?
SELECT paper_type FROM table_11900773_4 WHERE theme = "Duck Decoys, Barrow's Golden Eye"
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, ...
门诊诊断病人方鹏云为精神分裂症的检测指标162731的结果定量及其单位各是什么呀?
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb 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 = jyjgzbb.jybgb_YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jyjgzbb.jybgb_JZLSH_MZJ...
css
CREATE TABLE table_name_6 ( bronze VARCHAR, nation VARCHAR, total VARCHAR )
How many bronzes have a Nation of jamaica (jam), and a Total smaller than 7?
SELECT COUNT(bronze) FROM table_name_6 WHERE nation = "jamaica (jam)" AND total < 7
sql_create_context
CREATE TABLE table_13785 ( "Rank" real, "Athlete" text, "Country" text, "Time" text, "Notes" text )
Which athlete represented the country of egypt?
SELECT "Athlete" FROM table_13785 WHERE "Country" = 'egypt'
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, ...
how many patients are diagnosed with primary disease atrial fibrillation\thoracoscopic maze procedure bilateral/sda and died before 2115?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" AND demographic.dod_year <= "2115.0"
mimicsql_data
CREATE TABLE table_22645714_5 ( regular_season_winner VARCHAR, tournament_winner VARCHAR )
Who had the best regular season in the contest won by Arkansas-Pine Bluff?
SELECT regular_season_winner FROM table_22645714_5 WHERE tournament_winner = "Arkansas-Pine Bluff"
sql_create_context
CREATE TABLE table_name_23 ( leader_at_the_summit VARCHAR, year VARCHAR )
Who was the leader at the summit for the race in 2005?
SELECT leader_at_the_summit FROM table_name_23 WHERE year = 2005
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
give the number of patients whose primary disease is st-segment elevation myocardial infarction\cardiac cath and drug route is im
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "ST-SEGMENT ELEVATION MYOCARDIAL INFARCTION\CARDIAC CATH" AND prescriptions.route = "IM"
mimicsql_data
CREATE TABLE table_15491596_1 ( chassis VARCHAR, no VARCHAR )
How many chassis used number 34?
SELECT COUNT(chassis) FROM table_15491596_1 WHERE no = 34
sql_create_context
CREATE TABLE table_9310 ( "Player" text, "Team" text, "Matches" real, "Innings" real, "Runs" real, "Average" real, "Highest Score" text, "100s" real )
Which player has less than 2 in the 100s category, more than 4 matches, and an average greater than 42.75?
SELECT "Player" FROM table_9310 WHERE "100s" < '2' AND "Average" > '42.75' AND "Matches" > '4'
wikisql
CREATE TABLE table_79911 ( "Name" text, "Period" text, "League" real, "FA Cup" real, "League Cup" real, "Other" real, "Total" real )
What is the lowest number of League Cups a player with a 434 league has?
SELECT MIN("League Cup") FROM table_79911 WHERE "League" = '434'
wikisql
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
14岁以上病人的所有医疗记录的医疗费平均总额是多少
SELECT AVG(MED_AMOUT) FROM t_kc24 WHERE MED_CLINIC_ID IN (SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_AGE > 14)
css
CREATE TABLE table_63442 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text )
What is the rank for the team that had a time of 6:41.45 and note FA?
SELECT SUM("Rank") FROM table_63442 WHERE "Notes" = 'fa' AND "Time" = '6:41.45'
wikisql
CREATE TABLE table_name_57 ( motor VARCHAR, quantity VARCHAR, class VARCHAR )
Which motor's quantity was more than 8, and a class of bs 1915?
SELECT motor FROM table_name_57 WHERE quantity > 8 AND class = "bs 1915"
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, ...
从2012年10月17日到2017年12月25日之间名叫张静雅的患者就诊过多少个医生?
SELECT COUNT(mzjzjlb.ZZYSGH) FROM person_info JOIN hz_info JOIN mzjzjlb JOIN hz_info_mzjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = hz_info_mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND hz_info_mzjzjlb.JZLSH = mzjzjlb.JZLSH AND hz_info_mzjzjlb.YLJGDM = hz_info_mzjzjlb.YLJ...
css
CREATE TABLE table_16667 ( "Round" real, "Grand Prix" text, "Date" text, "Location" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Constructor" text, "Report" text )
What is the date of the circuit gilles villeneuve?
SELECT "Date" FROM table_16667 WHERE "Location" = 'Circuit Gilles Villeneuve'
wikisql
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, ...
Top 100 most famous (viewed) questions.
SELECT Id AS "post_link", OwnerUserId AS "user_link", ViewCount FROM Posts WHERE PostTypeId = 1 ORDER BY ViewCount DESC LIMIT 100
sede
CREATE TABLE table_name_34 ( total_matches INTEGER, competition VARCHAR, draw VARCHAR )
How many average total matches have league cup as the competition, with a draw greater than 0?
SELECT AVG(total_matches) FROM table_name_34 WHERE competition = "league cup" AND draw > 0
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 ) ...
how many patients whose marital status is divorced and lab test name is cholesterol, hdl?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "DIVORCED" AND lab.label = "Cholesterol, HDL"
mimicsql_data
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 products with a price between 60 and 120, give me the comparison about manufacturer over the name , and show by the names from high to low please.
SELECT Name, Manufacturer FROM Products WHERE Price BETWEEN 60 AND 120 ORDER BY Name DESC
nvbench
CREATE TABLE bdmzjzjlb ( 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...
两千年十一月九日到二零一五年三月十七日,310科室的门诊数量情况
SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.JZKSBM = '310' AND wdmzjzjlb.JZKSRQ BETWEEN '2000-11-09' AND '2015-03-17' UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.JZKSBM = '310' AND bdmzjzjlb.JZKSRQ BETWEEN '2000-11-09' AND '2015-03-17'
css
CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number,...
questions closed by mods vs community (all time).
SELECT UserId, UserId AS "user_link", COUNT(PostId) FROM PostHistory WHERE PostHistoryTypeId = 10 GROUP BY UserId
sede
CREATE TABLE department ( Department_ID int, Name text, Creation text, Ranking int, Budget_in_Billions real, Num_Employees real ) CREATE TABLE management ( department_ID int, head_ID int, temporary_acting text ) CREATE TABLE head ( head_ID int, name text, born_state tex...
How many departments are built in each year? Group by creation time in a line chart, and order by the x axis in asc.
SELECT Creation, COUNT(Creation) FROM department GROUP BY Creation ORDER BY Creation
nvbench
CREATE TABLE table_name_27 ( gdp__ppp__per_capita_2012_eu27_ VARCHAR, _100 VARCHAR, gdp_2012_millions_of_euro VARCHAR )
What is GDP (PPP) Per Capita 2012 EU27 = 100, when GDP 2012 Millions Of Euro is 309,900?
SELECT gdp__ppp__per_capita_2012_eu27_ = _100 FROM table_name_27 WHERE gdp_2012_millions_of_euro = "309,900"
sql_create_context
CREATE TABLE table_22597626_17 ( surface VARCHAR, opponents_in_the_final VARCHAR )
What was the surface for the opponents in the final with fitzgerald vilas?
SELECT surface FROM table_22597626_17 WHERE opponents_in_the_final = "Fitzgerald Vilas"
sql_create_context
CREATE TABLE table_70111 ( "City of license" text, "Identifier" text, "Frequency" text, "Power" text, "Class" text, "RECNet" text )
Which class has an identifier of CBUA-FM?
SELECT "Class" FROM table_70111 WHERE "Identifier" = 'cbua-fm'
wikisql
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...
Total DTD (Range) 'classroom' in Title.
SELECT Id AS "post_link", CreationDate, Tags, Score, AnswerCount, CommentCount FROM Posts WHERE Posts.Title LIKE '%classroom%' AND CreationDate BETWEEN @StartDate AND @EndDate ORDER BY CreationDate
sede
CREATE TABLE table_name_25 ( crowd INTEGER, away_team VARCHAR )
What was the smallest crowd size for away team st kilda?
SELECT MIN(crowd) FROM table_name_25 WHERE away_team = "st kilda"
sql_create_context
CREATE TABLE table_name_22 ( tournament VARCHAR, runner_s__up VARCHAR )
What races were Chi-Chi Rodriguez the runner-up in?
SELECT tournament FROM table_name_22 WHERE runner_s__up = "chi-chi rodriguez"
sql_create_context
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, date_account_opened DATETIME, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Orders ( order_id INTEGER, customer_id INTEGER, date_order_placed DATETIME, order_details VARCHAR(255) ) CREATE...
Show the number of accounts for each customer in a bar chart grouping by customer's first name, I want to sort in descending by the bars.
SELECT customer_first_name, COUNT(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY customer_first_name DESC
nvbench
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 the heartrate of patient 010-9767 ever been greater than 116.0 on 03/01/2105.
SELECT COUNT(*) > 0 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-9767')) AND vitalperiodic.heartrate > 116.0 AND NOT vitalperiodi...
eicu
CREATE TABLE table_5497 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
What is the average total with a nation of thailand with a gold smaller than 17?
SELECT AVG("Total") FROM table_5497 WHERE "Nation" = 'thailand' AND "Gold" < '17'
wikisql
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
Draw a bar chart of affiliation versus sum enrollment, and I want to display y axis from low to high order please.
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation ORDER BY SUM(Enrollment)
nvbench
CREATE TABLE table_26358264_2 ( location VARCHAR, fastest_qualifying VARCHAR )
When cancelled is the fastest qualifying where is the location?
SELECT location FROM table_26358264_2 WHERE fastest_qualifying = "Cancelled"
sql_create_context
CREATE TABLE table_name_49 ( home_team VARCHAR, venue VARCHAR )
What is the home team's score at mcg?
SELECT home_team AS score FROM table_name_49 WHERE venue = "mcg"
sql_create_context
CREATE TABLE table_69434 ( "School" text, "Location" text, "Mascot" text, "# / County" text, "IHSAA Class" text, "Year Joined" real, "Previous Conference" text )
what is the correct year for # / county of 09 cass?
SELECT "Year Joined" FROM table_69434 WHERE "# / County" = '09 cass'
wikisql
CREATE TABLE table_38694 ( "Career Card" text, "Starting career/salary" text, "2nd career/salary" text, "3rd career/salary" text, "4th career/salary" text, "5th career/salary" text, "6th career/salary" text )
5th career/salary of restaurant manager ($250,000) had what 2nd career/salary?
SELECT "2nd career/salary" FROM table_38694 WHERE "5th career/salary" = 'restaurant manager ($250,000)'
wikisql
CREATE TABLE Projects ( project_id VARCHAR, project_details VARCHAR ) CREATE TABLE Project_outcomes ( outcome_code VARCHAR, project_id VARCHAR ) CREATE TABLE Research_outcomes ( outcome_description VARCHAR, outcome_code VARCHAR )
What are the result description of the project whose detail is 'sint'?
SELECT T1.outcome_description FROM Research_outcomes AS T1 JOIN Project_outcomes AS T2 ON T1.outcome_code = T2.outcome_code JOIN Projects AS T3 ON T2.project_id = T3.project_id WHERE T3.project_details = 'sint'
sql_create_context
CREATE TABLE table_name_58 ( result VARCHAR, competition VARCHAR )
What was the result from the 2000 asian cup qualification?
SELECT result FROM table_name_58 WHERE competition = "2000 asian cup qualification"
sql_create_context
CREATE TABLE table_name_62 ( city_of_license VARCHAR, frequency_mhz INTEGER )
What city has larger than 94.1 as a frequency?
SELECT city_of_license FROM table_name_62 WHERE frequency_mhz > 94.1
sql_create_context
CREATE TABLE table_204_302 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
who is ranked # 1 ?
SELECT "nation" FROM table_204_302 WHERE "rank" = 1
squall
CREATE TABLE table_38191 ( "Year (Ceremony)" text, "Film title" text, "Language(s)" text, "Director" text, "Result" text )
What was the result for the fil Paljas?
SELECT "Result" FROM table_38191 WHERE "Film title" = 'paljas'
wikisql
CREATE TABLE table_11649123_1 ( disaster VARCHAR, year VARCHAR )
In 2005-06 what was the disaster?
SELECT disaster FROM table_11649123_1 WHERE year = "2005-06"
sql_create_context
CREATE TABLE table_name_28 ( place VARCHAR, player VARCHAR )
What is the place of Mark O'Meara?
SELECT place FROM table_name_28 WHERE player = "mark o'meara"
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, give me the comparison about the average of code over the name , and group by attribute name by a bar chart, I want to show by the X-axis in descending.
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
nvbench
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,...
在2008年3月25日到2010年1月16日内列出患者14901191在医院1058628中被开出的所有药品编码和名称都是什么?
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc21_t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '14901191' AND t_kc21.MED_SER_ORG_NO = '1058628' AND t_kc21.IN_HOSP_DATE BETWEEN '2008-03-25' AND '2010-01-16')
css
CREATE TABLE table_204_3 ( id number, "rank" number, "name" text, "nationality" text, "time" number )
who ranked number 8 after jose meolans finished in 7th ?
SELECT "name" FROM table_204_3 WHERE "rank" = 8
squall
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
How many patients with morbid obesity/sda primary disease had a csf lab test?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
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...
在14年1月24日到20年12月29日的这段时间里,有多少门诊病人找医生62380761看过病
SELECT COUNT(*) FROM wdmzjzjlb WHERE wdmzjzjlb.ZZYSGH = '62380761' AND wdmzjzjlb.JZKSRQ BETWEEN '2014-01-24' AND '2020-12-29' UNION SELECT COUNT(*) FROM bdmzjzjlb WHERE bdmzjzjlb.ZZYSGH = '62380761' AND bdmzjzjlb.JZKSRQ BETWEEN '2014-01-24' AND '2020-12-29'
css
CREATE TABLE table_203_561 ( id number, "pos" number, "team" text, "total" number, "high" number, "low" number, "average" number, "change" text )
name the only team whose percentage change was positive .
SELECT "team" FROM table_203_561 WHERE "change" > 0
squall
CREATE TABLE table_name_94 ( total INTEGER, bronze VARCHAR, silver VARCHAR )
What is the average total medals of the nation with 4 bronze and more than 1 silver medals?
SELECT AVG(total) FROM table_name_94 WHERE bronze = 4 AND silver > 1
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
what was the name of drug that was prescribed first to patient 021-111547 in 12/this year?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-111547')) AND DATETIME(medication.drugstarttime, 'start of year...
eicu
CREATE TABLE buildings ( id number, name text, city text, height number, stories number, status text ) CREATE TABLE office_locations ( building_id number, company_id number, move_in_year number ) CREATE TABLE companies ( id number, name text, headquarters text, indu...
List the names of buildings in descending order of building height.
SELECT name FROM buildings ORDER BY height DESC
spider
CREATE TABLE table_67680 ( "Year" real, "Tournament" text, "Venue" text, "Result" text, "Extra" text )
What year was the race in Vienna, Austria?
SELECT MIN("Year") FROM table_67680 WHERE "Venue" = 'vienna, austria'
wikisql
CREATE TABLE table_24144 ( "Season" text, "1st Place" text, "2nd Place" text, "3rd Place" text, "4th Place" text )
Name the 1st place for limoges csp
SELECT "1st Place" FROM table_24144 WHERE "3rd Place" = 'Limoges CSP'
wikisql
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 )
What is average age for different job title Visualize by bar chart, I want to display by the job from high to low.
SELECT job, AVG(age) FROM Person GROUP BY job ORDER BY job DESC
nvbench
CREATE TABLE Customers ( customer_status_code VARCHAR )
Which customer status code has least number of customers?
SELECT customer_status_code FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) LIMIT 1
sql_create_context
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 a pie chart to reflect the proportion of All_Home and the sum of School_ID.
SELECT All_Home, SUM(School_ID) FROM basketball_match GROUP BY All_Home
nvbench
CREATE TABLE table_name_35 ( grid VARCHAR, laps VARCHAR )
What is the grid total associated with 18 laps?
SELECT COUNT(grid) FROM table_name_35 WHERE laps = 18
sql_create_context
CREATE TABLE t_kc21 ( MED_CLINIC_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, COMP_ID text, PERSON_ID text, PERSON_NM text, IDENTITY_CARD text, SOC_SRT_CARD text, PERSON_SEX number, PERSON_AGE number, IN_HOSP_DATE time, OUT_HOSP_DATE time, DIFF_PLACE_FLG numb...
77266571这个患者以前得过什么病
SELECT IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '77266571'
css
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
what was the monthly maximum amount of urine catheter given to patient 009-12985 until 62 months ago?
SELECT MAX(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-12985')) AND intakeoutput.celllabel = 'urine...
eicu
CREATE TABLE table_62274 ( "Draw" real, "Language" text, "Artist" text, "Song" text, "English translation" text, "National final" text, "Place" real, "Points" real )
what is the language when the english translation is come to me?
SELECT "Language" FROM table_62274 WHERE "English translation" = 'come to me'
wikisql
CREATE TABLE table_71360 ( "Year" text, "Division" text, "League" text, "Regular Season" text, "Playoffs" text )
What years did the Nashville Metros have Usisl Indoor League?
SELECT "Year" FROM table_71360 WHERE "League" = 'usisl indoor'
wikisql
CREATE TABLE table_name_24 ( laps INTEGER, time_retired VARCHAR, driver VARCHAR )
Tell me the highest laps for time/retired of +2 laps and driver of felice bonetto
SELECT MAX(laps) FROM table_name_24 WHERE time_retired = "+2 laps" AND driver = "felice bonetto"
sql_create_context
CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time...
Amount of unique users for a tag (or tags).
SELECT Id FROM Tags WHERE TagName IN ('office-js')
sede
CREATE TABLE table_60992 ( "Season" text, "LKF Cup" text, "Regional Competitions" text, "Europe" text, "Head Coach" text )
WHAT SEASON HAD COACH JONAS KAZLAUSKAS AT champions cup group stage?
SELECT "Season" FROM table_60992 WHERE "Head Coach" = 'jonas kazlauskas' AND "Europe" = 'champions cup group stage'
wikisql
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, ...
what's last arterial bp [diastolic] value of patient 4368 on 05/28/2105?
SELECT 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 = 4368)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial b...
mimic_iii
CREATE TABLE table_34691 ( "Date" real, "Name" text, "Developer" text, "Clock" text, "Process" text, "Cores per die / Dies per module" text )
What is the latest date with Cores per die / Dies per module of 2 / 1, and a Clock of 1.4-1.6ghz?
SELECT MAX("Date") FROM table_34691 WHERE "Cores per die / Dies per module" = '2 / 1' AND "Clock" = '1.4-1.6ghz'
wikisql
CREATE TABLE table_name_49 ( competition VARCHAR, goal VARCHAR )
What competition has a goal number of 13?
SELECT competition FROM table_name_49 WHERE goal = 13
sql_create_context
CREATE TABLE table_name_73 ( date VARCHAR, attendance VARCHAR )
Which date had 67,472 in attendance?
SELECT date FROM table_name_73 WHERE attendance = "67,472"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetake...
how much is the change of respiration of patient 006-36108 last measured on the first icu visit compared to the value first measured on the first icu visit?
SELECT (SELECT vitalperiodic.respiration FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-36108') AND NOT patient.unitdischargetime I...
eicu
CREATE TABLE table_name_72 ( date VARCHAR, crowd INTEGER )
Which Date has a Crowd smaller than 4,485?
SELECT date FROM table_name_72 WHERE crowd < 4 OFFSET 485
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) 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, ...
列出患者俞夏岚所有检验报告单的审核日期时间在什么时候,在2002-05-16到2003-11-27范围内?
SELECT jybgb.SHSJ FROM person_info JOIN hz_info JOIN wdmzjzjlb JOIN jybgb 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 WHERE person_info.XM = '俞...
css
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, ZZBZ number, WDBZ number, JZKSBM text, JZKSMC text, JZKSRQ time, ...
从11年4月24日到2015年10月6日这一段时间,患者33303356被开出的所有检验报告单的检验报告单号都有哪些?
(SELECT jybgb.BGDH 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 = '33303356' AND jybgb.BGRQ BETWEEN '2011-04-24' AND '2015-10-06') UNI...
css
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,...
For those employees who did not have any job in the past, give me the trend about department_id over hire_date , display in ascending by the HIRE_DATE.
SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_name_29 ( score VARCHAR, opponent_in_the_final VARCHAR )
What was the final score of the game against Lenka Novotn ?
SELECT score FROM table_name_29 WHERE opponent_in_the_final = "lenka novotná"
sql_create_context
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id numbe...
first time patient 2514 got a procedure since 2103?
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 2514) AND STRFTIME('%y', procedures_icd.charttime) >= '2103' ORDER BY procedures_icd.charttime LIMIT 1
mimic_iii
CREATE TABLE table_name_97 ( opponent VARCHAR, attendance VARCHAR )
What is the Opponent at the game with Attendance of 68,436?
SELECT opponent FROM table_name_97 WHERE attendance = "68,436"
sql_create_context
CREATE TABLE table_11621915_1 ( date VARCHAR, tournament VARCHAR )
what's the date with tournament value of ford senior players championship
SELECT date FROM table_11621915_1 WHERE tournament = "Ford Senior Players Championship"
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 d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_icd_procedures ( row_id number, icd9_c...
what are the four drugs most frequently prescribed during the same hospital visit to the patients aged 60 or above after being diagnosed with neutropenia nos in 2100?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_...
mimic_iii
CREATE TABLE table_62186 ( "Name" text, "Championship" real, "League Cup" real, "FA Cup" real, "Total" real )
What is the highest league up with less than 3 championships, a total less than 2, and a FA cup larger than 0?
SELECT MAX("League Cup") FROM table_62186 WHERE "Championship" < '3' AND "Total" < '2' AND "FA Cup" > '0'
wikisql
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, val...
how many procedures of ex cereb meningeal les have been performed in the previous year?
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'ex cereb meningeal les') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
mimic_iii
CREATE TABLE table_5050 ( "Game" text, "Date" text, "Home Team" text, "Result" text, "Road Team" text )
On what date was the result 106-105?
SELECT "Date" FROM table_5050 WHERE "Result" = '106-105'
wikisql
CREATE TABLE departments ( department_id number, dept_store_id number, department_name text ) CREATE TABLE customers ( customer_id number, payment_method_code text, customer_code text, customer_name text, customer_address text, customer_phone text, customer_email text ) CREATE ...
What are the ids and names of customers with addressed that contain WY and who do not use a credit card for payment?
SELECT customer_id, customer_name FROM customers WHERE customer_address LIKE "%WY%" AND payment_method_code <> "Credit Card"
spider
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 much does it cost for patient 27591's hospital stay until 2102.
SELECT SUM(cost.cost) FROM cost WHERE cost.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 27591) AND STRFTIME('%y', cost.chargetime) <= '2102'
mimic_iii
CREATE TABLE table_52806 ( "Year" text, "2010" real, "2009" real, "2008" real, "2005" real, "2000" real, "1995" real, "1990" real, "1985" real )
What is the largest 2000 GDP when the 2008 GDP is smaller than 3,632, 2010 GDP is 2,558 and 2009 GDP is larger than 2,239?
SELECT MAX("2000") FROM table_52806 WHERE "2008" < '3,632' AND "2010" = '2,558' AND "2009" > '2,239'
wikisql
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 is a procedure patient 006-181433 received for the first time on the current hospital visit?
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-181433' AND patient.hospitaldischargetime IS NULL)) ORDER BY ...
eicu
CREATE TABLE table_14757 ( "Series" text, "Name" text, "Hometown" text, "Occupation" text, "Status" text )
What is Hasan Shah's hometown?
SELECT "Hometown" FROM table_14757 WHERE "Name" = 'hasan shah'
wikisql
CREATE TABLE table_204_418 ( id number, "date" text, "opponent" text, "score" text, "overall record" text, "scba record" text )
on how many dates was the sum of the scores at most 10 ?
SELECT COUNT("date") FROM table_204_418 WHERE "score" + "score" <= 10
squall
CREATE TABLE zyjzjlb_jybgb ( YLJGDM_ZYJZJLB text, BGDH number, YLJGDM number ) 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 te...
需要住院就诊54549955809这个门诊主要诊断的编码列表,名称列表和编码类型的详细信息
SELECT zyjzjlb.MZBMLX, zyjzjlb.MZZDBM, zyjzjlb.MZZDMC FROM zyjzjlb WHERE zyjzjlb.JZLSH = '54549955809'
css
CREATE TABLE table_75602 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" real, "Class" text, "FCC info" text )
Frequency MHz smaller than 95.3, and a Call sign of k234ag is what class?
SELECT "Class" FROM table_75602 WHERE "Frequency MHz" < '95.3' AND "Call sign" = 'k234ag'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
what is admission type and admission location of subject name jerry deberry?
SELECT demographic.admission_type, demographic.admission_location FROM demographic WHERE demographic.name = "Jerry Deberry"
mimicsql_data
CREATE TABLE table_26847237_1 ( win_loss VARCHAR, round__number VARCHAR )
Was it a win or loss for Wanganui in round 3?
SELECT win_loss FROM table_26847237_1 WHERE round__number = "Round 3"
sql_create_context
CREATE TABLE table_203_43 ( id number, "polling firm" text, "month" text, "link" text, "favor" number, "oppose" number )
how many zogby international polls took place in the month of august ?
SELECT COUNT("polling firm") FROM table_203_43 WHERE "polling firm" = 'zogby international' AND "month" = 8
squall