context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE table_26375386_22 ( judges VARCHAR, public VARCHAR )
Name the judges for 4 public
SELECT judges FROM table_26375386_22 WHERE public = 4
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
this month was the heart rate of patient 10855 ever greater than 95.0?
SELECT COUNT(*) > 0 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 = 10855)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d...
mimic_iii
CREATE TABLE table_name_74 ( circuit VARCHAR, winning_driver VARCHAR, round VARCHAR )
Which Circuit has a Winning Driver of hans-joachim stuck, and a Round of 3?
SELECT circuit FROM table_name_74 WHERE winning_driver = "hans-joachim stuck" AND round = 3
sql_create_context
CREATE TABLE table_55658 ( "Player" text, "Pos." text, "From" real, "School/Country" text, "Rebs" real, "Asts" real )
What's the pos for an asts less than 117?
SELECT "Pos." FROM table_55658 WHERE "Asts" < '117'
wikisql
CREATE TABLE diagnoses ( 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 ) C...
provide the number of patients whose diagnosis long title is other preterm infants, 1,250-1,499 grams.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Other preterm infants, 1,250-1,499 grams"
mimicsql_data
CREATE TABLE table_65640 ( "Peak" text, "Country" text, "Elevation (m)" real, "Prominence (m)" real, "Col (m)" real )
How much Elevation (m) has a Prominence (m) larger than 2,876?
SELECT COUNT("Elevation (m)") FROM table_65640 WHERE "Prominence (m)" > '2,876'
wikisql
CREATE TABLE table_name_83 ( metal VARCHAR, denomination VARCHAR )
What metal has one rupee as the denomination?
SELECT metal FROM table_name_83 WHERE denomination = "one rupee"
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime t...
what is the four most frequent drugs that were prescribed in the same hospital visit to a chest pain female patient 20s after they have been diagnosed with chest pain?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'chest pain') AS...
eicu
CREATE TABLE table_23308178_4 ( points INTEGER, date VARCHAR )
How many points were there scored on October 27?
SELECT MAX(points) FROM table_23308178_4 WHERE date = "October 27"
sql_create_context
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, U...
Top users per country with max count.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE LOWER('%##Country##%') ORDER BY Reputation DESC LIMIT 100
sede
CREATE TABLE table_10236830_4 ( actors_name VARCHAR, country VARCHAR )
Which actors are from Ukraine?
SELECT actors_name FROM table_10236830_4 WHERE country = "Ukraine"
sql_create_context
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, ...
What special topics classes are there next Winter ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester WHERE (course.number = 398 OR course.number = 498 OR course.number = 598) AND course.department = 'E...
advising
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDa...
how many question do i left.
SELECT * FROM Posts WHERE OwnerUserId = 859154 AND CreationDate >= DATEADD(month, -1, GETDATE()) AND PostTypeId = 1
sede
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
count the number of patients whose primary disease is pneumonia and procedure short title is circumcision?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "PNEUMONIA" AND procedures.short_title = "Circumcision"
mimicsql_data
CREATE TABLE table_71877 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Which Venue has a Date of january 9, 2011?
SELECT "Venue" FROM table_71877 WHERE "Date" = 'january 9, 2011'
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 ...
能告诉我病人97231052所有医疗记录中医疗费总额不低于9587.83元的入院诊断疾病名称是什么吗?疾病编码呢
SELECT t_kc21.OUT_DIAG_DIS_CD, t_kc21.OUT_DIAG_DIS_NM FROM t_kc21 WHERE t_kc21.PERSON_ID = '97231052' AND t_kc21.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT >= 9587.83)
css
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) 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...
what is the number of patients whose insurance is private and procedure long title is colostomy, not otherwise specified?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Colostomy, not otherwise specified"
mimicsql_data
CREATE TABLE table_15325 ( "Version" text, "Code name" text, "Release date" text, "API level" real, "Distribution" text )
with api level of 18, what's the code name?
SELECT "Code name" FROM table_15325 WHERE "API level" = '18'
wikisql
CREATE TABLE table_name_33 ( city VARCHAR, floors INTEGER )
What city has a building with over 57 floors?
SELECT city FROM table_name_33 WHERE floors > 57
sql_create_context
CREATE TABLE table_2446333_2 ( date VARCHAR, sprint_winner VARCHAR )
Name the date for sprint winner mexico
SELECT date FROM table_2446333_2 WHERE sprint_winner = "Mexico"
sql_create_context
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, ...
what was the isotonic sodium chloride dose that was prescribed to patient 9566 in this hospital encounter for the first time?
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9566 AND admissions.dischtime IS NULL) AND prescriptions.drug = 'isotonic sodium chloride' ORDER BY prescriptions.startdate LIMIT 1
mimic_iii
CREATE TABLE table_name_16 ( overall_record VARCHAR, team VARCHAR )
What is the overall record of the Ravens?
SELECT overall_record FROM table_name_16 WHERE team = "ravens"
sql_create_context
CREATE TABLE table_596 ( "No" real, "Player" text, "Height" text, "Position" text, "Year born" real, "Current Club" text )
What height is player number 9?
SELECT "Height" FROM table_596 WHERE "No" = '9'
wikisql
CREATE TABLE table_39998 ( "Round" real, "Overall" real, "Player" text, "Position" text, "College" text )
What is the number for overall for angelo craig?
SELECT COUNT("Overall") FROM table_39998 WHERE "Player" = 'angelo craig'
wikisql
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text, person_info_CSD text, person_info_CSRQ time, person_info_GJDM text, person_info_GJMC text, person_info_JGDM text, person_info_JGMC text, person_info_MZDM text, person_info_MZMC text, person_info_XBDM ...
列出病人王阳焱从0七年八月二十一日起,至0九年一月二日止的所有检验结果指标记录中的检测方法
SELECT jyjgzbb.JCFF FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN 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 = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE hz_in...
css
CREATE TABLE table_name_19 ( gold INTEGER, nation VARCHAR, bronze VARCHAR )
What is the average Gold entry for the Netherlands that also has a Bronze entry that is greater than 0?
SELECT AVG(gold) FROM table_name_19 WHERE nation = "netherlands" AND bronze > 0
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
what is the number of patients whose admission location is trsf within this facility and primary disease is angioedema?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "ANGIOEDEMA"
mimicsql_data
CREATE TABLE table_name_40 ( ning INTEGER, plaxo VARCHAR, bebo VARCHAR, orkut VARCHAR )
What is the highest Ning that has a bebo less than 4, an orkut less than 100, with a plaxo greater than 0?
SELECT MAX(ning) FROM table_name_40 WHERE bebo < 4 AND orkut < 100 AND plaxo > 0
sql_create_context
CREATE TABLE table_204_388 ( id number, "#" number, "date" text, "visitor" text, "score" text, "home" text, "record" text, "pts" number )
what is was the difference in score in the december 19th win ?
SELECT ABS("score" - "score") FROM table_204_388 WHERE "date" = 'december 19'
squall
CREATE TABLE table_70580 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
What was the score of the game when the attendance was 1,644?
SELECT "Score" FROM table_70580 WHERE "Attendance" = '1,644'
wikisql
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate n...
what was the number of patients diagnosed with chest pain - r/o myocardial ischemia within 2 months after cardiac surgery consultation, this year?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'cardiac surgery consultation' AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME...
eicu
CREATE TABLE table_11900773_5 ( illustration VARCHAR, theme VARCHAR )
Who created the illustration for the stamp that was themed 100 years of scouting?
SELECT illustration FROM table_11900773_5 WHERE theme = "100 Years of Scouting"
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
零九年八月一日到一二年五月十二日的这段时间里,8225788医疗机构中哪5个科室消耗统筹金额最多
SELECT t_kc24.t_kc21_MED_ORG_DEPT_CD, t_kc24.t_kc21_MED_ORG_DEPT_NM FROM t_kc24 WHERE t_kc24.t_kc21_MED_SER_ORG_NO = '8225788' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2009-08-01' AND '2012-05-12' GROUP BY t_kc24.t_kc21_MED_ORG_DEPT_CD ORDER BY SUM(t_kc24.OVE_PAY) DESC LIMIT 5
css
CREATE TABLE table_17360840_9 ( location VARCHAR, opponent VARCHAR )
How many locations were recorded when the opponent Columbus Blue Jackets?
SELECT COUNT(location) FROM table_17360840_9 WHERE opponent = "Columbus Blue Jackets"
sql_create_context
CREATE TABLE table_64797 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
What is the Week number with an Attendance of 62,123?
SELECT COUNT("Week") FROM table_64797 WHERE "Attendance" = '62,123'
wikisql
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_care...
what are patient 70709's genders?
SELECT patients.gender FROM patients WHERE patients.subject_id = 70709
mimic_iii
CREATE TABLE table_67225 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Which time has a Rank larger than 3, and a Name of andrey kapralov?
SELECT "Time" FROM table_67225 WHERE "Rank" > '3' AND "Name" = 'andrey kapralov'
wikisql
CREATE TABLE table_19563 ( "School Year" text, "Class A" text, "Class AA" text, "Class AAA" text, "Class AAAA" text, "Class AAAAA" text )
What was the class AAAA when San Angelo Lake View was the class AAAA
SELECT "Class AAAAA" FROM table_19563 WHERE "Class AAAA" = 'San Angelo Lake View'
wikisql
CREATE TABLE table_10515 ( "Edition" real, "Year" real, "Winner" text, "Runner-up" text, "Third" text, "Fourth" text )
Tell me the lowest edition for winner of arsenal and third of celtic
SELECT MIN("Edition") FROM table_10515 WHERE "Winner" = 'arsenal' AND "Third" = 'celtic'
wikisql
CREATE TABLE table_30057479_1 ( researched_at VARCHAR, geometry VARCHAR )
Where was d: 25~70nm, l: 10~20 m geometry researched?
SELECT researched_at FROM table_30057479_1 WHERE geometry = "D: 25~70nm, L: 10~20 μm"
sql_create_context
CREATE TABLE people ( people_id number, name text, height number, weight number, birth_date text, birth_place text ) CREATE TABLE body_builder ( body_builder_id number, people_id number, snatch number, clean_jerk number, total number )
What are the birth date and birth place of the body builder with the highest total points?
SELECT T2.birth_date, T2.birth_place FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id ORDER BY T1.total DESC LIMIT 1
spider
CREATE TABLE table_30087032_5 ( game VARCHAR, high_rebounds VARCHAR )
In how many different games did Oliver Miller (7) did the high rebounds?
SELECT COUNT(game) FROM table_30087032_5 WHERE high_rebounds = "Oliver Miller (7)"
sql_create_context
CREATE TABLE table_74245 ( "\u2116" real, "#" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text )
Who wrote the episode which was directed by Nick Marck?
SELECT "Written by" FROM table_74245 WHERE "Directed by" = 'Nick Marck'
wikisql
CREATE TABLE table_3947 ( "Represent Province" text, "Contestant" text, "Age" real, "Height (ft.)" text, "Height (mtr.)" text, "Hometown" text )
How many contestants are 1.80 mtr. in height?
SELECT COUNT("Contestant") FROM table_3947 WHERE "Height (mtr.)" = '1.80'
wikisql
CREATE TABLE table_name_38 ( player VARCHAR, country VARCHAR, score VARCHAR )
Who is the player from the United States with a score of 71-72=143?
SELECT player FROM table_name_38 WHERE country = "united states" AND score = 71 - 72 = 143
sql_create_context
CREATE TABLE table_204_135 ( id number, "position" number, "club" text, "played" number, "points" number, "wins" number, "draws" number, "losses" number, "goals for" number, "goals against" number, "goal difference" number )
were there any clubs that had no losses ?
SELECT (SELECT COUNT("club") FROM table_204_135 WHERE "losses" = 0) > 0
squall
CREATE TABLE table_name_47 ( position VARCHAR, team_performance VARCHAR, team_defense_rank VARCHAR, year VARCHAR )
What was the position of the player whose team lost super bowl xxv before 1992, with a team defense rank larger than 3?
SELECT position FROM table_name_47 WHERE team_defense_rank > 3 AND year < 1992 AND team_performance = "lost super bowl xxv"
sql_create_context
CREATE TABLE table_10914 ( "Matches" real, "Innings" real, "Not Outs" real, "Runs" real, "Average" real )
What is the total number of runs when the average was less than 31.25 and there were fewer than 24 innings?
SELECT COUNT("Runs") FROM table_10914 WHERE "Average" > '31.25' AND "Innings" < '24'
wikisql
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 prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, ...
has ever been the arterial bp mean of patient 1902 been ever less than 77.0 since 3 days ago?
SELECT COUNT(*) > 0 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 = 1902)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' ...
mimic_iii
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CRE...
Calculate Percentage of DBA Users per User and Regular DBA Users per User.
GO
sede
CREATE TABLE table_29181 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 28 Aug" text )
How many times was the time 20' 05.19 112.703mph on Thurs Aug 26th?
SELECT COUNT("Sat 21 Aug") FROM table_29181 WHERE "Thurs 26 Aug" = '20'' 05.19 112.703mph'
wikisql
CREATE TABLE table_33060 ( "Institution" text, "Location" text, "Men\u2019s Nickname" text, "Women\u2019s Nickname" text, "Founded" real, "Type" text, "Enrollment" real, "Joined" text, "Left" text, "Current Conference" text, "Classification" text )
What American Southwest Conference school was founded in 1883?
SELECT "Institution" FROM table_33060 WHERE "Founded" > '1883' AND "Current Conference" = 'american southwest'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
For those employees who do not work in departments with managers that have ids between 100 and 200, for commission_pct, hire_date, visualize the trend, sort X in asc order.
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE
nvbench
CREATE TABLE table_name_11 ( height VARCHAR, player VARCHAR )
How tall is nerlens noel?
SELECT height FROM table_name_11 WHERE player = "nerlens noel"
sql_create_context
CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChang...
Run query on all stackexchange databases.
SELECT @Names
sede
CREATE TABLE table_56625 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
How long was the fight 'adrenaline mma 3'?
SELECT "Time" FROM table_56625 WHERE "Event" = 'adrenaline mma 3'
wikisql
CREATE TABLE table_15938543_1 ( production_code VARCHAR, written_by VARCHAR )
How many episodes were written by Jack Burditt & Robert Carlock
SELECT COUNT(production_code) FROM table_15938543_1 WHERE written_by = "Jack Burditt & Robert Carlock"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
what were the four most common procedures among the patients 20s until 2103?
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 20 AND 29) AND STRFTIME('%y', treatment.treatmenttime) <= '2103' GROUP BY treatment....
eicu
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 ...
39911215患者之前都有哪些住院诊断书
SELECT wdmzjzjlb.ZYZDBM, wdmzjzjlb.ZYZDMC FROM hz_info JOIN wdmzjzjlb ON hz_info.YLJGDM = wdmzjzjlb.YLJGDM AND hz_info.KH = wdmzjzjlb.KH AND hz_info.KLX = wdmzjzjlb.KLX WHERE hz_info.RYBH = '39911215' UNION SELECT bdmzjzjlb.ZYZDBM, bdmzjzjlb.ZYZDMC FROM hz_info JOIN bdmzjzjlb ON hz_info.YLJGDM = bdmzjzjlb.YLJGDM AND hz...
css
CREATE TABLE table_name_9 ( home_team VARCHAR, away_team VARCHAR )
In the match played against Telford United, who was the home team?
SELECT home_team FROM table_name_9 WHERE away_team = "telford united"
sql_create_context
CREATE TABLE table_name_1 ( number_of_households INTEGER, median_household_income VARCHAR, population VARCHAR )
Which Number of households has a Median household income of $32,806, and a Population larger than 11,291?
SELECT MAX(number_of_households) FROM table_name_1 WHERE median_household_income = "$32,806" AND population > 11 OFFSET 291
sql_create_context
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...
医疗机构8444341就诊人数里,住院天数超过30天的有多少
SELECT COUNT(hz_info.RYBH) FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_in...
css
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0...
For those employees who did not have any job in the past, for department_id, hire_date, visualize the trend.
SELECT HIRE_DATE, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
nvbench
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, ...
provide the number of patients whose insurance is government and lab test name is wbc, joint fluid?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Government" AND lab.label = "WBC, Joint Fluid"
mimicsql_data
CREATE TABLE table_34028 ( "Site" text, "Bebo" real, "Facebook" real, "Friendster" real, "LinkedIn" real, "MySpace" real, "Ning" real, "Orkut" real, "Plaxo" real )
What is the average plaxo that has a myspace greater than 64, a bebo greater than 3, with 4 as the friendster?
SELECT AVG("Plaxo") FROM table_34028 WHERE "MySpace" > '64' AND "Bebo" > '3' AND "Friendster" = '4'
wikisql
CREATE TABLE table_name_15 ( result VARCHAR, date VARCHAR )
What was the result on October 1, 1989?
SELECT result FROM table_name_15 WHERE date = "october 1, 1989"
sql_create_context
CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe tex...
Top User of a Given Tag in New Zealand.
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", TagName, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ...
sede
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 text, INPT_AREA_BED text, INSURED_IDENTITY number, INSURED_STS text, ...
患者32179054的医保医疗费有多少是在04年2月21日到2013年8月10日期间使用的?
SELECT SUM(t_kc24.MED_AMOUT) FROM t_kc24 WHERE t_kc24.PERSON_ID = '32179054' AND t_kc24.CLINIC_SLT_DATE BETWEEN '2004-02-21' AND '2013-08-10'
css
CREATE TABLE table_203_187 ( id number, "conference" text, "bids" number, "record" text, "win %" number, "quarterfinals" number, "semifinals" number, "final" number, "champions" number )
how many teams had no wins ?
SELECT COUNT("conference") FROM table_203_187 WHERE "win %" = 0
squall
CREATE TABLE table_10795 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
What was the attendance for the game where the score was 0-6?
SELECT "Attendance" FROM table_10795 WHERE "Score" = '0-6'
wikisql
CREATE TABLE table_1341586_19 ( district VARCHAR, incumbent VARCHAR )
how many district with incumbent being lindy boggs
SELECT COUNT(district) FROM table_1341586_19 WHERE incumbent = "Lindy Boggs"
sql_create_context
CREATE TABLE table_67744 ( "Season" real, "Season Premiere Date" text, "Season Finale Date" text, "Winner" text, "1st Runner Up" text, "2nd Runner Up" text )
When was the season finale of a show with season premiere on 12 December 2010?
SELECT "Season Finale Date" FROM table_67744 WHERE "Season Premiere Date" = '12 december 2010'
wikisql
CREATE TABLE table_16527640_3 ( location VARCHAR, vfl_games VARCHAR )
What location had a VFL Game number of 9?
SELECT location FROM table_16527640_3 WHERE vfl_games = 9
sql_create_context
CREATE TABLE table_33725 ( "Year" real, "Kit Supplier" text, "Sponsor" text, "Shirt Printing" text, "Notes" text )
What are the notes for the shirt that says +1 in the kit supplied by Rapido?
SELECT "Notes" FROM table_33725 WHERE "Kit Supplier" = 'rapido' AND "Shirt Printing" = '名品+1'
wikisql
CREATE TABLE table_23958944_6 ( no_by_series VARCHAR, no_by_season VARCHAR )
Name the number of series for 19
SELECT no_by_series FROM table_23958944_6 WHERE no_by_season = 19
sql_create_context
CREATE TABLE table_20020 ( "Locale" text, "Skip" text, "W" real, "L" real, "PF" real, "PA" real, "Ends Won" real, "Ends Lost" real, "Blank Ends" real, "Stolen Ends" real, "Shot Pct." real )
Name the most pa for ontario
SELECT MAX("PA") FROM table_20020 WHERE "Locale" = 'Ontario'
wikisql
CREATE TABLE table_55514 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
who is the constructor when the grid is more than 23 and the driver is piercarlo ghinzani?
SELECT "Constructor" FROM table_55514 WHERE "Grid" > '23' AND "Driver" = 'piercarlo ghinzani'
wikisql
CREATE TABLE table_44066 ( "Season" text, "Games" real, "Yellow Cards" real, "Red Cards" real, "Average Cards a game" real )
Which Yellow Cards has a Season of 1999/2000?
SELECT AVG("Yellow Cards") FROM table_44066 WHERE "Season" = '1999/2000'
wikisql
CREATE TABLE table_name_6 ( position INTEGER, pilot VARCHAR )
What is the lowest position for bruce taylor?
SELECT MIN(position) FROM table_name_6 WHERE pilot = "bruce taylor"
sql_create_context
CREATE TABLE table_name_67 ( distance VARCHAR, jockey VARCHAR, result VARCHAR )
How far did p. carbery run to get 2nd?
SELECT distance FROM table_name_67 WHERE jockey = "p. carbery" AND result = "2nd"
sql_create_context
CREATE TABLE table_42296 ( "Office" text, "Democratic ticket" text, "Republican ticket" text, "American Labor ticket" text, "Socialist ticket" text )
Who's the Socialist ticket with a Republican ticket of john a. may?
SELECT "Socialist ticket" FROM table_42296 WHERE "Republican ticket" = 'john a. may'
wikisql
CREATE TABLE table_26854 ( "Year" real, "Mutya ng Pilipinas Asia Pacific" text, "1st runner-up" text, "2nd runner-up" text, "3rd runner-up" text, "4th runner-up" text )
List the number of years where ritchie ocampo was the mutya ng pilipinas winner.
SELECT COUNT("Year") FROM table_26854 WHERE "Mutya ng Pilipinas Asia Pacific" = 'Ritchie Ocampo'
wikisql
CREATE TABLE table_57354 ( "Date" text, "Series" text, "Circuit" text, "City / State" text, "Winner" text, "Team" text )
Tell me the city/state for the holden racing team with winner of mark skaife todd kelly
SELECT "City / State" FROM table_57354 WHERE "Team" = 'holden racing team' AND "Winner" = 'mark skaife todd kelly'
wikisql
CREATE TABLE table_name_6 ( silver INTEGER, gold VARCHAR, rank VARCHAR )
what is the amount of silver when gold is 2 and the rank is more than 1?
SELECT AVG(silver) FROM table_name_6 WHERE gold = 2 AND rank > 1
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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
how much patient 24762 weighs until 52 months ago for the last time?
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 = 24762)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt'...
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
mention the type of insurance and admission location of subject id 15898.
SELECT demographic.insurance, demographic.admission_location FROM demographic WHERE demographic.subject_id = "15898"
mimicsql_data
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepi...
has patient 030-34260 been diagnosed with s/p knee surgery - replacement when they came to the hospital first time.
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 = '030-34260' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.ho...
eicu
CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, Li...
Questions closed or reopened the highest number of times.
SELECT 'site://q/' + CAST(q.Id AS TEXT) + '/' + CAST(MIN(m.Id) AS TEXT) + '|' + MIN(q.Title) AS qti, COUNT(e.Id) AS ere, q.OwnerUserId AS "User Link" FROM Posts AS q JOIN PostHistory AS e ON q.Id = e.PostId LEFT JOIN Users AS m ON m.AccountId = 1192385 WHERE q.PostTypeId = 1 AND e.PostHistoryTypeId IN (10, 11) GROUP BY...
sede
CREATE TABLE table_name_93 ( tournament VARCHAR )
What is Tournament, when 2006 is 'A', and when 2009 is 'A'?
SELECT tournament FROM table_name_93 WHERE 2006 = "a" AND 2009 = "a"
sql_create_context
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40)...
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by time, and could you list y axis in ascending order?
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(MANAGER_ID)
nvbench
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), fam...
Find the student ID and personal name of the student with at least two enrollments, and could you display in ascending by the y-axis?
SELECT T2.personal_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T1.student_id
nvbench
CREATE TABLE table_name_51 ( t_100 VARCHAR, is_3_m1945 VARCHAR )
What's the T-100 when the IS-3 is 150 (225)?
SELECT t_100 FROM table_name_51 WHERE is_3_m1945 = "150 (225)"
sql_create_context
CREATE TABLE table_name_73 ( owner VARCHAR, name VARCHAR )
Which owner had MRT 1 HD?
SELECT owner FROM table_name_73 WHERE name = "mrt 1 hd"
sql_create_context
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, ...
为病人陶宏伯检测降钙素原的在06年5月31日到21年10月31日内的医务人员工号及姓名都是什么?
(SELECT jyjgzbb.JCRGH, jyjgzbb.JCRXM FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND j...
css
CREATE TABLE jybgb ( YLJGDM text, YLJGDM_MZJZJLB text, YLJGDM_ZYJZJLB text, BGDH text, BGRQ time, JYLX number, JZLSH text, JZLSH_MZJZJLB text, JZLSH_ZYJZJLB text, JZLX number, KSBM text, KSMC text, SQRGH text, SQRXM text, BGRGH text, BGRXM text, SHRGH ...
列出患者赵宏义的所有检验结果指标记录在2014-02-10到2019-02-10内的检测人为56821852的检验指标流水号是多少?
(SELECT jyjgzbb.JYZBLSH FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM =...
css
CREATE TABLE table_204_534 ( id number, "#" number, "name" text, "height" text, "weight (lbs.)" number, "position" text, "class" text, "hometown" text, "previous team(s)" text )
what is the difference in weight between dexter fields and quincy taylor ?
SELECT ABS((SELECT "weight (lbs.)" FROM table_204_534 WHERE "name" = 'dexter fields') - (SELECT "weight (lbs.)" FROM table_204_534 WHERE "name" = 'quincy taylor'))
squall
CREATE TABLE table_36626 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
When was the score 7-1?
SELECT "Date" FROM table_36626 WHERE "Score" = '7-1'
wikisql
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
what is the number of patients whose age is below 89 years and had the procedure initial insertion of single-chamber device, rate responsive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "89" AND procedures.long_title = "Initial insertion of single-chamber device, rate responsive"
mimicsql_data
CREATE TABLE table_name_3 ( grid INTEGER, constructor VARCHAR, laps VARCHAR )
What was the average grid at the time Vanwall was constructor and there were 17 laps?
SELECT AVG(grid) FROM table_name_3 WHERE constructor = "vanwall" AND laps = 17
sql_create_context
CREATE TABLE table_59270 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
What is the lowest positioned club with points greater than 40, 16 wins and losses less than 3?
SELECT MIN("Position") FROM table_59270 WHERE "Points" > '40' AND "Wins" = '16' AND "Loses" < '3'
wikisql