instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREAT...
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-42293')) AND DATETIME(allergy.allergytime) >= DATETIME(CURRENT_TIME()...
eicu
CREATE TABLE table_name_71 ( week VARCHAR, game_site VARCHAR, attendance VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What week was the game played at Robert f. Kennedy memorial stadium with more than 54,633 people in attendance?
SELECT COUNT(week) FROM table_name_71 WHERE game_site = "robert f. kennedy memorial stadium" AND attendance > 54 OFFSET 633
sql_create_context
CREATE TABLE table_75713 ( "Week #" text, "Theme" text, "Original artist" text, "Order #" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the order number that has top 20 (10 women) as the week number?
SELECT "Order #" FROM table_75713 WHERE "Week #" = 'top 20 (10 women)'
wikisql
CREATE TABLE table_name_5 ( circuit VARCHAR, race VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What circuit was for the german grand prix?
SELECT circuit FROM table_name_5 WHERE race = "german grand prix"
sql_create_context
CREATE TABLE table_67073 ( "Division" text, "Drawn" real, "Lost" real, "Points" real, "League Pos" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the drawn result with a league position of 15th and a lost result that is more than 17?
SELECT SUM("Drawn") FROM table_67073 WHERE "League Pos" = '15th' AND "Lost" > '17'
wikisql
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 prescriptions...
SELECT demographic.dischtime FROM demographic WHERE demographic.subject_id = "3343"
mimicsql_data
CREATE TABLE t_kc21_t_kc24 ( MED_CLINIC_ID text, MED_SAFE_PAY_ID number ) CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, ...
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '苗芳蔼' AND t_kc21.MED_SER_ORG_NO = '3888607' AND NOT t_kc21.OUT_DIAG_DIS_NM LIKE '%药%'
css
CREATE TABLE table_44715 ( "Team" text, "Average" real, "Points" real, "Played" real, "2006" text, "2007" text, "2008" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of Average, when 2006 is '36/40', and when Played is greate...
SELECT SUM("Average") FROM table_44715 WHERE "2006" = '36/40' AND "Played" > '126'
wikisql
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text...
SELECT meter_600, ID FROM swimmer ORDER BY meter_600 DESC
nvbench
CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, Revision...
SELECT Q.OwnerUserId AS "user_link", A.OwnerUserId AS "user_link", COUNT(*) AS Count FROM Posts AS Q, Posts AS A WHERE A.ParentId = Q.Id AND A.OwnerUserId > 0 AND Q.OwnerUserId > 0 AND A.OwnerUserId != Q.OwnerUserId AND Q.CommunityOwnedDate IS NULL AND A.CommunityOwnedDate IS NULL GROUP BY Q.OwnerUserId, A.OwnerUserId ...
sede
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT instructor.name FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND course.department = 'INTLSTD' AND course.number = 401 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offerin...
advising
CREATE TABLE table_30459 ( "Series #" real, "Title" text, "Written by" text, "Directed by" text, "Original air date" text, "Production code" text, "U.S. viewers (millions)" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date did 'The ru...
SELECT "Original air date" FROM table_30459 WHERE "Title" = 'The Runner'
wikisql
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 INTEGER, Appelation TEXT, County TEXT, State TEXT, Area...
SELECT Year, COUNT(Year) FROM wine ORDER BY COUNT(Year)
nvbench
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...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "CONGESTIVE HEART FAILURE"
mimicsql_data
CREATE TABLE table_255205_1 ( joined VARCHAR, type VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many joined this Private/Church of God institution?
SELECT joined FROM table_255205_1 WHERE type = "Private/Church of God"
sql_create_context
CREATE TABLE table_name_34 ( nickname VARCHAR, division VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the nickname of the team in division 2?
SELECT nickname FROM table_name_34 WHERE division = "division 2"
sql_create_context
CREATE TABLE table_name_22 ( performer VARCHAR, points VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who scored 57 points?
SELECT performer FROM table_name_22 WHERE points = 57
sql_create_context
CREATE TABLE table_28291 ( "Rank" real, "Average" text, "Player" text, "Matches" real, "Innings" real, "Period" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lowest number of matches for a record holder?
SELECT MIN("Matches") FROM table_28291
wikisql
CREATE TABLE table_69389 ( "Year" text, "Champion" text, "Runner-Up" text, "3rd Place" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the champion for 2000
SELECT "Champion" FROM table_69389 WHERE "Year" = '2000'
wikisql
CREATE TABLE table_71708 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Manufacturer for simone corsi?
SELECT "Manufacturer" FROM table_71708 WHERE "Rider" = 'simone corsi'
wikisql
CREATE TABLE table_21070 ( "Team #1" text, "Points" text, "Team #2" text, "1st leg" text, "2nd leg" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- If team two is San Lorenzo, how many were on team one?
SELECT COUNT("Team #1") FROM table_21070 WHERE "Team #2" = 'San Lorenzo'
wikisql
CREATE TABLE table_203_142 ( id number, "pos" text, "no" number, "rider" text, "bike" text, "laps" number, "time" text, "grid" number, "points" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- in the 2007 phillip island superbike wor...
SELECT (SELECT "points" FROM table_203_142 WHERE "pos" = 1) - (SELECT "points" FROM table_203_142 WHERE "pos" = 2)
squall
CREATE TABLE table_name_62 ( attendance INTEGER, opponent VARCHAR, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance when the Braves were the opponent and the record was 56-53?
SELECT AVG(attendance) FROM table_name_62 WHERE opponent = "braves" AND record = "56-53"
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...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Daniel Brickman%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.o...
advising
CREATE TABLE table_46755 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was ...
SELECT "Manner of departure" FROM table_46755 WHERE "Date of vacancy" = '20 september 2009'
wikisql
CREATE TABLE table_name_47 ( top_5 INTEGER, wins VARCHAR, events VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Top-5 is the highest one that has Wins of 0, and Events larger than 6?
SELECT MAX(top_5) FROM table_name_47 WHERE wins = 0 AND events > 6
sql_create_context
CREATE TABLE table_1636 ( "Period" text, "% trains arriving within 5 mins of scheduled time (over three months)" text, "Change over same quarter the previous year" text, "% trains arriving within 5 mins of scheduled time Moving Annual Average (MAA)" text, "Change over previous year as a whole" text ...
SELECT "Change over same quarter the previous year" FROM table_1636 WHERE "% trains arriving within 5 mins of scheduled time (over three months)" = '89.6%'
wikisql
CREATE TABLE table_name_2 ( roll VARCHAR, area VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which roll has an Area of mahia?
SELECT roll FROM table_name_2 WHERE area = "mahia"
sql_create_context
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE i...
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 = '035-17122')) AND medication.drugname IN ('furosemide inj', 'vitamins/miner...
eicu
CREATE TABLE table_78457 ( "League" text, "Sport" text, "Season" text, "Total attendance" text, "Average attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What's the average attendance of the league with a total attendance of 2268508?
SELECT "Average attendance" FROM table_78457 WHERE "Total attendance" = '2268508'
wikisql
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number...
SELECT Id AS "user_link", AboutMe, WebsiteUrl FROM Users WHERE (AboutMe LIKE '%@stackexchange.com%' OR AboutMe LIKE '%@stackoverflow.com%' OR AboutMe LIKE '%valued associate%')
sede
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...
(SELECT SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '61652781791') INTERSECT (SELECT SOC_SRT_DIRE_NM FROM t_kc22 WHERE MED_CLINIC_ID = '68258054270')
css
CREATE TABLE table_204_385 ( id number, "round" number, "pick" number, "player" text, "nationality" text, "college/junior/club team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- are more of the amateur draft picks from canada or the united sta...
SELECT "nationality" FROM table_204_385 WHERE "nationality" IN ('canada', 'united states') GROUP BY "nationality" ORDER BY COUNT(*) DESC LIMIT 1
squall
CREATE TABLE table_35471 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what week number was at memorial stadium?
SELECT AVG("Week") FROM table_35471 WHERE "Game site" = 'memorial stadium'
wikisql
CREATE TABLE table_53447 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many people were in the crowd when the home ...
SELECT COUNT("Crowd") FROM table_53447 WHERE "Home team score" = '31.9 (195)'
wikisql
CREATE TABLE table_17001658_6 ( team VARCHAR, game VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Against which team was game 21?
SELECT team FROM table_17001658_6 WHERE game = 21
sql_create_context
CREATE TABLE table_73266 ( "Gas name" text, "Chemical formula" text, "Lifetime (years)" text, "20-yr" text, "100-yr" text, "500-yr" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the lifetime (years) for chemical formula ch 4?
SELECT "Lifetime (years)" FROM table_73266 WHERE "Chemical formula" = 'CH 4'
wikisql
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID)
nvbench
CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) 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_...
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f >= 80
nvbench
CREATE TABLE table_43678 ( "Player" text, "Nationality" text, "Jersey Number(s)" text, "Position" text, "Years" text, "From" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the nationality of the person with number 27?
SELECT "Nationality" FROM table_43678 WHERE "Jersey Number(s)" = '27'
wikisql
CREATE TABLE table_36847 ( "Year" real, "Class" text, "Team" text, "Points" real, "Wins" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the year that there were 0 wins, team AJS, and under 12 points?
SELECT COUNT("Year") FROM table_36847 WHERE "Wins" = '0' AND "Team" = 'ajs' AND "Points" < '12'
wikisql
CREATE TABLE table_41510 ( "Player" text, "Country" text, "Year won" real, "Total" real, "To par" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the Total of the player who won before 1983 with a smaller than 4 To par?
SELECT COUNT("Total") FROM table_41510 WHERE "To par" < '4' AND "Year won" < '1983'
wikisql
CREATE TABLE table_25548505_1 ( original_air_date VARCHAR, us_viewers__millions_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the original air date of the episode that had 5.30 million U.S. viewers?
SELECT original_air_date FROM table_25548505_1 WHERE us_viewers__millions_ = "5.30"
sql_create_context
CREATE TABLE table_65771 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Event" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the venue when the competition is asian games, the event is 4x400 m relay and the year is 2002?...
SELECT "Venue" FROM table_65771 WHERE "Competition" = 'asian games' AND "Event" = '4x400 m relay' AND "Year" = '2002'
wikisql
CREATE TABLE table_name_82 ( save VARCHAR, opponent VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the save when Yankees are the opponents on July 25?
SELECT save FROM table_name_82 WHERE opponent = "yankees" AND date = "july 25"
sql_create_context
CREATE TABLE table_5246 ( "Years" text, "Building" text, "City" text, "Height" text, "Storeys" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which city contains Telus Plaza South?
SELECT "City" FROM table_5246 WHERE "Building" = 'telus plaza south'
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, ...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'gi obstruction / ileus - small bowel obstruction' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-2 year'))
eicu
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_CLINIC_ID text, MED_DIRE_CD tex...
SELECT t_kc22.SOC_SRT_DIRE_CD, t_kc22.SOC_SRT_DIRE_NM FROM t_kc22 WHERE t_kc22.MED_CLINIC_ID IN (SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_NM = '韦烨烨' AND t_kc21.MED_SER_ORG_NO = '9170359' AND t_kc21.IN_HOSP_DATE BETWEEN '2010-06-10' AND '2018-05-04')
css
CREATE TABLE table_name_90 ( total INTEGER, year_of_census VARCHAR, serbs VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average total of the census after 1971 with 10,412 (32.88%) Serbs?
SELECT AVG(total) FROM table_name_90 WHERE year_of_census > 1971 AND serbs = "10,412 (32.88%)"
sql_create_context
CREATE TABLE table_48553 ( "Round" real, "Pick" real, "Player" text, "Nationality" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- WHAT PLAYER HAS A PICK SMALLER THAN 110, AND DUKE AS COLLEGE?
SELECT "Player" FROM table_48553 WHERE "Pick" < '110' AND "College" = 'duke'
wikisql
CREATE TABLE table_73016 ( "Year" real, "Illinois" text, "Indiana" text, "Kentucky" text, "Michigan" text, "Ohio" text, "Wisconsin" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the little league team from Kentucky when the little ...
SELECT "Kentucky" FROM table_73016 WHERE "Michigan" = 'Grosse Pointe Farms-City LL Grosse Pointe Farms'
wikisql
CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE...
SELECT DISTINCT airline.airline_code FROM airline, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, flight, flight_stop WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANC...
atis
CREATE TABLE table_10706961_2 ( report VARCHAR, winning_team VARCHAR, pole_position VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many reports are there in the race that Forsythe Racing won and Teo Fabi had the pole position in?
SELECT COUNT(report) FROM table_10706961_2 WHERE winning_team = "Forsythe Racing" AND pole_position = "Teo Fabi"
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 medication ( medi...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'respiratory acidosis - chronic') AS t1) - (SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT patient....
eicu
CREATE TABLE table_32243 ( "Rank" real, "Name" text, "Years" text, "Goals" real, "Apps" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of rank with years 1996 2012 and apps greater than 340?
SELECT SUM("Rank") FROM table_32243 WHERE "Years" = '1996–2012' AND "Apps" > '340'
wikisql
CREATE TABLE table_44558 ( "Poll Source" text, "Dates administered" text, "Democrat: Carl Levin" text, "Republican: Jack Hoogendyk" text, "Lead Margin" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is Poll Source, when Democrat: Carl Levin is ...
SELECT "Poll Source" FROM table_44558 WHERE "Democrat: Carl Levin" = '61%'
wikisql
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title 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 ...
SELECT MIN(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 = 13622)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arte...
mimic_iii
CREATE TABLE Tasks ( task_id INTEGER, project_id INTEGER, task_details VARCHAR(255), "eg Agree Objectives" VARCHAR(1) ) CREATE TABLE Projects ( project_id INTEGER, organisation_id INTEGER, project_details VARCHAR(255) ) CREATE TABLE Organisations ( organisation_id INTEGER, organisa...
SELECT T2.organisation_details, T1.organisation_id FROM Grants AS T1 JOIN Organisations AS T2 ON T1.organisation_id = T2.organisation_id GROUP BY T2.organisation_details ORDER BY T2.organisation_details
nvbench
CREATE TABLE table_201_13 ( id number, "city" text, "county(ies)" text, "population\n(2000 census)" number, "population\n(2010 census)" number, "class" text, "incorporation\ndate" number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- county has a...
SELECT "county(ies)" FROM table_201_13 WHERE "city" = 'altoona'
squall
CREATE TABLE table_17661 ( "Strongs #" text, "Hebrew word" text, "Strongs Transliteration" text, "Strongs Words Compounded" text, "English Spelling" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the hebrew word listed for strongs # 5418?
SELECT "Hebrew word" FROM table_17661 WHERE "Strongs #" = '5418'
wikisql
CREATE TABLE table_57131 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- In the match as corio oval, who was the away tea...
SELECT "Away team" FROM table_57131 WHERE "Venue" = 'corio oval'
wikisql
CREATE TABLE table_45298 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What methos did Keith Wisniewski use in the ufc fig...
SELECT "Method" FROM table_45298 WHERE "Event" = 'ufc fight night: teixeira vs. bader'
wikisql
CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, ...
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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'OAKLAND...
atis
CREATE TABLE table_name_8 ( report VARCHAR, date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Report has the Date September 3, 2005?
SELECT report FROM table_name_8 WHERE date = "september 3, 2005"
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 hz_info JOIN mzjzjlb JOIN jybgb JOIN jyjgzbb ON hz_info.YLJGDM = mzjzjlb.YLJGDM AND hz_info.KH = mzjzjlb.KH AND hz_info.KLX = mzjzjlb.KLX AND mzjzjlb.YLJGDM = jybgb.YLJGDM_MZJZJLB AND mzjzjlb.JZLSH = jybgb.JZLSH_MZJZJLB AND jybgb.YLJGDM = jyjgzbb.YLJGDM AND jybgb.BGDH = jy...
css
CREATE TABLE table_name_80 ( director VARCHAR, role VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Director has a Role of melissa?
SELECT director FROM table_name_80 WHERE role = "melissa"
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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "70" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
mimicsql_data
CREATE TABLE table_name_54 ( silver INTEGER, total VARCHAR, bronze VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the highest silver when the total is 4 and bronze is less than 1?
SELECT MAX(silver) FROM table_name_54 WHERE total = "4" AND bronze < 1
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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "71" AND procedures.icd9_code = "5732"
mimicsql_data
CREATE TABLE table_67383 ( "7:00" text, "7:30" text, "8:00" text, "8:30" text, "9:00" text, "10:00" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What 7:00 has a 7:30 of w-five?
SELECT "7:00" FROM table_67383 WHERE "7:30" = 'w-five'
wikisql
CREATE TABLE t_kc22 ( MED_EXP_DET_ID text, OVERALL_CD_ORG text, OVERALL_CD_PERSON text, MED_CLINIC_ID text, MED_EXP_BILL_ID text, SOC_SRT_DIRE_CD text, SOC_SRT_DIRE_NM text, DIRE_TYPE number, CHA_ITEM_LEV number, MED_INV_ITEM_TYPE text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT SOC_SRT_DIRE_NM, EACH_DOSAGE, USE_FRE FROM t_kc22 WHERE MED_CLINIC_ID = '49113523818'
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...
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-3355' AND patient.hospitaldischargetime IS NULL)) AND microlab.cultur...
eicu
CREATE TABLE table_2409041_3 ( production_code VARCHAR, original_air_date VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many production codes have an original airdate of November 16, 1990?
SELECT COUNT(production_code) FROM table_2409041_3 WHERE original_air_date = "November 16, 1990"
sql_create_context
CREATE TABLE table_67134 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game when the record was 58 47?
SELECT "Score" FROM table_67134 WHERE "Record" = '58–47'
wikisql
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NA...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID
nvbench
CREATE TABLE table_203_161 ( id number, "pos." text, "div." number, "no." number, "team" text, "drivers" text, "car" text, "laps" number, "qual.\npos." number ) -- Using valid SQLite, answer the following questions for the tables provided above. -- who was phil ward racing 's othe...
SELECT "drivers" FROM table_203_161 WHERE "team" = 'phil ward racing' AND "drivers" <> 'phil ward'
squall
CREATE TABLE table_48544 ( "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 ) -- Using valid SQLite, answer the following questions for the ta...
SELECT "2007" FROM table_48544 WHERE "2006" = 'wta premier tournaments'
wikisql
CREATE TABLE table_894 ( "District" real, "Incumbent" text, "Party" text, "Elected" real, "Status" text, "Opponent" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what was the lowest numbers for the winner gregory w. meeks
SELECT MIN("Elected") FROM table_894 WHERE "Incumbent" = 'Gregory W. Meeks'
wikisql
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime 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 d_icd_diag...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85895) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'chloride') AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRE...
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 diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.admityear < "2114"
mimicsql_data
CREATE TABLE table_name_72 ( area__km_2__ INTEGER, population__2000_ VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the smallest area with 45 population?
SELECT MIN(area__km_2__) FROM table_name_72 WHERE population__2000_ = "45"
sql_create_context
CREATE TABLE table_name_37 ( object_type VARCHAR, ngc_number VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Object type has an NGC number of 2171?
SELECT object_type FROM table_name_37 WHERE ngc_number = 2171
sql_create_context
CREATE TABLE table_name_24 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is 2010 when 2006 is 3r?
SELECT 2010 FROM table_name_24 WHERE 2006 = "3r"
sql_create_context
CREATE TABLE table_name_35 ( tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the 1976 value of the Australian Open?
SELECT 1976 FROM table_name_35 WHERE tournament = "australian open"
sql_create_context
CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, Dele...
SELECT Posts.Id AS "post_link" FROM Posts WHERE Posts.OwnerUserId = @UserId
sede
CREATE TABLE table_24765815_1 ( team VARCHAR, rank VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What team was ranked in 7th?
SELECT team FROM table_24765815_1 WHERE rank = "7th"
sql_create_context
CREATE TABLE table_49985 ( "Draw" real, "Song" text, "Artist" text, "Televotes" real, "Place" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Draw(s), when Televotes is greater than 1761, when Song is 'Ils Sont L ', and wh...
SELECT COUNT("Draw") FROM table_49985 WHERE "Televotes" > '1761' AND "Song" = 'ils sont là' AND "Place" < '2'
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, ...
SELECT COUNT(DISTINCT t2.uniquepid) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'bronchitis') AS t1 GROUP BY t1.uniquepid HAVING MIN(t1.diagnosis...
eicu
CREATE TABLE table_name_99 ( Id VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who came in 3rd at Venue?
SELECT 3 AS rd_place FROM table_name_99 WHERE "venue" = "venue"
sql_create_context
CREATE TABLE Addresses ( city VARCHAR, address_id VARCHAR ) CREATE TABLE Staff ( staff_address_id VARCHAR, first_name VARCHAR, last_name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which city does staff with first name as Janessa and last nam...
SELECT T1.city FROM Addresses AS T1 JOIN Staff AS T2 ON T1.address_id = T2.staff_address_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"
sql_create_context
CREATE TABLE table_36098 ( "Tournament" text, "1998" text, "1999" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "Career SR" text, "Caree...
SELECT "2007" FROM table_36098 WHERE "2008" = '0 / 4'
wikisql
CREATE TABLE table_name_85 ( datacenter VARCHAR, features VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Datacenter is listed against the network access connections: rras Feature?
SELECT datacenter FROM table_name_85 WHERE features = "network access connections: rras"
sql_create_context
CREATE TABLE table_name_12 ( average_attendance INTEGER, _number_of_home_games VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Average Attendance during the Year in which there were 9 Home Games?
SELECT MAX(average_attendance) FROM table_name_12 WHERE _number_of_home_games = 9
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...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Closed bronchial biopsy"
mimicsql_data
CREATE TABLE table_63127 ( "Player" text, "Int'l Debut" text, "Year" real, "Cross Code Debut" text, "Date" text, "Position" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What date was the Cross Code Debut of rl 1st test great britain v australi...
SELECT "Date" FROM table_63127 WHERE "Cross Code Debut" = 'rl 1st test great britain v australia' AND "Int'l Debut" = 'ru five nations v ireland'
wikisql
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 decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC
nvbench
CREATE TABLE table_name_83 ( ihsaa_class VARCHAR, location VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which IHSAA Class has a Location of linton?
SELECT ihsaa_class FROM table_name_83 WHERE location = "linton"
sql_create_context
CREATE TABLE hz_info ( KH text, KLX number, RYBH text, YLJGDM text ) CREATE TABLE jybgb_jyjgzbb ( JYZBLSH number, YLJGDM text, jyjgzbb_id number ) CREATE TABLE zyjzjlb ( CYBQDM text, CYBQMC text, CYCWH text, CYKSDM text, CYKSMC text, CYSJ time, CYZTDM number, ...
SELECT jybgb.BGDH 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 = '沈景辉' AND jybg...
css
CREATE TABLE table_204_323 ( id number, "year" number, "film" text, "function" text, "notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- how many films did ms. starfelt produce after 2010 ?
SELECT COUNT("film") FROM table_204_323 WHERE "year" > 2010
squall
CREATE TABLE table_64575 ( "County" text, "Location" text, "Distance" real, "Total" real, "Notes" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Distance has Notes of north end terminus of ar 155?
SELECT SUM("Distance") FROM table_64575 WHERE "Notes" = 'north end terminus of ar 155'
wikisql