instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
tell me the daily minimum respiration of patient 010-15363 since 62 months ago.
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid...
SELECT MIN(vitalperiodic.respiration) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-15363')) AND NOT vitalperiodic.respiration IS ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: tell me the daily minimum respiration of patient 010-15363 since 62 months ago. ### Input: CREATE TABLE microlab ( micro...
give the insurance details and ethnicity of subject id 21796.
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 demographic.insurance, demographic.ethnicity FROM demographic WHERE demographic.subject_id = "21796"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give the insurance details and ethnicity of subject id 21796. ### Input: CREATE TABLE lab ( subject_id text, hadm_id...
What is the listed crowd when hawthorn is away?
CREATE TABLE table_77907 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT COUNT("Crowd") FROM table_77907 WHERE "Away team" = 'hawthorn'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the listed crowd when hawthorn is away? ### Input: CREATE TABLE table_77907 ( "Home team" text, "Home team s...
give me the number of patients whose drug name is ascorbic acid?
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,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Ascorbic Acid"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients whose drug name is ascorbic acid? ### Input: CREATE TABLE prescriptions ( subject_id text...
can you list all flights from CHICAGO to ST. LOUIS that depart after 1200
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE T...
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 = 'ST. LOUIS' AND flight.departure_time > 1200 AND flight.to_airport = AIRPORT_SERVICE_1.air...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: can you list all flights from CHICAGO to ST. LOUIS that depart after 1200 ### Input: CREATE TABLE restriction ( restrict...
Display a bar chart for how old is the average person for each job?
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
SELECT job, AVG(age) FROM Person GROUP BY job
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Display a bar chart for how old is the average person for each job? ### Input: CREATE TABLE Person ( name varchar(20), ...
What date did episode 115 in the series originally air?
CREATE TABLE table_26841 ( "Series" real, "Season" real, "Original air date" text, "Production code" real, "Episode title" text )
SELECT "Original air date" FROM table_26841 WHERE "Series" = '115'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What date did episode 115 in the series originally air? ### Input: CREATE TABLE table_26841 ( "Series" real, "Season...
All of a user's edits of other users' posts.
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId nu...
SELECT a.UserId AS "user_link", a.PostId AS "post_link", Comment, * FROM PostHistory AS a INNER JOIN Posts AS b ON a.PostId = b.Id WHERE a.PostHistoryTypeId = 5 AND b.CreationDate < '2014-01-01' AND a.CreationDate >= '2017-01-01' AND a.UserId = '##UserId##'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: All of a user's edits of other users' posts. ### Input: CREATE TABLE SuggestedEdits ( Id number, PostId number, ...
Who is the opponent of the game with a game number larger than 5 on June 22?
CREATE TABLE table_14278 ( "Game" real, "Date" text, "Opponent" text, "Score" text, "Location" text, "Record" text )
SELECT "Opponent" FROM table_14278 WHERE "Game" > '5' AND "Date" = 'june 22'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who is the opponent of the game with a game number larger than 5 on June 22? ### Input: CREATE TABLE table_14278 ( "Game...
What is the minimum age of patients who were either black or of cape verdean ethnicity and stayed in hospital for 9 days?
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND demographic.days_stay = "9"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the minimum age of patients who were either black or of cape verdean ethnicity and stayed in hospital for 9 days? ##...
how many patients whose admission location is phys referral/normal deli and lab test name is albumin/creatinine, urine?
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND lab.label = "Albumin/Creatinine, Urine"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose admission location is phys referral/normal deli and lab test name is albumin/creatinine, urine? ### ...
are there any flights from NEW YORK to MONTREAL CANADA leaving on thursday
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE time_zone ( time_zone_cod...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MONTREAL' AND CITY_1.country_name = 'CANADA' AND date_day.day_number = 24...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: are there any flights from NEW YORK to MONTREAL CANADA leaving on thursday ### Input: CREATE TABLE airline ( airline_cod...
which tribunal sentenced the largest number of executions ?
CREATE TABLE table_203_303 ( id number, "tribunal" text, "number of autos da fe" number, "executions in persona" number, "executions in effigie" number, "penanced" number, "total" number )
SELECT "tribunal" FROM table_203_303 ORDER BY "total" DESC LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: which tribunal sentenced the largest number of executions ? ### Input: CREATE TABLE table_203_303 ( id number, "trib...
What is the total number of every ship type by categorizing by nationality?, and sort the number of type in ascending order.
CREATE TABLE mission ( Mission_ID int, Ship_ID int, Code text, Launched_Year int, Location text, Speed_knots int, Fate text ) CREATE TABLE ship ( Ship_ID int, Name text, Type text, Nationality text, Tonnage int )
SELECT Type, COUNT(Type) FROM ship GROUP BY Nationality, Type ORDER BY COUNT(Type)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the total number of every ship type by categorizing by nationality?, and sort the number of type in ascending order....
What is the average Round for wide receiver r. jay soward and Overall smaller than 29?
CREATE TABLE table_name_16 ( round INTEGER, overall VARCHAR, position VARCHAR, name VARCHAR )
SELECT AVG(round) FROM table_name_16 WHERE position = "wide receiver" AND name = "r. jay soward" AND overall < 29
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the average Round for wide receiver r. jay soward and Overall smaller than 29? ### Input: CREATE TABLE table_name_16...
what was the name of the lab test that patient 010-17950 received for the last time?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, pat...
SELECT lab.labname FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-17950')) ORDER BY lab.labresulttime DESC LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the name of the lab test that patient 010-17950 received for the last time? ### Input: CREATE TABLE lab ( labid...
What is the per-capita GDP of the country with an overall GDP of 80.955?
CREATE TABLE table_67543 ( "Member countries" text, "Population" text, "Area (km\u00b2)" text, "GDP (billion US$)" text, "GDP per capita (US$)" text )
SELECT "GDP per capita (US$)" FROM table_67543 WHERE "GDP (billion US$)" = '80.955'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the per-capita GDP of the country with an overall GDP of 80.955? ### Input: CREATE TABLE table_67543 ( "Member c...
Who has the Home Score of 52-54?
CREATE TABLE table_75789 ( "Date" text, "Time" text, "Home" text, "Away" text, "Score" text, "Ground" text )
SELECT "Home" FROM table_75789 WHERE "Score" = '52-54'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who has the Home Score of 52-54? ### Input: CREATE TABLE table_75789 ( "Date" text, "Time" text, "Home" text, ...
Top 100 Reputation in Iran.
CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number,...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id, DisplayName, Reputation, WebsiteUrl, Location FROM Users WHERE Location LIKE '%Iran%' ORDER BY Reputation DESC LIMIT 1000
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Top 100 Reputation in Iran. ### Input: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time...
What was the total viewership for BBC One weekly rankings larger than 7, before episode 4?
CREATE TABLE table_69075 ( "Episode No." real, "Airdate" text, "Total Viewers" real, "Share" text, "BBC One Weekly Ranking" real )
SELECT "Total Viewers" FROM table_69075 WHERE "BBC One Weekly Ranking" > '7' AND "Episode No." < '4'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the total viewership for BBC One weekly rankings larger than 7, before episode 4? ### Input: CREATE TABLE table_690...
how many patients received a cont inv mec ven <96 hrs after the procedure of the insert endotracheal tube last year during the same hospital visit?
CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( ...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id 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 WHERE d_icd_procedures.short_...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients received a cont inv mec ven <96 hrs after the procedure of the insert endotracheal tube last year during t...
Who ran for office at the Georgia 4 district in this election?
CREATE TABLE table_1342315_10 ( candidates VARCHAR, district VARCHAR )
SELECT candidates FROM table_1342315_10 WHERE district = "Georgia 4"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who ran for office at the Georgia 4 district in this election? ### Input: CREATE TABLE table_1342315_10 ( candidates VAR...
Show names and seatings for all tracks opened after 2000.
CREATE TABLE race ( Race_ID int, Name text, Class text, Date text, Track_ID text ) CREATE TABLE track ( Track_ID int, Name text, Location text, Seating real, Year_Opened real )
SELECT Name, Seating FROM track WHERE Year_Opened > 2000
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show names and seatings for all tracks opened after 2000. ### Input: CREATE TABLE race ( Race_ID int, Name text, ...
In what round was a defensive tackle drafted with an overall pick smaller than 149?
CREATE TABLE table_name_25 ( round VARCHAR, position VARCHAR, overall VARCHAR )
SELECT COUNT(round) FROM table_name_25 WHERE position = "defensive tackle" AND overall < 149
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: In what round was a defensive tackle drafted with an overall pick smaller than 149? ### Input: CREATE TABLE table_name_25 ( ...
How many apartment bookings in each day? Show me a line chart grouping by booking end date, and I want to sort by the x axis in asc.
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE View_Unit_Status ( apt_id INTEG...
SELECT booking_end_date, COUNT(booking_end_date) FROM Apartment_Bookings GROUP BY booking_end_date ORDER BY booking_end_date
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many apartment bookings in each day? Show me a line chart grouping by booking end date, and I want to sort by the x axis...
Which Lost has a Club of club?
CREATE TABLE table_name_33 ( lost VARCHAR )
SELECT lost FROM table_name_33 WHERE "club" = "club"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Lost has a Club of club? ### Input: CREATE TABLE table_name_33 ( lost VARCHAR ) ### Response: SELECT lost FROM tab...
count the number of patients whose primary disease is sdh and procedure icd9 code is 309.
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "SDH" AND procedures.icd9_code = "309"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients whose primary disease is sdh and procedure icd9 code is 309. ### Input: CREATE TABLE diagnoses ...
what are the four most commonly prescribed medications the previous year?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 4
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are the four most commonly prescribed medications the previous year? ### Input: CREATE TABLE d_icd_diagnoses ( row_...
What to par has 7 as the place?
CREATE TABLE table_name_20 ( to_par VARCHAR, place VARCHAR )
SELECT to_par FROM table_name_20 WHERE place = "7"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What to par has 7 as the place? ### Input: CREATE TABLE table_name_20 ( to_par VARCHAR, place VARCHAR ) ### Response...
estimated glomerular filtration rate ( egfr ) < 60 ml / min
CREATE TABLE table_train_279 ( "id" int, "systolic_blood_pressure_sbp" int, "hemoglobin_a1c_hba1c" float, "estimated_glomerular_filtration_rate_egfr" int, "fasting_plasma_glucose" int, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "NOUSE" float )
SELECT * FROM table_train_279 WHERE estimated_glomerular_filtration_rate_egfr < 60
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: estimated glomerular filtration rate ( egfr ) < 60 ml / min ### Input: CREATE TABLE table_train_279 ( "id" int, "sys...
i need a flight from SAN FRANCISCO to BOSTON that leaves after 2200
CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TAB...
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 = 'BOSTON' AND flight.departure_time > 2200 AND flight.to_airport = AIRPORT_SERVICE_1.airpor...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: i need a flight from SAN FRANCISCO to BOSTON that leaves after 2200 ### Input: CREATE TABLE ground_service ( city_code t...
What is the number of patients who had procedure icd9 code 3950 and died in or before 2133?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2133.0" AND procedures.icd9_code = "3950"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the number of patients who had procedure icd9 code 3950 and died in or before 2133? ### Input: CREATE TABLE lab ( ...
What was Week 11 when Week 10 had Nebraska (7-1)?
CREATE TABLE table_name_99 ( week_11_nov_6 VARCHAR, week_10_oct_30 VARCHAR )
SELECT week_11_nov_6 FROM table_name_99 WHERE week_10_oct_30 = "nebraska (7-1)"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was Week 11 when Week 10 had Nebraska (7-1)? ### Input: CREATE TABLE table_name_99 ( week_11_nov_6 VARCHAR, wee...
What is the sum of Game, when Date is 'Wed. Nov. 14'?
CREATE TABLE table_name_26 ( game INTEGER, date VARCHAR )
SELECT SUM(game) FROM table_name_26 WHERE date = "wed. nov. 14"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the sum of Game, when Date is 'Wed. Nov. 14'? ### Input: CREATE TABLE table_name_26 ( game INTEGER, date VAR...
what are the five most commonly ordered lab tests for patients that had previously received below knee amputat nec within 2 months since 2102?
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) 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 ti...
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, 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_i...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are the five most commonly ordered lab tests for patients that had previously received below knee amputat nec within 2 ...
What's the 2008 of the Australian Open when the 2011 was 1R?
CREATE TABLE table_65895 ( "Tournament" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text )
SELECT "2008" FROM table_65895 WHERE "2011" = '1r' AND "Tournament" = 'australian open'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What's the 2008 of the Australian Open when the 2011 was 1R? ### Input: CREATE TABLE table_65895 ( "Tournament" text, ...
Placing of 3 had what match w-l?
CREATE TABLE table_name_20 ( matches_w_l VARCHAR, placing VARCHAR )
SELECT matches_w_l FROM table_name_20 WHERE placing = 3
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Placing of 3 had what match w-l? ### Input: CREATE TABLE table_name_20 ( matches_w_l VARCHAR, placing VARCHAR ) ### ...
For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the sum of code , and group by attribute founder, show by the X from high to low please.
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
SELECT T2.Founder, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Founder ORDER BY T2.Founder DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder an...
provide the number of patients whose diagnoses short title is anxiety state nos and drug route is oral?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anxiety state NOS" AND prescriptions.route = "ORAL"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: provide the number of patients whose diagnoses short title is anxiety state nos and drug route is oral? ### Input: CREATE TA...
What is the to par for Gene Littler?
CREATE TABLE table_name_42 ( to_par VARCHAR, player VARCHAR )
SELECT to_par FROM table_name_42 WHERE player = "gene littler"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the to par for Gene Littler? ### Input: CREATE TABLE table_name_42 ( to_par VARCHAR, player VARCHAR ) ### Re...
for the patients who received inotropic agent - milrinone in a year before, what are the top three most common procedures which have been followed within the same hospital visit?
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number...
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'inotr...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: for the patients who received inotropic agent - milrinone in a year before, what are the top three most common procedures wh...
What is the lowest block that has 328 as the spike, and a height less than 186?
CREATE TABLE table_40186 ( "Name" text, "Date of Birth" text, "Height" real, "Weight" real, "Spike" real, "Block" real )
SELECT MIN("Block") FROM table_40186 WHERE "Spike" = '328' AND "Height" < '186'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the lowest block that has 328 as the spike, and a height less than 186? ### Input: CREATE TABLE table_40186 ( "N...
Show different parties of people along with the number of people in each party Plot them as bar chart, and show by the the total number in desc.
CREATE TABLE debate ( Debate_ID int, Date text, Venue text, Num_of_Audience int ) CREATE TABLE people ( People_ID int, District text, Name text, Party text, Age int ) CREATE TABLE debate_people ( Debate_ID int, Affirmative int, Negative int, If_Affirmative_Win bool ...
SELECT Party, COUNT(*) FROM people GROUP BY Party ORDER BY COUNT(*) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show different parties of people along with the number of people in each party Plot them as bar chart, and show by the the t...
Which Country has a Score of 69-66=135?
CREATE TABLE table_name_76 ( country VARCHAR, score VARCHAR )
SELECT country FROM table_name_76 WHERE score = 69 - 66 = 135
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Country has a Score of 69-66=135? ### Input: CREATE TABLE table_name_76 ( country VARCHAR, score VARCHAR ) ###...
give the number of patients whose item id is 51218.
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 prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51218"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give the number of patients whose item id is 51218. ### Input: CREATE TABLE lab ( subject_id text, hadm_id text, ...
Provide me the number of patients with procedure icd9 code 9465 who died in or before 2164.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2164.0" AND procedures.icd9_code = "9465"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Provide me the number of patients with procedure icd9 code 9465 who died in or before 2164. ### Input: CREATE TABLE procedur...
Return a bar chart showing how many shops in each location, and I want to display in descending by the y-axis.
CREATE TABLE shop ( Shop_ID int, Shop_Name text, Location text, Open_Date text, Open_Year int ) CREATE TABLE device ( Device_ID int, Device text, Carrier text, Package_Version text, Applications text, Software_Platform text ) CREATE TABLE stock ( Shop_ID int, Device...
SELECT Location, COUNT(Location) FROM shop GROUP BY Location ORDER BY COUNT(Location) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Return a bar chart showing how many shops in each location, and I want to display in descending by the y-axis. ### Input: CR...
List the courses that satisfy the Other requirement that are on Intercultural Drama .
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program ( program_id int, name varchar, college varc...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (area.area LIKE '%Intercultural Drama%' OR course.description LIKE '%Intercultural Drama%' OR course.name LIKE '%I...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List the courses that satisfy the Other requirement that are on Intercultural Drama . ### Input: CREATE TABLE area ( cou...
how many nations earned no bronze medals ?
CREATE TABLE table_203_724 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
SELECT COUNT("nation") FROM table_203_724 WHERE "bronze" = 0
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many nations earned no bronze medals ? ### Input: CREATE TABLE table_203_724 ( id number, "rank" number, "na...
what was the total of the suprapubic urine output that patient 028-34632 had on the first icu visit?
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 SUM(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-34632') AND NOT patient.unitdischargetime IS...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the total of the suprapubic urine output that patient 028-34632 had on the first icu visit? ### Input: CREATE TABLE...
provide the number of patients whose admission type is elective and drug name is cosyntropin?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND prescriptions.drug = "Cosyntropin"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: provide the number of patients whose admission type is elective and drug name is cosyntropin? ### Input: CREATE TABLE lab ( ...
provide the number of female patients who had sedimentation rate lab test done.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab.label = "Sedimentation Rate"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: provide the number of female patients who had sedimentation rate lab test done. ### Input: CREATE TABLE demographic ( su...
among patients who had open and other replacement of aortic valve with tissue graft, how many of them were unmarried?
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, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "SINGLE" AND procedures.long_title = "Open and other replacement of aortic valve with tissue graft"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: among patients who had open and other replacement of aortic valve with tissue graft, how many of them were unmarried? ### In...
What was the Record at the game that had an attendance of 21,191?
CREATE TABLE table_54398 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
SELECT "Record" FROM table_54398 WHERE "Attendance" = '21,191'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the Record at the game that had an attendance of 21,191? ### Input: CREATE TABLE table_54398 ( "Date" text, ...
are there any flights after 2100 from SAN FRANCISCO to WASHINGTON
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,...
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 = 'WASHINGTON' AND flight.departure_time > 2100 AND flight.to_airport = AIRPORT_SERVICE_1.ai...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: are there any flights after 2100 from SAN FRANCISCO to WASHINGTON ### Input: CREATE TABLE flight ( aircraft_code_sequenc...
What is the Record of the game on November 15 against Visitor Chicago Black Hawks with a Score of 1 3?
CREATE TABLE table_8133 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text )
SELECT "Record" FROM table_8133 WHERE "Score" = '1–3' AND "Visitor" = 'chicago black hawks' AND "Date" = 'november 15'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the Record of the game on November 15 against Visitor Chicago Black Hawks with a Score of 1 3? ### Input: CREATE TAB...
What are the dates of birth of entrepreneurs with investor 'Simon Woodroffe' or 'Peter Jones', and count them by a line chart, and show by the x-axis from high to low.
CREATE TABLE entrepreneur ( Entrepreneur_ID int, People_ID int, Company text, Money_Requested real, Investor text ) CREATE TABLE people ( People_ID int, Name text, Height real, Weight real, Date_of_Birth text )
SELECT Date_of_Birth, COUNT(Date_of_Birth) FROM entrepreneur AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Investor = "Simon Woodroffe" OR T1.Investor = "Peter Jones" ORDER BY Date_of_Birth DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What are the dates of birth of entrepreneurs with investor 'Simon Woodroffe' or 'Peter Jones', and count them by a line char...
Name the least Laps for accident and gird more than 13
CREATE TABLE table_name_41 ( laps INTEGER, time_retired VARCHAR, grid VARCHAR )
SELECT MIN(laps) FROM table_name_41 WHERE time_retired = "accident" AND grid > 13
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name the least Laps for accident and gird more than 13 ### Input: CREATE TABLE table_name_41 ( laps INTEGER, time_re...
What is in 2007 has 2004 olympic games?
CREATE TABLE table_6270 ( "Tournament" text, "1999" text, "2000" text, "2001" text, "2002" text, "2003" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "Career Win-Loss" text )
SELECT "2007" FROM table_6270 WHERE "2004" = 'olympic games'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is in 2007 has 2004 olympic games? ### Input: CREATE TABLE table_6270 ( "Tournament" text, "1999" text, "20...
how long patient 73423's first stay was in the intensive care unit?
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( ...
SELECT STRFTIME('%j', icustays.outtime) - STRFTIME('%j', icustays.intime) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73423) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how long patient 73423's first stay was in the intensive care unit? ### Input: CREATE TABLE microbiologyevents ( row_id ...
What is the lowest Pick #, when College is 'Jackson State'?
CREATE TABLE table_name_98 ( pick__number INTEGER, college VARCHAR )
SELECT MIN(pick__number) FROM table_name_98 WHERE college = "jackson state"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the lowest Pick #, when College is 'Jackson State'? ### Input: CREATE TABLE table_name_98 ( pick__number INTEGER...
What was the opponents score when Geelong played as home team?
CREATE TABLE table_53647 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Away team score" FROM table_53647 WHERE "Home team" = 'geelong'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the opponents score when Geelong played as home team? ### Input: CREATE TABLE table_53647 ( "Home team" text, ...
Name the team where the date is november 17
CREATE TABLE table_17355716_5 ( team VARCHAR, date VARCHAR )
SELECT team FROM table_17355716_5 WHERE date = "November 17"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name the team where the date is november 17 ### Input: CREATE TABLE table_17355716_5 ( team VARCHAR, date VARCHAR ) ...
Visualize a pie chart with how many classes are held in each department?
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 PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIG...
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Visualize a pie chart with how many classes are held in each department? ### Input: CREATE TABLE CLASS ( CLASS_CODE varc...
count the number of patients whose days of hospital stay is greater than 17 and diagnoses icd9 code is v1006?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "17" AND diagnoses.icd9_code = "V1006"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients whose days of hospital stay is greater than 17 and diagnoses icd9 code is v1006? ### Input: CRE...
What date did the Geelong team play on as a home team?
CREATE TABLE table_name_12 ( date VARCHAR, home_team VARCHAR )
SELECT date FROM table_name_12 WHERE home_team = "geelong"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What date did the Geelong team play on as a home team? ### Input: CREATE TABLE table_name_12 ( date VARCHAR, home_te...
how many patients are with private insurance and born before 1887?
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 WHERE demographic.insurance = "Private" AND demographic.dob_year < "1887"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients are with private insurance and born before 1887? ### Input: CREATE TABLE prescriptions ( subject_id te...
What is the district for carl vinson?
CREATE TABLE table_1341930_11 ( district VARCHAR, incumbent VARCHAR )
SELECT district FROM table_1341930_11 WHERE incumbent = "Carl Vinson"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the district for carl vinson? ### Input: CREATE TABLE table_1341930_11 ( district VARCHAR, incumbent VARCHAR...
Find the name of companies whose revenue is greater than the average revenue of all companies.
CREATE TABLE manufacturers ( name VARCHAR, revenue INTEGER )
SELECT name FROM manufacturers WHERE revenue > (SELECT AVG(revenue) FROM manufacturers)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the name of companies whose revenue is greater than the average revenue of all companies. ### Input: CREATE TABLE manuf...
who write the episode that have 14.39 million viewers
CREATE TABLE table_22995 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "U.S. viewers (millions)" text )
SELECT "Written by" FROM table_22995 WHERE "U.S. viewers (millions)" = '14.39'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: who write the episode that have 14.39 million viewers ### Input: CREATE TABLE table_22995 ( "No. in series" real, "N...
When against is more than 1244 with less than 8 losses, what is the average of wins?
CREATE TABLE table_name_82 ( wins INTEGER, against VARCHAR, losses VARCHAR )
SELECT AVG(wins) FROM table_name_82 WHERE against > 1244 AND losses < 8
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When against is more than 1244 with less than 8 losses, what is the average of wins? ### Input: CREATE TABLE table_name_82 (...
A bar chart shows the distribution of All_Neutral and School_ID , list in descending by the y axis.
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...
SELECT All_Neutral, School_ID FROM basketball_match ORDER BY School_ID DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: A bar chart shows the distribution of All_Neutral and School_ID , list in descending by the y axis. ### Input: CREATE TABLE ...
Name all MDE classes for me .
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) 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, admi...
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE program_course.category LIKE '%MDE%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name all MDE classes for me . ### Input: CREATE TABLE program ( program_id int, name varchar, college varchar, ...
Name the Place with a Score of 72-68=140?
CREATE TABLE table_name_83 ( place VARCHAR, score VARCHAR )
SELECT place FROM table_name_83 WHERE score = 72 - 68 = 140
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name the Place with a Score of 72-68=140? ### Input: CREATE TABLE table_name_83 ( place VARCHAR, score VARCHAR ) ###...
has patient 021-250695 excreted output amt-jackson pratt drain in 11/last year?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE cost ( costid number, uniquepid text,...
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-250695')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutp...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: has patient 021-250695 excreted output amt-jackson pratt drain in 11/last year? ### Input: CREATE TABLE lab ( labid numb...
Which venue had a home team score of 6.10 (46)?
CREATE TABLE table_74581 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Venue" FROM table_74581 WHERE "Home team score" = '6.10 (46)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which venue had a home team score of 6.10 (46)? ### Input: CREATE TABLE table_74581 ( "Home team" text, "Home team s...
What Country is Player Sam Snead with a To par of less than 5 from?
CREATE TABLE table_76215 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" real, "Money ( $ )" real )
SELECT "Country" FROM table_76215 WHERE "To par" < '5' AND "Player" = 'sam snead'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What Country is Player Sam Snead with a To par of less than 5 from? ### Input: CREATE TABLE table_76215 ( "Place" text, ...
what are the top five frequently prescribed drugs that patients have been prescribed in the same hospital visit after being diagnosed with pneumonia in this year?
CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, ...
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'pneumonia' AND ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what are the top five frequently prescribed drugs that patients have been prescribed in the same hospital visit after being ...
what were the four most often used procedures for patients who had previously been diagnosed with ath ext ntv art gngrene during the same hospital visit, since 2105?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE cost ( ro...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_i...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what were the four most often used procedures for patients who had previously been diagnosed with ath ext ntv art gngrene du...
For those employees who did not have any job in the past, show me about the distribution of job_id and the amount of job_id , and group by attribute job_id in a bar chart.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), ...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who did not have any job in the past, show me about the distribution of job_id and the amount of job_id ...
did patient 80858 until 2104 get admitted to hospital?
CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( ...
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 80858 AND STRFTIME('%y', admissions.admittime) <= '2104'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: did patient 80858 until 2104 get admitted to hospital? ### Input: CREATE TABLE microbiologyevents ( row_id number, s...
What's the to par of the United States with the score of 71-71=142?
CREATE TABLE table_49165 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "To par" FROM table_49165 WHERE "Country" = 'united states' AND "Score" = '71-71=142'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What's the to par of the United States with the score of 71-71=142? ### Input: CREATE TABLE table_49165 ( "Place" text, ...
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by time.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varc...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart ab...
how many patients whose age is less than 41 and lab test category is chemistry?
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 text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab."CATEGORY" = "Chemistry"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose age is less than 41 and lab test category is chemistry? ### Input: CREATE TABLE procedures ( sub...
what was the first value of the anion gap lab test of patient 30525 during the last hospital visit.
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 = 30525 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = '...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the first value of the anion gap lab test of patient 30525 during the last hospital visit. ### Input: CREATE TABLE ...
What was the highest amount of losses when there were 45 goals and the play was smaller than 38?
CREATE TABLE table_61755 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
SELECT MAX("Losses") FROM table_61755 WHERE "Goals for" = '45' AND "Played" < '38'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the highest amount of losses when there were 45 goals and the play was smaller than 38? ### Input: CREATE TABLE tab...
what is the even when the location is tokyo, japan and the record is 6-1?
CREATE TABLE table_63738 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text )
SELECT "Event" FROM table_63738 WHERE "Location" = 'tokyo, japan' AND "Record" = '6-1'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the even when the location is tokyo, japan and the record is 6-1? ### Input: CREATE TABLE table_63738 ( "Res." t...
when in their last hospital visit was the first time patient 85131 received non-invasive mech vent?
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime ...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'non-invasive mech vent') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 85131 AND NO...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when in their last hospital visit was the first time patient 85131 received non-invasive mech vent? ### Input: CREATE TABLE ...
What is the attendance from November 3, 1974?
CREATE TABLE table_47818 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
SELECT "Attendance" FROM table_47818 WHERE "Date" = 'november 3, 1974'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the attendance from November 3, 1974? ### Input: CREATE TABLE table_47818 ( "Week" real, "Date" text, "O...
Are there multiple professors who teach ECON 631 in Spring-Summer 2003 ?
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 COUNT(DISTINCT instructor.instructor_id) FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ECON' AND course.number = 631 AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offer...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Are there multiple professors who teach ECON 631 in Spring-Summer 2003 ? ### Input: CREATE TABLE student ( student_id in...
What is the smallest bronze with a Rank of 12, and a Silver smaller than 2?
CREATE TABLE table_name_5 ( bronze INTEGER, rank VARCHAR, silver VARCHAR )
SELECT MIN(bronze) FROM table_name_5 WHERE rank = 12 AND silver < 2
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the smallest bronze with a Rank of 12, and a Silver smaller than 2? ### Input: CREATE TABLE table_name_5 ( bronz...
when was patient 028-25829 last admitted to the hospital via the operating room in 2105?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid num...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '028-25829' AND patient.hospitaladmitsource = 'operating room' AND STRFTIME('%y', patient.hospitaladmittime) = '2105' ORDER BY patient.hospitaladmittime DESC LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when was patient 028-25829 last admitted to the hospital via the operating room in 2105? ### Input: CREATE TABLE microlab ( ...
what is the total number of teams that qualified ?
CREATE TABLE table_204_642 ( id number, "team" text, "domestic tournament" text, "position" text, "appearance" text, "qualified" text )
SELECT COUNT("team") FROM table_204_642
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the total number of teams that qualified ? ### Input: CREATE TABLE table_204_642 ( id number, "team" text, ...
when did patient 9241 have a microbiology test for the last time since 04/2105?
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 microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime tim...
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9241) AND STRFTIME('%y-%m', microbiologyevents.charttime) >= '2105-04' ORDER BY microbiologyevents.charttime DESC LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when did patient 9241 have a microbiology test for the last time since 04/2105? ### Input: CREATE TABLE prescriptions ( ...
Between 10:00 and 5:00 , is there a section of JUDAIC 381 ?
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_...
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.end_time <= '5:00' AND course_offering.start_time >= '10:00' AND course.course_id = course_offering.course_id AND course.department = 'JUDAIC' AND course.numb...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Between 10:00 and 5:00 , is there a section of JUDAIC 381 ? ### Input: CREATE TABLE semester ( semester_id int, seme...
Who teaches ORGSTUDY 201 this Summer ?
CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE student_record ( student_id int, course_id int, semester int, ...
SELECT DISTINCT instructor.name FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id INNER JOIN semester...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who teaches ORGSTUDY 201 this Summer ? ### Input: CREATE TABLE comment_instructor ( instructor_id int, student_id in...
Find the number of records of each policy type and its type code.
CREATE TABLE policies ( policy_type_code VARCHAR )
SELECT policy_type_code, COUNT(*) FROM policies GROUP BY policy_type_code
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the number of records of each policy type and its type code. ### Input: CREATE TABLE policies ( policy_type_code VA...
For each customer who has at least two orders, find the customer name and number of orders made. Show a pie chart.
CREATE TABLE Shipments ( shipment_id INTEGER, order_id INTEGER, invoice_number INTEGER, shipment_tracking_number VARCHAR(80), shipment_date DATETIME, other_shipment_details VARCHAR(255) ) CREATE TABLE Invoices ( invoice_number INTEGER, invoice_date DATETIME, invoice_details VARCHAR(...
SELECT customer_name, COUNT(*) FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For each customer who has at least two orders, find the customer name and number of orders made. Show a pie chart. ### Input...
For those records from the products and each product's manufacturer, find name and the average of manufacturer , and group by attribute name, and visualize them by a bar chart, I want to sort by the X-axis from low to high.
CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER )
SELECT T2.Name, T1.Manufacturer FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those records from the products and each product's manufacturer, find name and the average of manufacturer , and group b...
What is the most recent year that the Mineola Twins was nominated for outstanding actress in a play and a Drama Desk award?
CREATE TABLE table_61105 ( "Year" real, "Award" text, "Category" text, "Nominated Work" text, "Result" text )
SELECT MAX("Year") FROM table_61105 WHERE "Nominated Work" = 'the mineola twins' AND "Category" = 'outstanding actress in a play' AND "Award" = 'drama desk award'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the most recent year that the Mineola Twins was nominated for outstanding actress in a play and a Drama Desk award? ...