context
stringlengths
11
9.12k
question
stringlengths
0
1.06k
SQL
stringlengths
2
4.44k
source
stringclasses
28 values
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 diagnoses short title is disrup-external op wound and lab test category is hematology?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Disrup-external op wound" AND lab."CATEGORY" = "Hematology"
mimicsql_data
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
设备在检验结果指标记录87001092804上有什么编码和仪器编号以及名称?
SELECT SBBM, YQBH, YQMC FROM jyjgzbb WHERE JYZBLSH = '87001092804'
css
CREATE TABLE table_name_41 ( home_captain VARCHAR, venue VARCHAR )
Who is the home captain that played at Edgbaston?
SELECT home_captain FROM table_name_41 WHERE venue = "edgbaston"
sql_create_context
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...
how many female patients are born before 2076?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.dob_year < "2076"
mimicsql_data
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE STUDENT ( STU_NUM int, ...
Give me a histogram for what is the first name and GPA of every student that has a GPA lower than average?
SELECT STU_FNAME, SUM(STU_GPA) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME
nvbench
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time...
count the number of patients who received normal saline administration procedure in the same month after having received cardiac surgery consultation procedure.
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') AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment ...
eicu
CREATE TABLE table_31445 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "Location Attendance" text, "Series" text, "Streak" text )
in which date the strea was w 2
SELECT "Date" FROM table_31445 WHERE "Streak" = 'W 2'
wikisql
CREATE TABLE table_49684 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text )
What is the Event, when Year is 2002, and when Competition is European Indoor Championships?
SELECT "Event" FROM table_49684 WHERE "Year" = '2002' AND "Competition" = 'european indoor championships'
wikisql
CREATE TABLE table_204_703 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
which country won more total medals than tue french , but less than the germans in the 1994 winter olympic biathlon ?
SELECT "nation" FROM table_204_703 WHERE "total" > (SELECT "total" FROM table_204_703 WHERE "nation" = 'france') AND "total" < (SELECT "total" FROM table_204_703 WHERE "nation" = 'germany')
squall
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
how many patients admitted before 2151 are divorced?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admityear < "2151"
mimicsql_data
CREATE TABLE person_info ( CSD text, CSRQ time, GJDM text, GJMC text, JGDM text, JGMC text, MZDM text, MZMC text, RYBH text, XBDM number, XBMC text, XLDM text, XLMC text, XM text, ZYLBDM text, ZYMC text ) CREATE TABLE jyjgzbb ( BGDH text, BGRQ tim...
看看之前患者97868786有哪些异常反应
SELECT * FROM hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb JOIN mzjzjlb_jybgb ON 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_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jyjgzbb....
css
CREATE TABLE table_45619 ( "Week #" text, "Theme" text, "Song choice" text, "Original artist" text, "Result" text )
What was the result after the week # top 11?
SELECT "Result" FROM table_45619 WHERE "Week #" = 'top 11'
wikisql
CREATE TABLE table_1213511_2 ( nationality VARCHAR, nhl_team VARCHAR )
What is the nationality of the player from Buffalo Sabres?
SELECT nationality FROM table_1213511_2 WHERE nhl_team = "Buffalo Sabres"
sql_create_context
CREATE TABLE table_71730 ( "Hull No." real, "Year" real, "Project" text, "Length overall in meters (without bowsprit)" real, "Name" text, "Destination" text )
Name the project with length overall being 25 and name of levante
SELECT "Project" FROM table_71730 WHERE "Length overall in meters (without bowsprit)" = '25' AND "Name" = 'levante'
wikisql
CREATE TABLE table_79282 ( "Year" real, "Team" text, "Manufacturer" text, "Start" real, "Finish" real )
Which team had a start of 8 in years under 2008?
SELECT "Team" FROM table_79282 WHERE "Start" = '8' AND "Year" < '2008'
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
find the number of patients admitted before the year 2146 whose admission type is elective.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2146"
mimicsql_data
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number...
when was the first time that since 5 years ago patient 030-60126 received administration of electrolytes procedure?
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-60126')) AND treatment.treatmentname = 'administration of ele...
eicu
CREATE TABLE table_name_61 ( time VARCHAR, team VARCHAR )
What time did team kawasaki zx10 1000cc have?
SELECT time FROM table_name_61 WHERE team = "kawasaki zx10 1000cc"
sql_create_context
CREATE TABLE table_11636213_7 ( partnering VARCHAR, result VARCHAR )
How many matches had the result of 6 3, 6 2?
SELECT COUNT(partnering) FROM table_11636213_7 WHERE result = "6–3, 6–2"
sql_create_context
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
provide the number of patients whose discharge location is short term hospital and who were admitted to the hospital before year 2182.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.admityear < "2182"
mimicsql_data
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 cost ( costid num...
has patient 003-42706 had an thrombolytics procedure performed in other hospitals since 5 years ago?
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '003-42706' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '003-42706' AND patient.hospitaldischargetime IS NULL)) AND tr...
eicu
CREATE TABLE table_name_5 ( ground VARCHAR, away VARCHAR )
On what grounds did the away team of the Toronto Rebels play?
SELECT ground FROM table_name_5 WHERE away = "toronto rebels"
sql_create_context
CREATE TABLE table_1341453_40 ( district VARCHAR, incumbent VARCHAR )
In what district was Tim Holden the incumbent?
SELECT district FROM table_1341453_40 WHERE incumbent = "Tim Holden"
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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
For those employees who did not have any job in the past, draw a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, and order in descending by the y axis please.
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
nvbench
CREATE TABLE table_name_88 ( opponent VARCHAR, date VARCHAR )
Who's the opponent for June 13?
SELECT opponent FROM table_name_88 WHERE date = "june 13"
sql_create_context
CREATE TABLE table_name_23 ( time_retired VARCHAR, grid VARCHAR )
What is Time/Retired with a Grid of 12?
SELECT time_retired FROM table_name_23 WHERE grid = 12
sql_create_context
CREATE TABLE table_name_68 ( position VARCHAR, played INTEGER )
What was the position has a played entry of more than 24?
SELECT COUNT(position) FROM table_name_68 WHERE played > 24
sql_create_context
CREATE TABLE t_kc24 ( MED_SAFE_PAY_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, REF_SLT_FLG number, CLINIC_SLT_DATE time, COMP_ID text, PERSON_ID text, FLX_MED_ORG_ID text, INSU_TYPE text, MED_AMOUT number, PER_ACC_PAY number, OVE_PAY numb...
77759408的患者自10.9.4起,到13.6.24止,看过的最主要的病是什么
SELECT IN_DIAG_DIS_CD, IN_DIAG_DIS_NM FROM t_kc21 WHERE PERSON_ID = '77759408' AND IN_HOSP_DATE BETWEEN '2010-09-04' AND '2013-06-24' GROUP BY IN_DIAG_DIS_CD ORDER BY COUNT(*) DESC LIMIT 1
css
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, ...
how many patients have stayed in the hospital for more than 8 days with a drug name magnesium oxide?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.drug = "Magnesium Oxide"
mimicsql_data
CREATE TABLE table_5082 ( "Rank" real, "Player" text, "Country" text, "Earnings ( $ )" real, "Events" real, "Wins" real )
Which events have a Rank of 1?
SELECT "Events" FROM table_5082 WHERE "Rank" = '1'
wikisql
CREATE TABLE table_78053 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
How many spectators were at the game when the away team scored 15.8 (98)?
SELECT "Crowd" FROM table_78053 WHERE "Away team score" = '15.8 (98)'
wikisql
CREATE TABLE Projects ( Project_ID INTEGER, Project_Details VARCHAR(255) ) CREATE TABLE Documents_with_Expenses ( Document_ID INTEGER, Budget_Type_Code CHAR(15), Document_Details VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), ...
Show me a bar chart for what is the project id and detail for the project with at least two documents?, sort in ascending by the X-axis.
SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_Details
nvbench
CREATE TABLE table_51065 ( "Model number" text, "sSpec number" text, "Frequency" text, "GPU frequency" text, "L2 cache" text, "I/O bus" text, "Memory" text, "Socket" text, "Release date" text, "Part number(s)" text )
What is L2 Cache, when Model Number is Atom Z625?
SELECT "L2 cache" FROM table_51065 WHERE "Model number" = 'atom z625'
wikisql
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...
how many patients discharged to long term care hospital were born before 2058?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND demographic.dob_year < "2058"
mimicsql_data
CREATE TABLE table_2380212_1 ( league VARCHAR, year VARCHAR )
What League was played in 2007?
SELECT league FROM table_2380212_1 WHERE year = 2007
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
what is the minimum cost of the hospital that regular insulin involves until 4 years ago?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'regular insulin')) AND DATETIME(cost.chargetim...
eicu
CREATE TABLE jyjgzbb ( JYZBLSH text, YLJGDM text, BGDH text, BGRQ time, JYRQ time, JCRGH text, JCRXM text, SHRGH text, SHRXM text, JCXMMC text, JCZBDM text, JCFF text, JCZBMC text, JCZBJGDX text, JCZBJGDL number, JCZBJGDW text, SBBM text, YQBH text...
10564497940这次住院就诊的主要诊断如何?需要编码的类型和列表,还有名称列表
SELECT ZYBMLX, ZYZDBM, ZYZDMC FROM zyjzjlb WHERE JZLSH = '10564497940'
css
CREATE TABLE fgwyjzb ( 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, ...
从15年6月21日到21年3月18日这段时间医疗机构3297791的检查费有多少?
SELECT SUM(t_kc22.AMOUNT) FROM gwyjzb JOIN t_kc22 ON gwyjzb.MED_CLINIC_ID = t_kc22.MED_CLINIC_ID WHERE gwyjzb.MED_SER_ORG_NO = '3297791' AND t_kc22.STA_DATE BETWEEN '2015-06-21' AND '2021-03-18' AND t_kc22.MED_INV_ITEM_TYPE = '检查费' UNION SELECT SUM(t_kc22.AMOUNT) FROM fgwyjzb JOIN t_kc22 ON fgwyjzb.MED_CLINIC_ID = t_kc...
css
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
what is average days of hospital stay of patients whose primary disease is posterior communicating aneurysm/sda?
SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
mimicsql_data
CREATE TABLE table_20453681_1 ( county VARCHAR, obama_percentage VARCHAR )
Where did Obama get 37.1%?
SELECT county FROM table_20453681_1 WHERE obama_percentage = "37.1%"
sql_create_context
CREATE TABLE postseason ( year INTEGER, round TEXT, team_id_winner TEXT, league_id_winner TEXT, team_id_loser TEXT, league_id_loser TEXT, wins INTEGER, losses INTEGER, ties INTEGER ) CREATE TABLE player_award ( player_id TEXT, award_id TEXT, year INTEGER, league_id T...
Count the number of players who enter hall of fame for each year Plot them as line chart, show yearid in descending order please.
SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid ORDER BY yearid DESC
nvbench
CREATE TABLE table_203_270 ( id number, "year" number, "competition" text, "venue" text, "position" text, "event" text, "notes" text )
which four competitions are the only competitions that occurred once ?
SELECT "competition" FROM table_203_270 GROUP BY "competition" HAVING COUNT(*) = 1
squall
CREATE TABLE table_72962 ( "Rank" real, "Railway Station" text, "Annual entry/exit (millions) 2011\u201312" text, "Annual interchanges (millions) 2011\u201312" text, "Total Passengers (millions) 2011\u201312" text, "Location" text, "Main Services" text, "Number of Platforms" real )
What is the lowest rank of Gatwick Airport?
SELECT MIN("Rank") FROM table_72962 WHERE "Railway Station" = 'Gatwick Airport'
wikisql
CREATE TABLE table_203_727 ( id number, "year" number, "miss northern ireland" text, "hometown" text, "placement at miss world" text, "notes" text )
who was miss uk 2005 and miss universe 2005 2nd runner up ?
SELECT "miss northern ireland" FROM table_203_727 WHERE "notes" = 'later miss united kingdom 2005 and miss universe united kingdom 2005 2nd runner-up'
squall
CREATE TABLE table_24032 ( "Series Year" real, "Series-Ending Tournament" text, "Location" text, "Surface" text, "Champion" text, "Runner-up" text, "Score in Final" text )
What was the final score when tracy austin was runner up?
SELECT "Score in Final" FROM table_24032 WHERE "Runner-up" = 'Tracy Austin'
wikisql
CREATE TABLE table_name_2 ( weight_at_birth VARCHAR, gender VARCHAR, nickname VARCHAR )
How much did the girl, nicknamed Chidi, weigh at birth?
SELECT weight_at_birth FROM table_name_2 WHERE gender = "girl" AND nickname = "chidi"
sql_create_context
CREATE TABLE table_name_30 ( area__km²_ INTEGER, name_of_community VARCHAR, excised_from VARCHAR, population VARCHAR )
What is the average Area (km ) that shows Excised from shire of cook and a Population smaller than 463 for the community of wujal wujal (bloomfield river)?
SELECT AVG(area__km²_) FROM table_name_30 WHERE excised_from = "shire of cook" AND population < 463 AND name_of_community = "wujal wujal (bloomfield river)"
sql_create_context
CREATE TABLE table_35649 ( "Season" real, "Episodes" real, "First air date" text, "Last air date" text, "Timeslot" text, "DVD Release" text )
When is the last episode air date for season 3?
SELECT "Last air date" FROM table_35649 WHERE "Season" = '3'
wikisql
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, ...
患者27615170在13年4月2日到21年3月6日内被开出的所有检验报告单的科室编码以及名称都是什么?
SELECT jybgb.KSBM, jybgb.KSMC FROM hz_info JOIN wdmzjzjlb JOIN jybgb 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 WHERE hz_info.RYBH = '27615170' AND jybgb.BGRQ BETWEEN '2013-04-02...
css
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...
Are there courses I need to take before PHYSED 265 ?
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT...
advising
CREATE TABLE table_name_16 ( date VARCHAR, type VARCHAR )
What was the date with a hilly stage?
SELECT date FROM table_name_16 WHERE type = "hilly stage"
sql_create_context
CREATE TABLE table_name_67 ( bronze INTEGER, gold VARCHAR, silver VARCHAR )
What is the total amount of bronze medals a team with 1 gold and more than 3 silver medals has?
SELECT SUM(bronze) FROM table_name_67 WHERE gold = 1 AND silver > 3
sql_create_context
CREATE TABLE stock ( shop_id number, device_id number, quantity number ) CREATE TABLE device ( device_id number, device text, carrier text, package_version text, applications text, software_platform text ) CREATE TABLE shop ( shop_id number, shop_name text, location tex...
Show the carriers of devices in stock at more than one shop.
SELECT T2.carrier FROM stock AS T1 JOIN device AS T2 ON T1.device_id = T2.device_id GROUP BY T1.device_id HAVING COUNT(*) > 1
spider
CREATE TABLE table_7321 ( "Outcome" text, "Date" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What was the Outcome of the match played on Hard (i) Surface?
SELECT "Outcome" FROM table_7321 WHERE "Surface" = 'hard (i)'
wikisql
CREATE TABLE table_name_97 ( circuit VARCHAR, pole_position VARCHAR )
Which Circuit has a Pole position of andr ribeiro?
SELECT circuit FROM table_name_97 WHERE pole_position = "andré ribeiro"
sql_create_context
CREATE TABLE table_55199 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Partner" text, "Opponents" text, "Score" text )
What is the surface of the match when the opponent was iryna bremond valeria savinykh?
SELECT "Surface" FROM table_55199 WHERE "Opponents" = 'iryna bremond valeria savinykh'
wikisql
CREATE TABLE table_52354 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalogue" text )
Which date had a Japan region?
SELECT "Date" FROM table_52354 WHERE "Region" = 'japan'
wikisql
CREATE TABLE table_name_32 ( Id VARCHAR )
What is the 2007 that has a grand slam tournaments in 2006.
SELECT 2007 FROM table_name_32 WHERE 2006 = "grand slam tournaments"
sql_create_context
CREATE TABLE table_train_66 ( "id" int, "pregnancy_or_lactation" bool, "white_blood_cell_count_wbc" int, "acute_pyelonephritis" bool, "intrabdominal_infection" bool, "body_weight" float, "oxygen_therapy_by_face_mask" bool, "temperature" float, "heart_rate" int, "paco2" float, ...
weight > 200 kg
SELECT * FROM table_train_66 WHERE body_weight > 200
criteria2sql
CREATE TABLE table_55939 ( "Rank" real, "Name" text, "Nation" text, "Placings" text, "Total" real )
Who has a rank great than 3 and a placing of 64?
SELECT "Name" FROM table_55939 WHERE "Rank" > '3' AND "Placings" = '64'
wikisql
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE d_items ( row_id number, itemid number, label text,...
how many patient have died after they were diagnosed with acc poison-cns stimulant during the same month until 4 years ago?
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_di...
mimic_iii
CREATE TABLE nomination ( Artwork_ID int, Festival_ID int, Result text ) CREATE TABLE artwork ( Artwork_ID int, Type text, Name text ) CREATE TABLE festival_detail ( Festival_ID int, Festival_Name text, Chair_Name text, Location text, Year int, Num_of_Audience int )
Show the ids and names of festivals that have at least two nominations for artworks by a bar chart, display names in asc order.
SELECT T3.Festival_Name, T1.Festival_ID FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3.Festival_Name
nvbench
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE transfers ( row_id number,...
what were the three most frequently prescribed drugs to patients who previously received temporary colostomy within 2 months until 1 year ago?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures ...
mimic_iii
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 patient ( uniquep...
what was the first drug prescribed until 9 months ago to patient 017-101426?
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-101426')) AND DATETIME(medication.drugstarttime) <= DATETIME(CU...
eicu
CREATE TABLE t_kc21_t_kc22 ( MED_CLINIC_ID text, MED_EXP_DET_ID number ) CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, C...
零一年六月六日至二一年四月九日,甜梦口服液在泌尿这个科室有多少开药量
SELECT COUNT(*) FROM t_kc22 WHERE t_kc22.MED_ORG_DEPT_NM = '泌尿外科' AND t_kc22.STA_DATE BETWEEN '2001-06-06' AND '2021-04-09' AND t_kc22.SOC_SRT_DIRE_NM = '甜梦口服液'
css
CREATE TABLE table_59446 ( "Party" text, "% votes" real, "% change" real, "Seats" real, "Change" real )
What is the change number with fewer than 4.7% votes and more than 0 seats?
SELECT SUM("Change") FROM table_59446 WHERE "% votes" < '4.7' AND "Seats" > '0'
wikisql
CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_city_affected real ) CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Nu...
List the name for storms and the number of affected regions for each storm with a pie chart.
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID
nvbench
CREATE TABLE Properties ( property_id INTEGER, property_type_code CHAR(15), property_address VARCHAR(255), other_details VARCHAR(255) ) CREATE TABLE Services ( service_id INTEGER, organization_id INTEGER, service_type_code CHAR(15), service_details VARCHAR(255) ) CREATE TABLE Customer_...
What is the proportion of each customer's move in date? You can show me a bar chart that bins move in date into Year interval, and sort by the y axis in ascending.
SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id ORDER BY COUNT(date_moved_in)
nvbench
CREATE TABLE table_68720 ( "Name" text, "Years" text, "League" text, "FA Cup" text, "League Cup" text, "Europe" text, "Other [C ]" text, "Total" text )
The League Cup of 0 40 0 (6) also has what listed in the Europe column?
SELECT "Europe" FROM table_68720 WHERE "League Cup" = '0 40 0 (6)'
wikisql
CREATE TABLE table_203_54 ( id number, "selected\nlatin american\ncountries" text, "internl.\ntourism\narrivals\n2010\n(x 1000)" number, "internl.\ntourism\nreceipts.\n2010\n(usd\n(x1000)" number, "average\nreceipt\nper visitor\n2009\n(usd/turista)" number, "tourist\narrivals\nper\n1000 inhab\n(...
which latin american country had the largest number of tourism arrivals in 2010 ?
SELECT "selected\nlatin american\ncountries" FROM table_203_54 ORDER BY "internl.\ntourism\narrivals\n2010\n(x 1000)" DESC LIMIT 1
squall
CREATE TABLE zyb ( 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...
医院3111269全部医疗就诊的记录里,不同科室接诊的患者和有不同入院诊断的患者就诊的平均岁数是多少
SELECT qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_NM, AVG(qtb.PERSON_AGE) FROM qtb WHERE qtb.MED_SER_ORG_NO = '3111269' GROUP BY qtb.MED_ORG_DEPT_NM, qtb.IN_DIAG_DIS_NM UNION SELECT gyb.MED_ORG_DEPT_NM, gyb.IN_DIAG_DIS_NM, AVG(gyb.PERSON_AGE) FROM gyb WHERE gyb.MED_SER_ORG_NO = '3111269' GROUP BY gyb.MED_ORG_DEPT_NM, gyb.IN_...
css
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
count the number of patients who received a laxatives - doss (colace) treatment within 2 months after they were diagnosed with spinal cord injury - thoracic since 3 years ago.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'spinal cord injury - thoracic' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year'))...
eicu
CREATE TABLE table_name_75 ( crowd INTEGER, venue VARCHAR )
What was the largest crowd at the Brunswick Street Oval?
SELECT MAX(crowd) FROM table_name_75 WHERE venue = "brunswick street oval"
sql_create_context
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...
how many patients whose procedure icd9 code is 3897 and drug route is buccal?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3897" AND prescriptions.route = "BUCCAL"
mimicsql_data
CREATE TABLE table_37944 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
Which Attendance has a Record of 34 51?
SELECT MIN("Attendance") FROM table_37944 WHERE "Record" = '34–51'
wikisql
CREATE TABLE table_204_435 ( id number, "sport" text, "gold" number, "silver" number, "bronze" number, "total" number )
what sport has the second most number of gold medals won ?
SELECT "sport" FROM table_204_435 WHERE "gold" < (SELECT MAX("gold") FROM table_204_435) ORDER BY "gold" DESC LIMIT 1
squall
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
give me the number of patients whose age is less than 50 and diagnoses long title is acute vascular insufficiency of intestine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "50" AND diagnoses.long_title = "Acute vascular insufficiency of intestine"
mimicsql_data
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
how many patients whose drug route is pr?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "PR"
mimicsql_data
CREATE TABLE table_name_1 ( record VARCHAR, date VARCHAR )
What was the record on April 22?
SELECT record FROM table_name_1 WHERE date = "april 22"
sql_create_context
CREATE TABLE table_name_18 ( event VARCHAR, record VARCHAR )
Which event had the record of 18 5 (1)?
SELECT event FROM table_name_18 WHERE record = "18–5 (1)"
sql_create_context
CREATE TABLE table_45417 ( "Race Title" text, "Circuit" text, "City / State" text, "Date" text, "Winner" text, "Team" text )
what is the circuit when the date is 4 june?
SELECT "Circuit" FROM table_45417 WHERE "Date" = '4 june'
wikisql
CREATE TABLE table_27523 ( "June 10-11" text, "March 27-29" text, "January 15-16" text, "November 3" text, "August 21-22" text )
What January 15-16 is is that corresponds to November 3, 2013?
SELECT "January 15-16" FROM table_27523 WHERE "November 3" = 'November 3, 2013'
wikisql
CREATE TABLE party ( Party_ID VARCHAR, Party VARCHAR ) CREATE TABLE election ( Committee VARCHAR, Party VARCHAR )
Which committees have delegates from both democratic party and liberal party?
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal"
sql_create_context
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...
Return the number of the completion date for all the tests that have 'Fail' result, and rank total number from high to low order please.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" ORDER BY COUNT(date_of_completion) DESC
nvbench
CREATE TABLE table_1932 ( "Country" text, "Contestant" text, "Age" real, "Height (cm)" real, "Height (ft)" text, "Hometown" text )
When bahamas is the country what is the height in centimeters?
SELECT "Height (cm)" FROM table_1932 WHERE "Country" = 'Bahamas'
wikisql
CREATE TABLE list ( lastname text, firstname text, grade number, classroom number ) CREATE TABLE teachers ( lastname text, firstname text, classroom number )
Which teachers teach in classroom 110? Give me their first names.
SELECT firstname FROM teachers WHERE classroom = 110
spider
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...
what is maximum days of hospital stay of patients whose admission year is greater than or equal to 2177?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2177"
mimicsql_data
CREATE TABLE t_kc24 ( ACCOUNT_DASH_DATE time, ACCOUNT_DASH_FLG number, CASH_PAY number, CIVIL_SUBSIDY number, CKC102 number, CLINIC_ID text, CLINIC_SLT_DATE time, COMP_ID text, COM_ACC_PAY number, COM_PAY number, DATA_ID text, ENT_ACC_PAY number, ENT_PAY number, F...
自二零零零年九月十八日开始,截止到二零一三年十月十六日,患者章俊晤的主治医生是哪位
SELECT t_kc21.OUT_DIAG_DOC_CD, t_kc21.OUT_DIAG_DOC_NM FROM t_kc21 WHERE t_kc21.PERSON_NM = '章俊晤' AND t_kc21.IN_HOSP_DATE BETWEEN '2000-09-18' AND '2013-10-16' GROUP BY t_kc21.OUT_DIAG_DOC_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real ) CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate re...
Give me a bar chart for sum weight of each sex, and rank Y-axis from low to high order.
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex ORDER BY SUM(Weight)
nvbench
CREATE TABLE table_5814 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "Location Attendance" text, "Record" text )
What team has a high score with tracy mcgrady (24)?
SELECT "Team" FROM table_5814 WHERE "High points" = 'tracy mcgrady (24)'
wikisql
CREATE TABLE table_204_637 ( id number, "type" text, "gauge" text, "railway" text, "works no." text, "year" text, "builder" text )
what is the total number of garratts produced in 1911 ?
SELECT COUNT(*) FROM table_204_637 WHERE "year" = 1911
squall
CREATE TABLE table_21313327_1 ( written_by VARCHAR, no_in_season VARCHAR )
In season number 3, who were the writers?
SELECT written_by FROM table_21313327_1 WHERE no_in_season = 3
sql_create_context
CREATE TABLE table_name_15 ( score VARCHAR, game VARCHAR, time VARCHAR )
Game larger than 4, and a Time of 2:26 resulted in what score?
SELECT score FROM table_name_15 WHERE game > 4 AND time = "2:26"
sql_create_context
CREATE TABLE table_1342149_43 ( result VARCHAR, district VARCHAR )
What was the result of the election in the Texas 4 district?
SELECT result FROM table_1342149_43 WHERE district = "Texas 4"
sql_create_context
CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int,...
show me the flights from ST. PETERSBURG to TORONTO that arrive before 1200
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND flight.arrival_time <= 1200 AND flight.to_airport = AIRPORT_SERVICE_1.airpor...
atis
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute headquarter.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
nvbench
CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) 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 varch...
Will ACABS 470 be offered next semester ?
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ACABS' AND course.number = 470 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
advising
CREATE TABLE table_name_10 ( score VARCHAR, set_2 VARCHAR, total VARCHAR )
Which score has a Set 2 of 17 25, and a Total of 48 75?
SELECT score FROM table_name_10 WHERE set_2 = "17–25" AND total = "48–75"
sql_create_context
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, a...
what are the minimum monthly number of patients diagnosed with increased intracranial pressure - from cerebral edema the last year?
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'increased intracranial pressure - from cerebral edema' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY STRFTIME('%y-%m',...
eicu
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...
Stack bar chart of school_id vs ACC_Home based on all home, list by the names in ascending.
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home
nvbench