instruction
stringlengths
151
7.46k
output
stringlengths
2
4.44k
source
stringclasses
26 values
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.age >= "83"
mimicsql_data
CREATE TABLE table_name_60 ( feature VARCHAR, name VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what is the feature named bird ridge?
SELECT feature FROM table_name_60 WHERE name = "bird ridge"
sql_create_context
CREATE TABLE table_name_68 ( score VARCHAR, player VARCHAR, country VARCHAR, year VARCHAR, margin_of_victory VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Score has a Year larger than 1980, and a Margin of victory of 2 strokes, and a Count...
SELECT score FROM table_name_68 WHERE year > 1980 AND margin_of_victory = "2 strokes" AND country = "united states" AND player = "jim furyk"
sql_create_context
CREATE TABLE table_16201 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who wrote the episode titled 'black'?
SELECT "Written by" FROM table_16201 WHERE "Title" = 'Black'
wikisql
CREATE TABLE table_name_53 ( college VARCHAR, overall VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which College had an Overall pick of 171?
SELECT college FROM table_name_53 WHERE overall = 171
sql_create_context
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid num...
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'anemia - sickle cell anemia' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-1 year'))
eicu
CREATE TABLE table_name_7 ( attendance INTEGER, record VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the attendance of the Blue Jays' game when their record was 47-43?
SELECT SUM(attendance) FROM table_name_7 WHERE record = "47-43"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25997) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'bicarbonate') AND DATETIME(labevents.charttime) <= DATETIME(CURRENT_TIME(), '-64...
mimic_iii
CREATE TABLE table_20613 ( "Missouri vs." text, "Overall Record" text, "at Columbia" text, "at Opponents Venue" text, "at Neutral Site" text, "Last 5 Meetings" text, "Last 10 Meetings" text, "Current Streak" text, "During Time in Big 12" text ) -- Using valid SQLite, answer the fol...
SELECT COUNT("at Opponents Venue") FROM table_20613 WHERE "Missouri vs." = 'Oklahoma'
wikisql
CREATE TABLE climber ( Climber_ID int, Name text, Country text, Time text, Points real, Mountain_ID int ) CREATE TABLE mountain ( Mountain_ID int, Name text, Height real, Prominence real, Range text, Country text ) -- Using valid SQLite, answer the following questions ...
SELECT Country, COUNT(Country) FROM mountain WHERE Height > 5000 GROUP BY Country
nvbench
CREATE TABLE table_49287 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What opponent has 76,202 attendance ?
SELECT "Opponent" FROM table_49287 WHERE "Attendance" = '76,202'
wikisql
CREATE TABLE table_name_21 ( car__number INTEGER, winnings VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the average car number of all the drivers who have won $111,683?
SELECT AVG(car__number) FROM table_name_21 WHERE winnings = "$111,683"
sql_create_context
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE flight_s...
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 = 'LAS VEGAS' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ONT...
atis
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 ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.formulary_drug_cd = "TACR1"
mimicsql_data
CREATE TABLE table_name_39 ( us_r VARCHAR, b VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the US R&B for 1981
SELECT us_r & b FROM table_name_39 WHERE year = 1981
sql_create_context
CREATE TABLE table_name_75 ( game INTEGER, opponent VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the most game with opponent of hartford whalers
SELECT MAX(game) FROM table_name_75 WHERE opponent = "hartford whalers"
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Anemia-other chronic dis"
mimicsql_data
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.short_title = "Disrup-external op wound"
mimicsql_data
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, chartt...
SELECT COUNT(*) 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 = 56635)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'mediastinal' AND d...
mimic_iii
CREATE TABLE table_name_87 ( train_no VARCHAR, origin VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is number of the train that originated in Secunderabad Junction?
SELECT train_no FROM table_name_87 WHERE origin = "secunderabad junction"
sql_create_context
CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text te...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%Chennai%' OR UPPER(Location) LIKE '%CHENNAI' ORDER BY Reputation DESC LIMIT 100
sede
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, ...
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 70473) AND NOT transfers.careunit IS NULL ORDER BY transfers.intime LIMIT 1
mimic_iii
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABL...
SELECT DISTINCT program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND course.number = 997 AND program_course.course_id = course.course_id
advising
CREATE TABLE table_67933 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the average attendance when the record was 19-13?
SELECT AVG("Attendance") FROM table_67933 WHERE "Record" = '19-13'
wikisql
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversa...
SELECT YEAR(Posts.ClosedDate) AS y, MONTH(Posts.ClosedDate) AS m, CAST(YEAR(Posts.ClosedDate) AS TEXT(10)) + '/' + CAST(MONTH(Posts.ClosedDate) AS TEXT(19)) AS ym, COUNT(CONCAT('http://programmers.stackexchange.com/q/', Posts.Id)) AS Questions FROM PostHistory JOIN Posts ON Posts.Id = PostHistory.PostId WHERE Posts.Clo...
sede
CREATE TABLE table_5192 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the round of Jimmy Drolet from Canada?
SELECT "Round" FROM table_5192 WHERE "Nationality" = 'canada' AND "Player" = 'jimmy drolet'
wikisql
CREATE TABLE table_59241 ( "Name" text, "Total" real, "Outstanding Performance" real, "Fighting Spirit" real, "Technique" real, "Years" text, "Highest rank" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How much Technique has the Highest ra...
SELECT COUNT("Technique") FROM table_59241 WHERE "Highest rank" = 'yokozuna' AND "Total" > '11'
wikisql
CREATE TABLE flight ( velocity INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many flights have a velocity larger than 200?
SELECT COUNT(*) FROM flight WHERE velocity > 200
sql_create_context
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PendingFlags ...
SELECT Id, CreationDate FROM Users WHERE YEAR(CreationDate) = 2011 ORDER BY CreationDate
sede
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, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY COMMISSION_PCT DESC
nvbench
CREATE TABLE table_56617 ( "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. -- What home team played against the away team with...
SELECT "Home team" FROM table_56617 WHERE "Away team score" = '13.6 (84)'
wikisql
CREATE TABLE table_name_19 ( country VARCHAR, to_par VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country parred E and scored 71-73-70-74=288?
SELECT country FROM table_name_19 WHERE to_par = "e" AND score = 71 - 73 - 70 - 74 = 288
sql_create_context
CREATE TABLE table_203_171 ( id number, "place\n(posicion)" number, "team\n(equipo)" text, "played\n(pj)" number, "won\n(pg)" number, "draw\n(pe)" number, "lost\n(pp)" number, "goals scored\n(gf)" number, "goals conceded\n(gc)" number, "+/-\n(dif.)" number, "points\n(pts.)" n...
SELECT "won\n(pg)" FROM table_203_171 WHERE "team\n(equipo)" = 'chorrillo f.c'
squall
CREATE TABLE table_name_90 ( language VARCHAR, role VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What language is the film with a character named Annabelle?
SELECT language FROM table_name_90 WHERE role = "annabelle"
sql_create_context
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT demographic.dob FROM demographic WHERE demographic.name = "Jane Dillard"
mimicsql_data
CREATE TABLE table_21907770_4 ( date VARCHAR, versus VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What are the dates where the versus team is South Africa?
SELECT date FROM table_21907770_4 WHERE versus = "South Africa"
sql_create_context
CREATE TABLE table_74576 ( "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. -- What was the crowd when the VFL played MCG?
SELECT MIN("Crowd") FROM table_74576 WHERE "Venue" = 'mcg'
wikisql
CREATE TABLE table_32503 ( "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. -- What was the away team's score at Western Oval?
SELECT "Away team score" FROM table_32503 WHERE "Venue" = 'western oval'
wikisql
CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE icustays ( row...
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 3911)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [systo...
mimic_iii
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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varc...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID
nvbench
CREATE TABLE table_29045 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written 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 a...
SELECT "Original air date" FROM table_29045 WHERE "U.S. viewers (millions)" = '8.62'
wikisql
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY AVG(EMPLOYEE_ID)
nvbench
CREATE TABLE Rating ( rID int, mID int, stars int, ratingDate date ) CREATE TABLE Reviewer ( rID int, name text ) CREATE TABLE Movie ( mID int, title text, year int, director text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Pleas...
SELECT T2.title, AVG(MIN(T1.stars)) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.title ORDER BY T2.title
nvbench
CREATE TABLE table_27050336_7 ( delegate VARCHAR, counties_represented VARCHAR, committee VARCHAR, party VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- For democratic party, countries represented is montgomery and where committee is judiciary mention...
SELECT delegate FROM table_27050336_7 WHERE committee = "Judiciary" AND party = "Democratic" AND counties_represented = "Montgomery"
sql_create_context
CREATE TABLE table_19534874_2 ( indoor VARCHAR, wing VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the indoor number for the NJ wing/
SELECT indoor FROM table_19534874_2 WHERE wing = "NJ"
sql_create_context
CREATE TABLE table_40024 ( "Date" text, "Score" text, "Set 1" text, "Set 2" text, "Set 3" text, "Set 4" text, "Set 5" text, "Total" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the set 1 with a 28-30 set 4?
SELECT "Set 1" FROM table_40024 WHERE "Set 4" = '28-30'
wikisql
CREATE TABLE table_44320 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" text, "Best" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the qual 2 of team Forsythe racing, which has a 1:09.515 best?
SELECT "Qual 2" FROM table_44320 WHERE "Team" = 'forsythe racing' AND "Best" = '1:09.515'
wikisql
CREATE TABLE table_15858 ( "Player" text, "No." real, "Nationality" text, "Position" text, "Years in Toronto" text, "School/Club Team" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which number was Patrick O'Bryant?
SELECT "No." FROM table_15858 WHERE "Player" = 'Patrick O''Bryant'
wikisql
CREATE TABLE table_351 ( "Year" real, "Song name" text, "Film name" text, "Co-singer" text, "Music director" text, "Lyricist" text, "Language" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- what are the film names with the co-singer vinod ra...
SELECT "Film name" FROM table_351 WHERE "Co-singer" = 'Vinod Rathod'
wikisql
CREATE TABLE Staff_Department_Assignments ( staff_id INTEGER, department_id INTEGER, date_assigned_from DATETIME, job_title_code VARCHAR(10), date_assigned_to DATETIME ) CREATE TABLE Order_Items ( order_item_id INTEGER, order_id INTEGER, product_id INTEGER ) CREATE TABLE Products ( ...
SELECT MAX(product_price), MIN(product_price) FROM Products
nvbench
CREATE TABLE table_name_4 ( evening_gown INTEGER, average VARCHAR, interview VARCHAR, swimsuit VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the sum of the evening gown scores where the interview score is less than 8.77, the swimsuit score i...
SELECT SUM(evening_gown) FROM table_name_4 WHERE interview < 8.77 AND swimsuit = 7.8 AND average < 8.2
sql_create_context
CREATE TABLE table_name_6 ( country VARCHAR, score VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What country was the player with the score line 69-71-72-69=281 from?
SELECT country FROM table_name_6 WHERE score = 69 - 71 - 72 - 69 = 281
sql_create_context
CREATE TABLE table_name_34 ( games_per_goal INTEGER, a_league VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which player from A-League 39 (110) has the highest games per goal?
SELECT MAX(games_per_goal) FROM table_name_34 WHERE a_league = "39 (110)"
sql_create_context
CREATE TABLE table_name_23 ( laps VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of laps that were completed in 1949?
SELECT COUNT(laps) FROM table_name_23 WHERE year = "1949"
sql_create_context
CREATE TABLE table_name_8 ( lane VARCHAR, mark VARCHAR, react VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the total number of Lane, when Mark is '7.93', and when React is less than 0.145?
SELECT COUNT(lane) FROM table_name_8 WHERE mark = 7.93 AND react < 0.145
sql_create_context
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 t_kc21.IN_HOSP_DAYS FROM t_kc21 WHERE t_kc21.MED_CLINIC_ID = '33468513439'
css
CREATE TABLE Maintenance_Engineers ( engineer_id INTEGER, company_id INTEGER, first_name VARCHAR(50), last_name VARCHAR(50), other_details VARCHAR(255) ) CREATE TABLE Engineer_Visits ( engineer_visit_id INTEGER, contact_staff_id INTEGER, engineer_id INTEGER, fault_log_entry_id INTEG...
SELECT part_name, COUNT(*) FROM Parts AS T1 JOIN Asset_Parts AS T2 ON T1.part_id = T2.part_id GROUP BY T1.part_name
nvbench
CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_400 text, meter_500 text, meter_600 text, meter_700 text, Time text ) ...
SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY SUM(meter_100)
nvbench
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 COUNT(*) FROM t_kc22 WHERE t_kc22.t_kc21_PERSON_ID = '89232453' AND t_kc22.STA_DATE BETWEEN '2013-04-26' AND '2016-08-03' GROUP BY t_kc22.SOC_SRT_DIRE_CD ORDER BY COUNT(*) DESC LIMIT 1
css
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id num...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT prescriptions.hadm_id FROM prescriptions WHERE prescriptions.drug = 'fenofibrate micronized') AND STRFTIME('%y', cost.chargetime) = '2105' GROUP BY cost.hadm_id) AS t1
mimic_iii
CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int ) CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) -- Using valid SQLite, answer the following questions fo...
SELECT Type, AVG(Tonnage) FROM ship GROUP BY Type
nvbench
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-3162')) AND lab.labname = 'potassium' AND STRFTIME('%y-%m', lab.labresulttime) ...
eicu
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TAB...
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'mechanical ventilation - assist controlled' AND STRFTIME('%y', treatment.treatmenttime) >= '2102') AS t1 JOI...
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_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc21.MED_CLINIC_ID FROM t_kc21 WHERE t_kc21.PERSON_ID = '47601904' AND NOT t_kc21.MED_CLINIC_ID IN (SELECT t_kc21_t_kc22.MED_CLINIC_ID FROM t_kc22 WHERE t_kc22.AMOUNT <= 871.18)
css
CREATE TABLE table_name_46 ( opponent VARCHAR, week VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which opponent was played on week 9?
SELECT opponent FROM table_name_46 WHERE week = 9
sql_create_context
CREATE TABLE table_26355116_1 ( enrollment INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the maximum enrollment of the schools?
SELECT MAX(enrollment) FROM table_26355116_1
sql_create_context
CREATE TABLE t_kc22 ( AMOUNT number, CHA_ITEM_LEV number, DATA_ID text, DIRE_TYPE number, DOSE_FORM text, DOSE_UNIT text, EACH_DOSAGE text, EXP_OCC_DATE time, FLX_MED_ORG_ID text, FXBZ number, HOSP_DOC_CD text, HOSP_DOC_NM text, MED_DIRE_CD text, MED_DIRE_NM text,...
SELECT t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM, AVG(t_kc21.PERSON_AGE) FROM t_kc21 WHERE t_kc21.MED_SER_ORG_NO = '2256042' GROUP BY t_kc21.MED_ORG_DEPT_NM, t_kc21.OUT_DIAG_DIS_NM
css
CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, win...
SELECT local_authority, COUNT(local_authority) FROM station GROUP BY local_authority
nvbench
CREATE TABLE table_5584 ( "Round" real, "Pick #" real, "Overall" real, "Name" text, "Position" text, "College" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which Overall is the average one that has a Name of vance walker?
SELECT AVG("Overall") FROM table_5584 WHERE "Name" = 'vance walker'
wikisql
CREATE TABLE table_21990 ( "Year (Ceremony)" text, "Film title used in nomination" text, "Original title" text, "Director" text, "Result" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many directors were there for the film with the original tit...
SELECT COUNT("Director") FROM table_21990 WHERE "Original title" = 'The Moises Padilla Story'
wikisql
CREATE TABLE table_77078 ( "Player" text, "Nationality" text, "Jersey Number(s)" real, "Position" text, "Years" text, "From" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What years did the player with the jersey number bigger than 20 play?
SELECT "Years" FROM table_77078 WHERE "Jersey Number(s)" > '20'
wikisql
CREATE TABLE table_59743 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the score of the game when they played at new york islanders?
SELECT "Score" FROM table_59743 WHERE "Home" = 'new york islanders'
wikisql
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 zyjzjlb.JZLSH FROM hz_info JOIN zyjzjlb JOIN hz_info_zyjzjlb ON hz_info.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info.KH = zyjzjlb.KH AND hz_info.KLX = zyjzjlb.KLX AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyjzjlb.YLJGDM = hz_info_zyjzjlb.YLJGDM AND hz_info_zyjzjlb.JZLSH = zyjzjlb.JZLSH AND hz_info_zyj...
css
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_i...
SELECT DISTINCT cost.cost FROM cost WHERE cost.event_type = 'procedures_icd' AND cost.event_id IN (SELECT procedures_icd.row_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'heart vessel op nec'))
mimic_iii
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT demographic.days_stay, lab.label FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.subject_id = "32418"
mimicsql_data
CREATE TABLE table_name_71 ( against INTEGER, opposing_teams VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the largest Against with an Opposing Teams of wales?
SELECT MAX(against) FROM table_name_71 WHERE opposing_teams = "wales"
sql_create_context
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, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, ...
SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE
nvbench
CREATE TABLE table_203_424 ( id number, "year" number, "starts" number, "wins" number, "top 5" number, "top 10" number, "poles" number, "avg. start" number, "avg. finish" number, "winnings" text, "position" text, "team(s)" text ) -- Using valid SQLite, answer the follow...
SELECT COUNT("year") FROM table_203_424 WHERE "top 10" > 0
squall
CREATE TABLE table_37857 ( "Rank" real, "Name" text, "Point" real, "Played" real, "Draw" real, "Lose" real, "Goal in" real, "Goal loss" real, "Goal diff" real ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the highest number of l...
SELECT MAX("Lose") FROM table_37857 WHERE "Name" = 'santos' AND "Point" > '45'
wikisql
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE c...
SELECT AVG(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'exc chest cage bone les')) AND STRFTIME('%y', cost.charge...
mimic_iii
CREATE TABLE jybgb ( BBCJBW text, BBDM text, BBMC text, BBZT number, BGDH text, BGJGDM text, BGJGMC text, BGRGH text, BGRQ time, BGRXM text, BGSJ time, CJRQ time, JSBBRQSJ time, JSBBSJ time, JYBBH text, JYJGMC text, JYJSGH text, JYJSQM text, JY...
SELECT jyjgzbb.CKZFWDX, jyjgzbb.CKZFWXX, jyjgzbb.CKZFWSX FROM jyjgzbb WHERE jyjgzbb.JYZBLSH = '51351189331'
css
CREATE TABLE table_22509 ( "Province, Community" text, "Contestant" text, "Age" real, "Height" text, "Hometown" text, "Geographical Regions" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- When el cibao is the geographical region and the height i...
SELECT "Contestant" FROM table_22509 WHERE "Height" = '1.80' AND "Geographical Regions" = 'El Cibao'
wikisql
CREATE TABLE table_60554 ( "Election" text, "1st Member" text, "1st Party" text, "2nd Member" text, "2nd Party" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What 2nd Member has a 2nd Party of conservative, and an Election of 1853 by-election?
SELECT "2nd Member" FROM table_60554 WHERE "2nd Party" = 'conservative' AND "Election" = '1853 by-election'
wikisql
CREATE TABLE table_name_54 ( opponent VARCHAR, tournament VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the name of the opponent at the Herceg Novi tournament?
SELECT opponent FROM table_name_54 WHERE tournament = "herceg novi"
sql_create_context
CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE ...
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 16169) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1)
mimic_iii
CREATE TABLE movie ( movie_id int, Title text, Year int, Director text, Budget_million real, Gross_worldwide int ) CREATE TABLE book_club ( book_club_id int, Year int, Author_or_Editor text, Book_Title text, Publisher text, Category text, Result text ) CREATE TABLE ...
SELECT Category, COUNT(*) FROM book_club GROUP BY Category ORDER BY Category DESC
nvbench
CREATE TABLE table_18012738_1 ( ai___percentage_ INTEGER ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the least ai %
SELECT MIN(ai___percentage_) FROM table_18012738_1
sql_create_context
CREATE TABLE departments ( department_id number, dept_store_id number, department_name text ) CREATE TABLE staff_department_assignments ( staff_id number, department_id number, date_assigned_from time, job_title_code text, date_assigned_to time ) CREATE TABLE supplier_addresses ( s...
SELECT supplier_id FROM product_suppliers GROUP BY supplier_id HAVING AVG(total_amount_purchased) > 50000 OR AVG(total_amount_purchased) < 30000
spider
CREATE TABLE table_12994 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- The game played on October 2, 1966 had what result?
SELECT "Result" FROM table_12994 WHERE "Date" = 'october 2, 1966'
wikisql
CREATE TABLE table_69005 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Time" text, "Att." text, "Record" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What Records Time is 3:38?
SELECT "Record" FROM table_69005 WHERE "Time" = '3:38'
wikisql
CREATE TABLE table_name_8 ( film_title_used_in_nomination VARCHAR, language VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Name the film title for german
SELECT film_title_used_in_nomination FROM table_name_8 WHERE language = "german"
sql_create_context
CREATE TABLE table_38551 ( "Event" text, "2006\u201307" text, "2007\u201308" text, "2008\u201309" text, "2009\u201310" text, "2010\u201311" text, "2012\u201313" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Which 2008 09 has a 2012 13 of q,...
SELECT "2008\u201309" FROM table_38551 WHERE "2012\u201313" = 'q' AND "2006\u201307" = 'q' AND "2007\u201308" = 'qf'
wikisql
CREATE TABLE table_11677691_11 ( position VARCHAR, player VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- How many positions does Greg Bryant play?
SELECT COUNT(position) FROM table_11677691_11 WHERE player = "Greg Bryant"
sql_create_context
CREATE TABLE table_name_46 ( name VARCHAR, license VARCHAR, actual_version VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What name has a License of gpl, and an Actual version of 0.8.29wip4?
SELECT name FROM table_name_46 WHERE license = "gpl" AND actual_version = "0.8.29wip4"
sql_create_context
CREATE TABLE table_name_57 ( tour_apps VARCHAR, career_caps VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the tour Apps when the career caps show 15?
SELECT tour_apps FROM table_name_57 WHERE career_caps = 15
sql_create_context
CREATE TABLE table_12132 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What is the score on 5 October 2004?
SELECT "Score" FROM table_12132 WHERE "Date" = '5 october 2004'
wikisql
CREATE TABLE table_name_2 ( bass VARCHAR, label VARCHAR, year VARCHAR ) -- Using valid SQLite, answer the following questions for the tables provided above. -- Who played bass in 1994 for the Atlantic label?
SELECT bass FROM table_name_2 WHERE label = "atlantic" AND year = 1994
sql_create_context
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.long_title = "Infectious mononucleosis"
mimicsql_data
CREATE TABLE tip ( tip_id int, business_id varchar, text longtext, user_id varchar, likes int, year int, month varchar ) CREATE TABLE neighborhood ( id int, business_id varchar, neighborhood_name varchar ) CREATE TABLE business ( bid int, business_id varchar, name v...
SELECT neighborhood.neighborhood_name FROM business, neighborhood WHERE business.city = 'Madison' AND neighborhood.business_id = business.business_id GROUP BY neighborhood.neighborhood_name ORDER BY COUNT(DISTINCT (business.name)) DESC LIMIT 1
yelp
CREATE TABLE table_9880 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Attendance" text ) -- Using valid SQLite, answer the following questions for the tables provided above. -- What was the Opponent in the game with a Result of W 23-7?
SELECT "Opponent" FROM table_9880 WHERE "Result" = 'w 23-7'
wikisql