context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_...
i will need a RENTAL CAR at NEW YORK
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'NEW YORK' AND ground_service.city_code = city.city_code AND ground_service.transport_type = 'RENTAL CAR'
atis
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
provide the number of patients whose ethnicity is hispanic or latino and procedure is titled other phototherapy.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND procedures.long_title = "Other phototherapy"
mimicsql_data
CREATE TABLE table_name_76 ( opponent VARCHAR, date VARCHAR )
What is Opponent, when Date is 17 September 1998?
SELECT opponent FROM table_name_76 WHERE date = "17 september 1998"
sql_create_context
CREATE TABLE table_name_38 ( opponent VARCHAR, date VARCHAR )
Who is the opponent on November 1?
SELECT opponent FROM table_name_38 WHERE date = "november 1"
sql_create_context
CREATE TABLE table_1341472_12 ( district VARCHAR, incumbent VARCHAR )
What district is Mac Collins an incumbent in?
SELECT district FROM table_1341472_12 WHERE incumbent = "Mac Collins"
sql_create_context
CREATE TABLE table_17265535_7 ( result INTEGER, equation VARCHAR )
If the equation is 0 9 + 3 9 + 3, what is the result?
SELECT MIN(result) FROM table_17265535_7 WHERE equation = "0 × 9² + 3 × 9 + 3"
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of email and employee_id , and show x axis in ascending order.
SELECT EMAIL, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL
nvbench
CREATE TABLE table_64604 ( "Rank" real, "Athletes" text, "Country" text, "Time" text, "Notes" text )
What is the average rank for Hungary?
SELECT AVG("Rank") FROM table_64604 WHERE "Country" = 'hungary'
wikisql
CREATE TABLE table_14336 ( "Club" text, "Visa 1" text, "Visa 2" text, "Visa 3" text, "Visa 4" text, "Visa 5" text )
Which Visa 3 has gui finkler as Visa 1?
SELECT "Visa 3" FROM table_14336 WHERE "Visa 1" = 'gui finkler'
wikisql
CREATE TABLE table_28243691_1 ( team_nickname VARCHAR, location VARCHAR )
How many mascotts are there for college station, texas
SELECT COUNT(team_nickname) FROM table_28243691_1 WHERE location = "College Station, Texas"
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...
韦浩岚这个病人被门诊诊断为混合性焦虑障碍,他做的三碘甲状腺原氨酸的结果定量及其单位分别是啥
SELECT jyjgzbb.JCZBJGDL, jyjgzbb.JCZBJGDW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = mzjzjlb_jybgb.YLJGDM_MZJZJLB AND mzjzjlb.J...
css
CREATE TABLE table_56447 ( "Rank" real, "Movie" text, "Year" real, "Studio(s)" text, "Opening Day Net Gross" real, "Day of Week" text )
What is the year of the movie with an opening day on Friday with a rank 10?
SELECT COUNT("Year") FROM table_56447 WHERE "Day of Week" = 'friday' AND "Rank" = '10'
wikisql
CREATE TABLE table_39698 ( "Call sign" text, "Launched" text, "Transmitting from" text, "Coverage" text, "Languages" text, "Frequency" text )
Where is the station with a coverage of yucat n quintana roo campeche transmitting from?
SELECT "Transmitting from" FROM table_39698 WHERE "Coverage" = 'yucatán quintana roo campeche'
wikisql
CREATE TABLE song ( song_name text, artist_name text, country text, f_id number, genre_is text, rating number, languages text, releasedate time, resolution number ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) ...
What are the names of the songs that are modern or sung in English?
SELECT song_name FROM song WHERE genre_is = "modern" OR languages = "english"
spider
CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) CRE...
Accepted answers with a zero score.
SELECT a.Id AS "post_link", a.Score, a.OwnerUserId AS "user_link" FROM Posts AS a, Posts AS q WHERE a.PostTypeId = 2 AND q.PostTypeId = 1 AND a.Score = 0 AND a.ParentId = q.Id AND q.AcceptedAnswerId = a.Id
sede
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, ...
calculate the number of patients who were dead after being diagnosed with bladder ca within the same hospital visit.
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime, t1.patienthealthsystemstayid FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = ...
eicu
CREATE TABLE table_59345 ( "Club" text, "Played" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Tries for" text, "Tries against" text, "Try bonus" text, "Losing bonus" text, "Points" text )
WHAT IS THE TRIES AGAINST WITH PLAYED 22, POINTS AGAINST 784?
SELECT "Tries against" FROM table_59345 WHERE "Played" = '22' AND "Points against" = '784'
wikisql
CREATE TABLE university ( School_ID int, School text, Location text, Founded real, Affiliation text, Enrollment real, Nickname text, Primary_conference text ) CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Per...
Return a scatter chart about the correlation between ACC_Percent and All_Games_Percent , and group by attribute All_Games.
SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY All_Games
nvbench
CREATE TABLE table_name_70 ( game VARCHAR, october VARCHAR, record VARCHAR )
Which game was after October 24 and had a record of 6-2-1?
SELECT game FROM table_name_70 WHERE october > 24 AND record = "6-2-1"
sql_create_context
CREATE TABLE table_21076286_2 ( broadcast_network VARCHAR, broadcast_scope VARCHAR )
Name the broadcast network for chiba prefecture
SELECT broadcast_network FROM table_21076286_2 WHERE broadcast_scope = "Chiba Prefecture"
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 admission year is less than 2170 and procedure icd9 code is 8854?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2170" AND procedures.icd9_code = "8854"
mimicsql_data
CREATE TABLE table_name_12 ( first_year_played VARCHAR, doubles_w_l VARCHAR )
Which year first played with Double W-L of 8 3?
SELECT first_year_played FROM table_name_12 WHERE doubles_w_l = "8–3"
sql_create_context
CREATE TABLE table_43061 ( "Date" text, "Cover model" text, "Centerfold model" text, "Interview subject" text, "20 Questions" text )
Who was the Cover model on 11-03?
SELECT "Cover model" FROM table_43061 WHERE "Date" = '11-03'
wikisql
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
在二零二一年七月一号以前的住院就诊记录中有哪些是编号为22200311的患者对应的检验报告单?住院就诊的流水号能列出来吗?
SELECT zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb JOIN person_info_hz_info JOIN person_info ON hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_info.YLJGDM = hz_info.YLJGDM AND pers...
css
CREATE TABLE table_28846752_13 ( player VARCHAR, average VARCHAR )
Who is the player with an average of 35.42?
SELECT player FROM table_28846752_13 WHERE average = "35.42"
sql_create_context
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospit...
tell me how much patient 021-213732's total output was on last month/08.
SELECT SUM(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 = '021-213732')) AND intakeoutput.cellpath LIKE '%o...
eicu
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, ...
when did the first lab test of patient 92846 happened during this month?
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 92846) AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY labevents.charttime LIMIT 1
mimic_iii
CREATE TABLE hz_info ( KH text, KLX number, YLJGDM text ) 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 num...
找出患者姜新蕾去医院4680590住院出院的时候,负责办理出院的科室名字里面带免疫病的记录
SELECT * FROM person_info JOIN hz_info JOIN zyjzjlb JOIN person_info_hz_info ON person_info.RYBH = person_info_hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND person_info_hz_info.KH = hz_info.KH AND person_info_hz_info.KLX = hz_info.KLX AND person_info_hz_i...
css
CREATE TABLE table_58081 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
When vfl park is the venue what's the Away team playing?
SELECT "Away team" FROM table_58081 WHERE "Venue" = 'vfl park'
wikisql
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
Give me a bar chart to show how many days with a max temperature greater than or equal to 80 for each year.
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80
nvbench
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0),...
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the average of manager_id , and group by attribute job_id.
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
nvbench
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 demographic ( subject_id text, hadm_id t...
what is the number of patients whose gender is m and discharge location is left against medical advi?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "M" AND demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI"
mimicsql_data
CREATE TABLE table_204_691 ( id number, "date" text, "round" text, "opponent" text, "venue" text, "result" text, "attendance" number, "scorers" text )
how many goals did durrant score ?
SELECT COUNT(*) FROM table_204_691 WHERE "scorers" = 'durrant'
squall
CREATE TABLE table_203_134 ( id number, "place" text, "player" text, "country" text, "score" text, "to par" number )
which golfers other than tim clark shot 3 over par at the 2010 us open ?
SELECT "player" FROM table_203_134 WHERE "player" <> 'tim clark' AND "to par" = 3
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...
how many patients whose lab test abnormal status is abnormal and lab test name is potassium, urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "Potassium, Urine"
mimicsql_data
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...
Find All_Home and School_ID , and group by attribute ACC_Home, and visualize them by a bar chart, could you list in descending by the y-axis please?
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY School_ID DESC
nvbench
CREATE TABLE table_75608 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text )
Name the score for save of lancaster (3)
SELECT "Score" FROM table_75608 WHERE "Save" = 'lancaster (3)'
wikisql
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 were the five most common diagnoses among the patients in the 30s in 2105?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', diagnosis.diagnosistime) = '2105' GROUP BY diagnosis.d...
eicu
CREATE TABLE table_name_94 ( constructor VARCHAR, grid VARCHAR, laps VARCHAR )
Who built the under grid 6 car with under 49 laps?
SELECT constructor FROM table_name_94 WHERE grid < 6 AND laps < 49
sql_create_context
CREATE TABLE table_1446600_4 ( date_successor_seated VARCHAR, district VARCHAR )
What is the date the successor was seated for the georgia 6th district?
SELECT date_successor_seated FROM table_1446600_4 WHERE district = "Georgia 6th"
sql_create_context
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
Is EECS 567 or EECS 529 easier ?
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 567 OR course.number = 529) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON ...
advising
CREATE TABLE table_45238 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Date" text, "Crowd" real )
Which Ground has a Home team score of 18.12 (120)?
SELECT "Ground" FROM table_45238 WHERE "Home team score" = '18.12 (120)'
wikisql
CREATE TABLE table_name_86 ( Id VARCHAR )
Where were the 2009 and 2011 Grand Slam Tournaments?
SELECT 2011 FROM table_name_86 WHERE 2009 = "grand slam tournaments"
sql_create_context
CREATE TABLE table_name_25 ( rank VARCHAR, bronze VARCHAR, silver VARCHAR, gold VARCHAR )
Which rank has more than 1 silver, more than 1 gold, and more than 4 bronze?
SELECT rank FROM table_name_25 WHERE silver > 1 AND gold > 1 AND bronze > 4
sql_create_context
CREATE TABLE table_20164 ( "No. in series" text, "No. in season" text, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (million)" text )
Name who directed the 114 episode in the series
SELECT "Directed by" FROM table_20164 WHERE "No. in series" = '114'
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 ) ...
what is the number of patients whose gender is f and diagnoses icd9 code is 42831?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.icd9_code = "42831"
mimicsql_data
CREATE TABLE table_name_25 ( website VARCHAR, last_release VARCHAR )
What is Website, when Last Release is 2009-08-09, 1.2.9?
SELECT website FROM table_name_25 WHERE last_release = "2009-08-09, 1.2.9"
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
provide the number of patients whose death status is 0 and diagnoses icd9 code is 42833?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.icd9_code = "42833"
mimicsql_data
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...
那些被门诊诊断为持久的妄想性障碍的人他们的补体C4的检查结果的参考值范围下限和上限具体是多少呢?
SELECT jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM zzmzjzjlb JOIN jybgb JOIN jyjgzbb ON zzmzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND zzmzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH WHERE zzmzjzjlb.JZZDSM = '持久的妄想性障碍' AND jyjgzbb.JCZBMC = '补体C4' UNION SELECT jyjgzbb.CKZFWXX...
css
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE fligh...
find the earliest BREAKFAST flight from BOSTON to OAKLAND
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight, food_service WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code AND food_s...
atis
CREATE TABLE screen_mode ( graphics_mode number, char_cells text, pixels text, hardware_colours number, used_kb number, map text, type text ) CREATE TABLE phone ( company_name text, hardware_model_name text, accreditation_type text, accreditation_level text, date text, ...
List all the model names sorted by their launch year.
SELECT model_name FROM chip_model ORDER BY launch_year
spider
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, ...
what diagnosis did patient 32153 receive on the current hospital encounter for the first time?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT diagnoses_icd.icd9_code FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 32153 AND admissions.dischtime IS NULL) ORDER BY diagnoses_icd.charttime L...
mimic_iii
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE EN...
Return a pie on how many departments are in each school?
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT
nvbench
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
had the morphine inj, sodium chloride 0.9% 1,000 ml bag or potassium chloride crys er 20 meq po tbcr been prescribed for patient 009-15 in 2104?
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-15')) AND medication.drugname IN ('morphine inj', 'sodium chloride 0.9...
eicu
CREATE TABLE table_3245 ( "Round" real, "Circuit" text, "Date" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Winning Team" text )
How many Pole Positions were there on 30 March?
SELECT COUNT("Pole Position") FROM table_3245 WHERE "Date" = '30 March'
wikisql
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...
列出名称中不包含五官科的科室开过的所有医疗费用明细项目,主要针对50996847123这个医疗就诊
SELECT * FROM t_kc22 WHERE MED_CLINIC_ID = '50996847123' AND NOT MED_ORG_DEPT_NM LIKE '%五官科%'
css
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )...
how much patient 027-154299 weighs in 12/this year for the last time.
SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-154299') AND NOT patient.admissionweight IS NULL AND DATETIME(patient.unitadmittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '...
eicu
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE cos...
what is the four most frequently given diagnoses since 2105 for patients who have previously been diagnosed with ac diastolic hrt failure within 2 months?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.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 = admissions...
mimic_iii
CREATE TABLE table_203_300 ( id number, "year" number, "tournament" text, "venue" text, "result" text, "extra" text )
which year held the most tournaments ?
SELECT "year" FROM table_203_300 GROUP BY "year" ORDER BY COUNT("tournament") DESC LIMIT 1
squall
CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, ...
Four major RDBMS systems, ranked by popularity.
SELECT TagName AS Tags, cnt AS "questions_tagged", ROUND(100.0 * cnt / SUM(cnt) OVER (), 2) AS "ratio,_%" FROM Tags AS t JOIN LATERAL (SELECT COUNT(*) AS cnt FROM PostTags AS pt WHERE pt.TagId = t.Id) AS q WHERE t.TagName IN ('adminer', 'phpmyadmin', 'navicat', 'sqlyog', 'sqlbuddy', 'toad', 'dbninja', 'sqlwave', 'chive...
sede
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of founder and the sum of price , and group by attribute founder, and display total number from low to high order.
SELECT Founder, SUM(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY SUM(Price)
nvbench
CREATE TABLE table_29762 ( "Stadium" text, "City" text, "Capacity" real, "Matches played" real, "Overall attendance" real, "Average attendance per match" real, "Average attendance as % of Capacity" text, "Overall goals scored" real, "Average goals scored per match" text, "Elevati...
how many matches were played that average goals scored 1.25?
SELECT COUNT("Matches played") FROM table_29762 WHERE "Average goals scored per match" = '1.25'
wikisql
CREATE TABLE table_name_43 ( result VARCHAR, attendance VARCHAR )
What is the result of the game when the attendance is 75,466?
SELECT result FROM table_name_43 WHERE attendance = "75,466"
sql_create_context
CREATE TABLE table_name_12 ( class VARCHAR, erp_w VARCHAR )
What is the class for the ERP W of 500?
SELECT class FROM table_name_12 WHERE erp_w = 500
sql_create_context
CREATE TABLE table_27842 ( "Institution" text, "Location" text, "Type" text, "Joined" real, "Enrollment" real, "Nickname" text )
What type of institution is San Diego Christian college?
SELECT "Type" FROM table_27842 WHERE "Institution" = 'San Diego Christian College'
wikisql
CREATE TABLE table_48545 ( "Tournament" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "Career SR" text, "Career W\u2013L" text )
What is the 2007 value for the 2010 wta premier 5 tournaments?
SELECT "2007" FROM table_48545 WHERE "2010" = 'wta premier 5 tournaments'
wikisql
CREATE TABLE table_name_10 ( ties INTEGER, losses VARCHAR, games_played VARCHAR )
what is the lowest number of ties when the losses is 7 and games played is less than 10?
SELECT MIN(ties) FROM table_name_10 WHERE losses = 7 AND games_played < 10
sql_create_context
CREATE TABLE table_26948 ( "Name" text, "Position" text, "Period" text, "Appearances\u00b9" real, "Goals\u00b9" real, "Nationality\u00b2" text )
What country is Pierre Vermeulen from?
SELECT "Nationality\u00b2" FROM table_26948 WHERE "Name" = 'Pierre Vermeulen'
wikisql
CREATE TABLE table_65597 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
Which nationality has rank 4?
SELECT "Nationality" FROM table_65597 WHERE "Rank" = '4'
wikisql
CREATE TABLE table_40630 ( "City" text, "Jan." text, "Feb." text, "Mar." text, "Apr." text, "May." text, "Jun." text, "Jul." text, "Aug." text, "Sep." text, "Oct." text, "Nov." text, "Dec." text )
What were the Feb temperatures in East Stroudsburg?
SELECT "Feb." FROM table_40630 WHERE "City" = 'east stroudsburg'
wikisql
CREATE TABLE mzb ( CLINIC_ID 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, INSU_TYPE text, IN...
编号为43832017的病人在其医疗记录中花费的医疗费8811.34元都有啥,入院时患的病的编码和名称都是啥?
SELECT qtb.IN_DIAG_DIS_CD, qtb.IN_DIAG_DIS_NM FROM qtb WHERE qtb.PERSON_ID = '43832017' AND qtb.MED_CLINIC_ID IN (SELECT t_kc24.MED_CLINIC_ID FROM t_kc24 WHERE t_kc24.MED_AMOUT > 8811.34) UNION SELECT gyb.IN_DIAG_DIS_CD, gyb.IN_DIAG_DIS_NM FROM gyb WHERE gyb.PERSON_ID = '43832017' AND gyb.MED_CLINIC_ID IN (SELECT t_kc2...
css
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the sum of employee_id over the job_id , and group by attribute job_id, and could you show in desc by the names?
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID DESC
nvbench
CREATE TABLE table_26494 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "U.S. viewers (millions)" text )
what number is us viewers in season 12?
SELECT "U.S. viewers (millions)" FROM table_26494 WHERE "No. in season" = '12'
wikisql
CREATE TABLE table_name_18 ( type VARCHAR, group VARCHAR )
What is the type of station that is in the movies group?
SELECT type FROM table_name_18 WHERE group = "movies"
sql_create_context
CREATE TABLE table_38120 ( "Year" real, "Location" text, "Gold" text, "Silver" text, "Bronze" text )
What is the most recent year that China won a bronze?
SELECT MAX("Year") FROM table_38120 WHERE "Bronze" = 'china'
wikisql
CREATE TABLE table_name_23 ( episode__number VARCHAR, original_airdate VARCHAR )
What is the episode # of the episode that aired on April 5, 1998?
SELECT episode__number FROM table_name_23 WHERE original_airdate = "april 5, 1998"
sql_create_context
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
蒋荌荌患者被开出的所有检验报告单在07年5月7日到09年3月24日内的科室编码以及名称都是什么?
SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB WHERE person_info.XM = '蒋...
css
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Courses ( course_id INTEGER, author_id INTEGER, subject_id INTEGER, course_name VARCHAR(120), course_description VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATE...
A bar chart for finding the number of the dates of the tests taken with result 'Pass', I want to show by the y-axis in ascending.
SELECT date_test_taken, COUNT(date_test_taken) FROM Student_Tests_Taken WHERE test_result = "Pass" GROUP BY date_test_taken ORDER BY COUNT(date_test_taken)
nvbench
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
Average score for a tag. Returns the average score for a tag. Not sure about the accuracy, but it satisfied my curiosity enough.
SELECT CAST(SUM(Score) AS FLOAT) / CAST(COUNT(Score) AS FLOAT) AS AvgScore FROM Posts
sede
CREATE TABLE table_name_89 ( country VARCHAR, player VARCHAR )
What country is player mike sullivan from?
SELECT country FROM table_name_89 WHERE player = "mike sullivan"
sql_create_context
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE T...
number of ACL papers by author
SELECT DISTINCT COUNT(paper.paperid), writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'ACL' AND writes.paperid = paper.paperid GROUP BY writes.authorid
scholar
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 prescriptions ( subject_id text, hadm_id...
For patients born after the year 2060, calculate the maximum duration of stay in the hospital
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.dob_year > "2060"
mimicsql_data
CREATE TABLE table_23250 ( "Rank" real, "Couple" text, "Judges" real, "Public" real, "Total" real, "Vote percentage" text, "Result" text )
When 8 is the public and the result is safe what is the highest rank?
SELECT MAX("Rank") FROM table_23250 WHERE "Result" = 'Safe' AND "Public" = '8'
wikisql
CREATE TABLE table_36991 ( "Distance" text, "Event" text, "Record" text, "Nationality" text, "Year" real, "Location" text )
What was the distance in 1997?
SELECT "Distance" FROM table_36991 WHERE "Year" = '1997'
wikisql
CREATE TABLE table_29521180_35 ( round_of_16 VARCHAR, athlete VARCHAR )
What was the round of 16 result for felipe saucedo?
SELECT round_of_16 FROM table_29521180_35 WHERE athlete = "Felipe Saucedo"
sql_create_context
CREATE TABLE table_69428 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "9:30" text, "10:00" text )
What is the 10:00 feature with 1 vs. 100 at 8:30?
SELECT "10:00" FROM table_69428 WHERE "8:30" = '1 vs. 100'
wikisql
CREATE TABLE table_1061075_1 ( competition VARCHAR, aggregate VARCHAR )
what's the competition where aggregate is 4 7
SELECT competition FROM table_1061075_1 WHERE aggregate = "4–7"
sql_create_context
CREATE TABLE table_name_24 ( lane INTEGER, overall_rank VARCHAR, time VARCHAR )
What is the greatest lane with an overall rank of 79 and a time larger than 26.1?
SELECT MAX(lane) FROM table_name_24 WHERE overall_rank = "79" AND time > 26.1
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...
37631577362这个医疗就诊是哪天出院
SELECT OUT_HOSP_DATE FROM t_kc21 WHERE MED_CLINIC_ID = '37631577362'
css
CREATE TABLE table_44881 ( "Hanyu" text, "Tongyong" text, "Pe\u030dh-\u014de-j\u012b" text, "Chinese" text, "Area (km\u00b2)" real, "No. of villages" real, "Population (2010)" real )
Where in Tongyong is Hanyu Sanmin?
SELECT "Tongyong" FROM table_44881 WHERE "Hanyu" = 'sanmin'
wikisql
CREATE TABLE table_2624098_1 ( english_day_name_meaning VARCHAR, old_english_day_name VARCHAR )
what is the English meaning of the old English name 's turnesd g'?
SELECT english_day_name_meaning FROM table_2624098_1 WHERE old_english_day_name = "Sæturnesdæg"
sql_create_context
CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate ti...
my answers not tagged <excel> THAT SHOULD BE.
SELECT a.ParentId AS "post_link", q.Tags, a.Score FROM Posts AS q LEFT OUTER JOIN Posts AS a ON q.Id = a.ParentId WHERE a.OwnerUserId = '##UserID##' AND q.Tags LIKE '%excel%' AND NOT q.Tags LIKE '%<excel>%' ORDER BY a.Score DESC
sede
CREATE TABLE table_53479 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
Which Week has an Opponent of san francisco 49ers?
SELECT MAX("Week") FROM table_53479 WHERE "Opponent" = 'san francisco 49ers'
wikisql
CREATE TABLE table_3653 ( "Pick #" real, "Player" text, "Position" text, "Nationality" text, "NHL team" text, "College/junior/club team" text )
What is the college/junior/club team for player don barber?
SELECT "College/junior/club team" FROM table_3653 WHERE "Player" = 'Don Barber'
wikisql
CREATE TABLE table_33256 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
What was the size of the crowd that saw the Home team score 11.10 (76)?
SELECT COUNT("Crowd") FROM table_33256 WHERE "Home team score" = '11.10 (76)'
wikisql
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE paperfield ( fieldid...
Papers by Frank Keller and Mirella Lapata
SELECT DISTINCT WRITES_0.paperid FROM author AS AUTHOR_0, author AS AUTHOR_1, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_0.authorname = 'Frank Keller' AND AUTHOR_1.authorname = 'Mirella Lapata' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES_0.p...
scholar
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val...
what was the average sao2 on 01/06/last year for patient 3242.
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3242)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'sao2'...
mimic_iii
CREATE TABLE table_20584 ( "No." real, "Date" text, "Tournament" text, "Winning score" text, "To par" text, "Margin of victory" text, "Runner(s)-up" text )
Who was the runner up at the Volvo Masters Andalucia?
SELECT "Runner(s)-up" FROM table_20584 WHERE "Tournament" = 'Volvo Masters Andalucia'
wikisql
CREATE TABLE table_name_20 ( airport VARCHAR )
Which 2008 has an Airport of hurghada international airport?
SELECT AVG(2008) FROM table_name_20 WHERE airport = "hurghada international airport"
sql_create_context
CREATE TABLE table_56380 ( "Bowling figures Wickets-Runs (Overs)" text, "Bowler" text, "Versus" text, "Venue" text, "Date" text )
What were the bowling figures for the competition at Pietermaritzburg?
SELECT "Bowling figures Wickets-Runs (Overs)" FROM table_56380 WHERE "Venue" = 'pietermaritzburg'
wikisql