context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
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 manager_id over the hire_date bin hire_date by time by a bar chart, order from low to high by the total number.
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(MANAGER_ID)
nvbench
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, ...
what flights from ST. PAUL to KANSAS CITY on friday with a meal
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight, food_service WHERE ((date_day.day_number = 25 AND date_day.month_number = 6 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight....
atis
CREATE TABLE table_74512 ( "Year" real, "English title" text, "Original title" text, "Country" text, "Director" text )
Tell me the country for julian schnabel
SELECT "Country" FROM table_74512 WHERE "Director" = 'julian schnabel'
wikisql
CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255) )...
Show all calendar dates and bin by year in a line chart, and order by the x-axis in desc.
SELECT Calendar_Date, COUNT(Calendar_Date) FROM Ref_Calendar ORDER BY Calendar_Date DESC
nvbench
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), ...
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, and order by the y-axis from high to low.
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY) DESC
nvbench
CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_i...
what was the total number of outputs of patient 7533 until 09/20/2105?
SELECT SUM(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 7533)) AND STRFTIME('%y-%m-%d', outputevents.charttime) <= '2105-09-20'
mimic_iii
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
count the number of patients whose admission year is less than 2179 and diagnoses short title is acidosis?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2179" AND diagnoses.short_title = "Acidosis"
mimicsql_data
CREATE TABLE table_name_11 ( date VARCHAR, attendance VARCHAR )
What date has attendance listed as 45,024?
SELECT date FROM table_name_11 WHERE attendance = "45,024"
sql_create_context
CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM...
按照医院1206278在2008年1月12日到2015到5月24日这段时间开出的检验报告单,通过不同的检测指标名称还有检测指标结果定量单位的筛选,检测指标结果定量的平均值具体能达到多少,按升序的排序是怎样的?
SELECT jyjgzbb.JCZBMC, jyjgzbb.JCZBJGDW, AVG(jyjgzbb.JCZBJGDL) FROM jyjgzbb JOIN jybgb_jyjgzbb JOIN jybgb ON jybgb_jyjgzbb.JYZBLSH = jyjgzbb.JYZBLSH AND jybgb_jyjgzbb.jyjgzbb_id = jyjgzbb.jyjgzbb_id AND jybgb_jyjgzbb.YLJGDM = jybgb.YLJGDM WHERE jybgb.YLJGDM = '1206278' AND jyjgzbb.BGRQ BETWEEN '2008-01-12' AND '2015-05...
css
CREATE TABLE table_20775 ( "Institution" text, "Location" text, "Founded" real, "Affiliation" text, "Enrollment" real, "Team Nickname" text, "Primary conference" text, "Home Rink" text )
Which school has the mascot of the Colonials?
SELECT "Institution" FROM table_20775 WHERE "Team Nickname" = 'Colonials'
wikisql
CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH text, KH text, KLX number, MZBMLX number, MZJZLSH text, MZZDBM text, MZZDMC text, MZZYZDZZBM...
门诊诊断患者为慢性胃溃疡的抗环瓜氨酸肽抗体数值的平均值是多少?最值是多少?
SELECT AVG(jyjgzbb.JCZBJGDL), MIN(jyjgzbb.JCZBJGDL), MAX(jyjgzbb.JCZBJGDL) FROM mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN hz_info_mzjzjlb ON hz_info_mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.BGDH AND hz_info_mzjzjlb.JZLSH = mzjzjl...
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, ...
俞德本病患的检验报告单的报告日期在2006-07-13之后的住院就诊的流水号有哪些
SELECT zyjzjlb.JZLSH FROM person_info JOIN hz_info JOIN zyjzjlb ON person_info.RYBH = hz_info.RYBH AND hz_info.YLJGDM = zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX WHERE person_info.XM = '俞德本' AND NOT zyjzjlb.JZLSH IN (SELECT JZLSH FROM jybgb WHERE BGRQ <= '2006-07-13')
css
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
what was the first magnesium lab test time in 10/this year for patient 22120?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'magnesium') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 22120) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRE...
mimic_iii
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 drug type and drug name of drug code metd5?
SELECT prescriptions.drug_type, prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "METD5"
mimicsql_data
CREATE TABLE table_name_88 ( team VARCHAR, coach VARCHAR, captain VARCHAR )
Which Team has Manzoor Elahi as Coach and Taufeeq Umar as Captain?
SELECT team FROM table_name_88 WHERE coach = "manzoor elahi" AND captain = "taufeeq umar"
sql_create_context
CREATE TABLE table_name_69 ( to_par VARCHAR, money___$__ VARCHAR, player VARCHAR )
Which To Par has a Money ($) of 350, and a Player of henry picard?
SELECT to_par FROM table_name_69 WHERE money___$__ = 350 AND player = "henry picard"
sql_create_context
CREATE TABLE table_name_23 ( rider VARCHAR, manufacturer VARCHAR, time_retired VARCHAR )
Which rider has a Manufacturer of honda with a time of +44.814?
SELECT rider FROM table_name_23 WHERE manufacturer = "honda" AND time_retired = "+44.814"
sql_create_context
CREATE TABLE table_name_89 ( team_e VARCHAR, team_f VARCHAR )
Who is team E when Jason Manning is Team F?
SELECT team_e FROM table_name_89 WHERE team_f = "jason manning"
sql_create_context
CREATE TABLE table_name_98 ( pole_position VARCHAR, grand_prix VARCHAR )
What is the Pole Position of the Portuguese Grand Prix?
SELECT pole_position FROM table_name_98 WHERE grand_prix = "portuguese grand prix"
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...
在医院1657281张晴霞病患入院诊断疾病名称不含有煤工的医疗就诊记录编号是什么?
SELECT MED_CLINIC_ID FROM t_kc21 WHERE PERSON_NM = '张晴霞' AND MED_SER_ORG_NO = '1657281' AND NOT IN_DIAG_DIS_NM LIKE '%煤工%'
css
CREATE TABLE table_name_7 ( score VARCHAR, to_par VARCHAR, player VARCHAR )
Which Score has a To par of 1, and a Player of mick soli?
SELECT score FROM table_name_7 WHERE to_par = "–1" AND player = "mick soli"
sql_create_context
CREATE TABLE albums ( id number, title text, artist_id number ) CREATE TABLE media_types ( id number, name text ) CREATE TABLE playlists ( id number, name text ) CREATE TABLE employees ( id number, last_name text, first_name text, title text, reports_to number, bir...
What are the total amount of money in the invoices billed from Chicago, Illinois?
SELECT SUM(total) FROM invoices WHERE billing_city = "Chicago" AND billing_state = "IL"
spider
CREATE TABLE producer ( pid int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE director ( did int, gender text, name text, nationality text, birth_city text, birth_year int ) CREATE TABLE keyword ( id int, keyword text ...
How many movies did ' Alfred Hitchcock ' direct ?
SELECT COUNT(DISTINCT (movie.title)) FROM directed_by, director, movie WHERE director.did = directed_by.did AND director.name = 'Alfred Hitchcock' AND movie.mid = directed_by.msid
imdb
CREATE TABLE table_name_18 ( opponent VARCHAR, partnering VARCHAR, surface VARCHAR, outcome VARCHAR )
Who was the Opponent partnering with Jordan Kerr, on a hard surface that was the winner?
SELECT opponent FROM table_name_18 WHERE surface = "hard" AND outcome = "winner" AND partnering = "jordan kerr"
sql_create_context
CREATE TABLE table_19930660_1 ( winner VARCHAR, marcus_guest VARCHAR )
Name the winner for jason byrne
SELECT winner FROM table_19930660_1 WHERE marcus_guest = "Jason Byrne"
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, ...
范梦竹这个病患在编号为4362119的医院的门诊诊断结果的名称中包含牙髓炎的门诊就诊记录有哪些
SELECT * 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.YLJGDM AND hz_info_mzjz...
css
CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text ) CREATE TABLE team ( Team_id int, Name text ) CREATE TABLE player ( Player_ID int, Player text, Years_Played text, Total_WL text, Singles_WL text, Doubles_WL text, ...
Show the country names and the corresponding number of players in a bar chart, I want to rank by the x axis from low to high.
SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.Country_name ORDER BY Country_name
nvbench
CREATE TABLE table_41980 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
Which Gold has a Bronze larger than 1, and a Total larger than 80?
SELECT SUM("Gold") FROM table_41980 WHERE "Bronze" > '1' AND "Total" > '80'
wikisql
CREATE TABLE table_11167610_1 ( fuel_delivery VARCHAR, power VARCHAR )
what's the fuel delivery where power is hp (kw) @6500 rpm
SELECT fuel_delivery FROM table_11167610_1 WHERE power = "hp (kW) @6500 rpm"
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...
Can DESCI 501 be MDE class ?
SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'DESCI' AND course.number = 501 AND program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
advising
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 is the difference between the total volume of input and output of patient 017-13959 on 09/05/last year?
SELECT (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 = '017-13959')) AND intakeoutput.cellpath L...
eicu
CREATE TABLE table_38856 ( "System" text, "Owner" text, "Quantity" real, "Delivery" text, "Length" text, "Gauge" text, "Operation" text, "Seats" real, "Standing" real )
How many seats have a quantity over 45?
SELECT SUM("Seats") FROM table_38856 WHERE "Quantity" > '45'
wikisql
CREATE TABLE table_21873 ( "Stage" real, "Winner" text, "General Classification" text, "Mountains Classification" text, "Points Classification" text, "Sprints classification" text, "Team Classification" text )
How many stages were won by Robbie McEwen?
SELECT COUNT("Stage") FROM table_21873 WHERE "Winner" = 'Robbie McEwen'
wikisql
CREATE TABLE table_name_34 ( sixth_place VARCHAR, series VARCHAR )
Who was in sixth place in series 7?
SELECT sixth_place FROM table_name_34 WHERE series = 7
sql_create_context
CREATE TABLE table_name_58 ( driver VARCHAR, points VARCHAR )
Which driver scored 9 points?
SELECT driver FROM table_name_58 WHERE points = "9"
sql_create_context
CREATE TABLE table_name_99 ( goals_for VARCHAR, losses INTEGER )
What is the total number of Goals For, when Losses is greater than 16?
SELECT COUNT(goals_for) FROM table_name_99 WHERE losses > 16
sql_create_context
CREATE TABLE visits ( visit_id number, tourist_attraction_id number, tourist_id number, visit_date time, visit_details text ) CREATE TABLE theme_parks ( theme_park_id number, theme_park_details text ) CREATE TABLE photos ( photo_id number, tourist_attraction_id number, name tex...
Find the names of the tourist attractions that is either accessible by bus or at address 254 Ottilie Junction.
SELECT T2.name FROM locations AS T1 JOIN tourist_attractions AS T2 ON T1.location_id = T2.location_id WHERE T1.address = "254 Ottilie Junction" OR T2.how_to_get_there = "bus"
spider
CREATE TABLE table_38668 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Points" real )
Name the sum of grid with laps more than 97
SELECT SUM("Grid") FROM table_38668 WHERE "Laps" > '97'
wikisql
CREATE TABLE table_22069 ( "Position" real, "Club" text, "Games played" real, "Wins" real, "Draws" real, "Loses" real, "Goals scored" real, "Goals conceded" real, "Points" real )
How many games had 22 points?
SELECT COUNT("Games played") FROM table_22069 WHERE "Points" = '22'
wikisql
CREATE TABLE table_3693 ( "Episode" real, "Airdate" text, "Game 1" text, "Game 2" text, "Game 3" text, "Viewers" text )
What was game 3 when there were under 2.61m viewers?
SELECT "Game 3" FROM table_3693 WHERE "Viewers" = 'Under 2.61m'
wikisql
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE course_prerequisite ( pre_course_id int, course_id int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE gsi ( course_...
Among the hardest courses in the SI department , have I taken any ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload FROM course INNER JOIN student_record ON student_record.course_id = course.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'SI' AND program_course.workload = (SELECT MAX(PR...
advising
CREATE TABLE table_29803475_3 ( directed_by VARCHAR, us_viewers__million_ VARCHAR )
who directed the episode that have 0.25 million u.s viewers
SELECT directed_by FROM table_29803475_3 WHERE us_viewers__million_ = "0.25"
sql_create_context
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC...
在00年9月13日到2005年5月12日期间病号56678015的所有检验结果指标记录的检测人为戚雪卉的检验指标流水号是多少?
SELECT jyjgzbb.JYZBLSH FROM hz_info JOIN wdmzjzjlb JOIN jybgb JOIN jyjgzbb ON 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 AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb.B...
css
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE bdmzjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, HZXM text, JZKSDM text, JZKSMC text, JZLSH number, KH text, KLX num...
列出患者苏明知从06年8月16日到2010年2月4日内检测人为14927928的所有检验结果指标记录的检验指数流水编号都是啥?
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_43675 ( "Position" real, "Team" text, "Played" real, "Drawn" real, "Lost" real, "Goals For" real, "Goals Against" real, "Goal Difference" text, "Points 1" real )
What is the most goals for when there are fewer than 4 draws?
SELECT MAX("Goals For") FROM table_43675 WHERE "Drawn" < '4'
wikisql
CREATE TABLE table_204_553 ( id number, "outcome" text, "no." number, "date" text, "tournament" text, "surface" text, "partner" text, "opponents in the final" text, "score in the final" text )
which city did she play her last game ?
SELECT "tournament" FROM table_204_553 ORDER BY "date" DESC LIMIT 1
squall
CREATE TABLE table_name_38 ( time_retired VARCHAR, driver VARCHAR )
What is the time/retired for mika h kkinen
SELECT time_retired FROM table_name_38 WHERE driver = "mika häkkinen"
sql_create_context
CREATE TABLE table_25177 ( "Version" text, "Release date" text, "Distribution mechanism" text, "Features" text, "Security issues" text )
With the version of 1.5a, what is the release date?
SELECT "Release date" FROM table_25177 WHERE "Version" = '1.5a'
wikisql
CREATE TABLE table_24784769_1 ( round3 VARCHAR, total_points VARCHAR )
How many points did the team who had 325 total points have in round 3?
SELECT round3 FROM table_24784769_1 WHERE total_points = 325
sql_create_context
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergy...
has the sao2 of patient 027-139111 since 573 days ago been less than 99.0?
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 = '027-139111')) AND vitalperiodic.sao2 < 99.0 AND NOT vitalperiodic.sa...
eicu
CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Competition text ) CREATE TABLE sta...
How many injured players not suffering from injury of 'Knee problem' in each match? Show me a bar chart grouping by number of matches, and rank by the y axis from low to high.
SELECT Number_of_matches, COUNT(Number_of_matches) FROM injury_accident WHERE Injury <> 'Knee problem' GROUP BY Number_of_matches ORDER BY COUNT(Number_of_matches)
nvbench
CREATE TABLE grapes ( ID INTEGER, Grape TEXT, Color TEXT ) CREATE TABLE wine ( No INTEGER, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INTEGER, Price INTEGER, Score INTEGER, Cases INTEGER, Drink TEXT ) CREATE TABLE appellations ( No...
What is the number of counties for all appellations?, and list by the Y-axis in descending.
SELECT County, COUNT(County) FROM appellations GROUP BY County ORDER BY COUNT(County) DESC
nvbench
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 is the five diagnoses which have the lowest three year survival rate?
SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 10...
eicu
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
How many hypoxemia patients were admitted in or before the year 2144?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2144" AND diagnoses.short_title = "Hypoxemia"
mimicsql_data
CREATE TABLE table_2392 ( "Episode" real, "First Air Date" text, "Rating (18\u201349)" text, "Share (18\u201349)" real, "Viewers (millions)" text, "Rank (timeslot)" text )
Name the total number for 18-49 share being 18-49 being 3.1
SELECT COUNT("Share (18\u201349)") FROM table_2392 WHERE "Rating (18\u201349)" = '3.1'
wikisql
CREATE TABLE table_1965650_2 ( player VARCHAR, pick__number VARCHAR )
Name the player for pick number for 30
SELECT player FROM table_1965650_2 WHERE pick__number = 30
sql_create_context
CREATE TABLE table_8654 ( "Event" text, "PDT (-7 UTC)" text, "MDT (-6 UTC)" text, "CDT (-5 UTC)" text, "EDT (-4 UTC)" text )
What time is CDT when PDT is 3:17 a.m.?
SELECT "CDT (-5 UTC)" FROM table_8654 WHERE "PDT (-7 UTC)" = '3:17 a.m.'
wikisql
CREATE TABLE pilot ( pilot_id number, name text, age number ) CREATE TABLE match ( round number, location text, country text, date text, fastest_qualifying text, winning_pilot text, winning_aircraft text ) CREATE TABLE airport_aircraft ( id number, airport_id number, ...
find the name and age of the pilot who has won the most number of times among the pilots who are younger than 30.
SELECT t1.name, t1.age FROM pilot AS t1 JOIN match AS t2 ON t1.pilot_id = t2.winning_pilot WHERE t1.age < 30 GROUP BY t2.winning_pilot ORDER BY COUNT(*) DESC LIMIT 1
spider
CREATE TABLE table_203_610 ( id number, "institution" text, "location" text, "nickname" text, "founded" number, "historical affiliation" text, "enrollment" number, "primary conference" text )
which institution was founded last ?
SELECT "institution" FROM table_203_610 ORDER BY "founded" DESC LIMIT 1
squall
CREATE TABLE table_70532 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Time" text, "Att." real, "Record" text )
What was the lowest attendance at a game that had a loss of lohse (12 11)?
SELECT MIN("Att.") FROM table_70532 WHERE "Loss" = 'lohse (12–11)'
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,...
how many patients whose primary disease is posterior communicating aneurysm/sda and age is less than 79?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" AND demographic.age < "79"
mimicsql_data
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...
provide the number of patients whose diagnoses short title is dermatitis nos and drug route is im?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Dermatitis NOS" AND prescriptions.route = "IM"
mimicsql_data
CREATE TABLE table_22848931_3 ( team VARCHAR, replaced_by VARCHAR )
Name the team for arif asadov
SELECT team FROM table_22848931_3 WHERE replaced_by = "Arif Asadov"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, 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, JSBBSJ time, ...
从2005年11月22日到2012年7月6日这一段时间里,曹玉轩病患的所有检验报告单中的标本采集分别是哪几个部位?
SELECT jybgb.BBCJBW FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb JOIN person_info_hz_info ON person_info.RYBH = person_info_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_MZJZJL...
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID ...
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the amount of hire_date bin hire_date by time in a bar chart.
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE HIRE_DATE < '2002-06-21'
nvbench
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 ...
整理出来患者水茉莉在二零零一年一月四日到二零二一年十二月九日内被开出的所有检验报告单的科室编码以及名称
SELECT jybgb.KSBM, jybgb.KSMC FROM person_info JOIN hz_info JOIN mzjzjlb JOIN jybgb 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.JZLSH = jybgb.JZLSH_MZJZJL...
css
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, ...
had patient 72364 receive a contrast arteriogram nec procedure since 2 years ago?
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'contrast arteriogram nec') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 72364) AND DATETIME(pr...
mimic_iii
CREATE TABLE table_53922 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
How tall is the player from Mississippi
SELECT "Height in Ft." FROM table_53922 WHERE "School/Club Team/Country" = 'mississippi'
wikisql
CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text...
Edits I rejected and that ended up being approved.
SELECT se.Id AS "suggested_edit_link", p.Id AS "post_link" FROM SuggestedEdits AS se, SuggestedEditVotes AS sev, Posts AS p WHERE se.Id = sev.SuggestedEditId AND se.PostId = p.Id AND sev.UserId = '##UserId##' AND sev.VoteTypeId = 3 AND NOT se.ApprovalDate IS NULL ORDER BY sev.CreationDate
sede
CREATE TABLE table_53017 ( "Season" text, "Winner" text, "Team" text, "Position" text, "Win #" real )
What position for doug gibson with 2 wins?
SELECT "Position" FROM table_53017 WHERE "Win #" = '2' AND "Winner" = 'doug gibson'
wikisql
CREATE TABLE table_26108103_2 ( year INTEGER )
What was the earliest year?
SELECT MIN(year) FROM table_26108103_2
sql_create_context
CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LNa...
Return a scatter chart on how many students are there in each major?
SELECT COUNT(*), Major FROM Student GROUP BY Major
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 prescriptions ( subject_id text, hadm_id...
what is the number of patients whose diagnosis is ca in situ oral cav/phar and im drug route?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Ca in situ oral cav/phar" AND prescriptions.route = "IM"
mimicsql_data
CREATE TABLE table_name_56 ( method VARCHAR, record VARCHAR )
What was the method when 4-2 was the record?
SELECT method FROM table_name_56 WHERE record = "4-2"
sql_create_context
CREATE TABLE table_47163 ( "Round" real, "Pick" text, "Player" text, "Position" text, "School/Club Team" text )
Which School/Club Team has a Round larger than 3, and a Player of sammy okpro?
SELECT "School/Club Team" FROM table_47163 WHERE "Round" > '3' AND "Player" = 'sammy okpro'
wikisql
CREATE TABLE table_69648 ( "Date" text, "Venue" text, "Score" text, "Result" text, "Competition" text )
Name the venue for 25 may 2008
SELECT "Venue" FROM table_69648 WHERE "Date" = '25 may 2008'
wikisql
CREATE TABLE table_55175 ( "Team" text, "Games Played" real, "Wins" real, "Losses" real, "Ties" real, "Goals For" real, "Goals Against" real )
How many ties did the Montreal Victorias have with a GA of less than 24?
SELECT MAX("Ties") FROM table_55175 WHERE "Team" = 'montreal victorias' AND "Goals Against" < '24'
wikisql
CREATE TABLE table_58414 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
Who drove the grid 11 car?
SELECT "Driver" FROM table_58414 WHERE "Grid" = '11'
wikisql
CREATE TABLE table_76328 ( "Episode" text, "First broadcast" text, "Graeme's guest" text, "Jeremy's guest" text, "Votes (%)" text )
What is Votes (%), when First Broadcast is '13 March 1998'?
SELECT "Votes (%)" FROM table_76328 WHERE "First broadcast" = '13 march 1998'
wikisql
CREATE TABLE table_44601 ( "Region" text, "Date" text, "Label" text, "Catalog" text, "Format" text )
What was the format when the label was loen entertainment?
SELECT "Format" FROM table_44601 WHERE "Label" = 'loen entertainment'
wikisql
CREATE TABLE table_10015132_14 ( school_club_team VARCHAR, years_in_toronto VARCHAR )
Which school was in Toronto in 2001-02?
SELECT school_club_team FROM table_10015132_14 WHERE years_in_toronto = "2001-02"
sql_create_context
CREATE TABLE table_75613 ( "State" text, "Literacy Rate (%) - [2013 Estimate]" real, "Literacy Rate (%) - 2001 Census" real, "Literacy Rate (%) - 2011 Census" real, "% Increase" text )
What is the average estimated 2013 literacy rate for the states that had a literacy rate of 68.81% in the 2001 census and a literacy rate higher than 79.6% in the 2011 census?
SELECT "Literacy Rate (%) - [2013 Estimate]" FROM table_75613 WHERE "Literacy Rate (%) - 2011 Census" > '79.6' AND "Literacy Rate (%) - 2001 Census" = '68.81'
wikisql
CREATE TABLE table_75281 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
Which Date has a Score of 2 7, and a Record of 5 8 2?
SELECT "Date" FROM table_75281 WHERE "Score" = '2–7' AND "Record" = '5–8–2'
wikisql
CREATE TABLE table_name_67 ( time___et__ VARCHAR, week VARCHAR, opponent VARCHAR )
What is the time of the game after week 4 against the Baltimore Ravens?
SELECT time___et__ FROM table_name_67 WHERE week > 4 AND opponent = "baltimore ravens"
sql_create_context
CREATE TABLE table_60647 ( "Date" text, "Opponent" text, "Score" text, "Decision" text, "Attendance" real, "Record" text )
For the game that ended with a record of 28-35-1, what was the decision?
SELECT "Decision" FROM table_60647 WHERE "Record" = '28-35-1'
wikisql
CREATE TABLE table_name_41 ( venue VARCHAR, year VARCHAR, result VARCHAR )
a Year smaller than 2007, and a Result of 1st is in what venue?
SELECT venue FROM table_name_41 WHERE year < 2007 AND result = "1st"
sql_create_context
CREATE TABLE table_26842217_18 ( time VARCHAR, visiting_team VARCHAR )
Name the number of time for uab
SELECT COUNT(time) FROM table_26842217_18 WHERE visiting_team = "UAB"
sql_create_context
CREATE TABLE table_41079 ( "Season" text, "Division" text, "Finish" text, "Wins" text, "Losses" text, "Pct." text )
In which Season was the Division Washington Bullets?
SELECT "Season" FROM table_41079 WHERE "Division" = 'washington bullets'
wikisql
CREATE TABLE region ( region_id number, region_name text, date text, label text, format text, catalogue text ) CREATE TABLE member ( member_id number, member_name text, party_id text, in_office text ) CREATE TABLE party ( party_id number, minister text, took_office ...
Which member names corresponding to members who are not in the Progress Party?
SELECT T1.member_name FROM member AS T1 JOIN party AS T2 ON T1.party_id = T2.party_id WHERE T2.party_name <> "Progress Party"
spider
CREATE TABLE table_name_63 ( result VARCHAR, competition VARCHAR, lineup VARCHAR, assist_pass VARCHAR )
Name the Result of the Lineup of start, an Assist/pass of carli lloyd, and an Competition of 2011 fifa women s world cup group stage?
SELECT result FROM table_name_63 WHERE lineup = "start" AND assist_pass = "carli lloyd" AND competition = "2011 fifa women’s world cup – group stage"
sql_create_context
CREATE TABLE table_name_77 ( res VARCHAR, location VARCHAR, record VARCHAR )
Which result has a Location of canada, and a Record of 3-3?
SELECT res FROM table_name_77 WHERE location = "canada" AND record = "3-3"
sql_create_context
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE STUDENT...
Return a histogram on how many students are in each department?
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE
nvbench
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE cite ( citingpaperid int, citedpa...
what are the collaborations of bharath hariharan and ross girshick ?
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 = 'bharath hariharan' AND AUTHOR_1.authorname = 'ross girshick' AND WRITES_0.authorid = AUTHOR_0.authorid AND WRITES_1.authorid = AUTHOR_1.authorid AND WRITES_1.paperid = WRITES...
scholar
CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Participants ( Participant_ID INTEGER, Participant_Type_Code CHAR(15), Participant_Details VARCHAR(255) ) CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) CREATE TABLE Eve...
Return a bar chart on what are the ids and details of events that have more than one participants?, could you order in ascending by the X?
SELECT T1.Event_Details, T1.Event_ID FROM Events AS T1 JOIN Participants_in_Events AS T2 ON T1.Event_ID = T2.Event_ID GROUP BY T1.Event_Details ORDER BY T1.Event_Details
nvbench
CREATE TABLE table_204_884 ( id number, "medal" text, "name" text, "sport" text, "event" text, "date" text )
was there more gold medals won than silver ?
SELECT (SELECT COUNT(*) FROM table_204_884 WHERE "medal" = 'gold') > (SELECT COUNT(*) FROM table_204_884 WHERE "medal" = 'silver')
squall
CREATE TABLE table_37554 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
When the Vancouver Canucks were visiting, what was the record when the score was 4-2?
SELECT "Record" FROM table_37554 WHERE "Score" = '4-2' AND "Visitor" = 'vancouver canucks'
wikisql
CREATE TABLE table_2638 ( "Best Male MC" text, "Best Female MC" text, "Best Male Artist" text, "Best Female Artist" text, "Best Male Lyricist" text, "Best Female Lyricist" text, "Best Male Record" text )
What won the Best Female Artist if Best Lyrical Record won the Best Male Artist?
SELECT "Best Female Artist" FROM table_2638 WHERE "Best Male Artist" = 'Best Lyrical Record'
wikisql
CREATE TABLE table_name_4 ( total INTEGER, nation VARCHAR, rank VARCHAR )
What is the average Total with a Nation of ethiopia (eth) and a Rank that is larger than 9?
SELECT AVG(total) FROM table_name_4 WHERE nation = "ethiopia (eth)" AND rank > 9
sql_create_context
CREATE TABLE teachers ( lastname text, firstname text, classroom number ) CREATE TABLE list ( lastname text, firstname text, grade number, classroom number )
Which classrooms are used by grade 4?
SELECT DISTINCT classroom FROM list WHERE grade = 4
spider
CREATE TABLE table_1745843_5 ( part_3 VARCHAR, part_2 VARCHAR )
What is the 3rd participle of the verb whose 2nd participle is band?
SELECT part_3 FROM table_1745843_5 WHERE part_2 = "band"
sql_create_context