instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
Show the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group by course description, could you order total number from low to high order please?
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NU...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE GROUP BY CRS_DESCRIPTION, EMP_FNAME ORDER BY COUNT(EMP_FNAME)
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 the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group...
Name the average goals against for draws of 8 and wins more than 22 with losses less than 12
CREATE TABLE table_name_92 ( goals_against INTEGER, wins VARCHAR, draws VARCHAR, losses VARCHAR )
SELECT AVG(goals_against) FROM table_name_92 WHERE draws = 8 AND losses < 12 AND wins > 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: Name the average goals against for draws of 8 and wins more than 22 with losses less than 12 ### Input: CREATE TABLE table_n...
What is the number of names for each product in the store?, and display by the y-axis from low to high.
CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL )
SELECT Name, COUNT(Name) FROM Products GROUP BY Name ORDER BY COUNT(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: What is the number of names for each product in the store?, and display by the y-axis from low to high. ### Input: CREATE TA...
when was the heartrate of patient 028-52605 last measured until 1060 days ago?
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 medication ( medicationid number, ...
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '028-52605')) AND NOT vitalperiodic.heartrate IS NUL...
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 the heartrate of patient 028-52605 last measured until 1060 days ago? ### Input: CREATE TABLE allergy ( allergy...
how many hours has it been since the last time that patient 027-154299 had a procedure in their current hospital visit?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-15429...
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 hours has it been since the last time that patient 027-154299 had a procedure in their current hospital visit? ### ...
What is the largest week with the Atlanta Falcons as the opponent?
CREATE TABLE table_name_90 ( week INTEGER, opponent VARCHAR )
SELECT MAX(week) FROM table_name_90 WHERE opponent = "atlanta falcons"
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 largest week with the Atlanta Falcons as the opponent? ### Input: CREATE TABLE table_name_90 ( week INTEGER,...
Show me about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road in a bar chart, could you display by the Y from high to low?
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 ACC_Road, COUNT(ACC_Road) FROM basketball_match GROUP BY ACC_Road ORDER BY COUNT(ACC_Road) 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 me about the distribution of ACC_Road and the amount of ACC_Road , and group by attribute ACC_Road in a bar chart, coul...
Who was the home team for the game where North Melbourne was the away team and the crowd was over 12,000?
CREATE TABLE table_74618 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Home team" FROM table_74618 WHERE "Crowd" > '12,000' AND "Away team" = 'north melbourne'
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 was the home team for the game where North Melbourne was the away team and the crowd was over 12,000? ### Input: CREATE ...
What is the district that has a republican?
CREATE TABLE table_1341930_21 ( district VARCHAR, party VARCHAR )
SELECT district FROM table_1341930_21 WHERE party = "Republican"
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 that has a republican? ### Input: CREATE TABLE table_1341930_21 ( district VARCHAR, party VARCH...
count the number of patients whose year of birth is less than 2104 and drug name is vancomycin?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2104" AND prescriptions.drug = "Vancomycin"
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 year of birth is less than 2104 and drug name is vancomycin? ### Input: CREATE TABLE demo...
count the number of patients who have been diagnosed with adv eff blood agent nec.
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'adv eff blood agent nec'))
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 who have been diagnosed with adv eff blood agent nec. ### Input: CREATE TABLE inputevents_cv ( ...
What is the smallest diameter for Eirene Tholus?
CREATE TABLE table_45119 ( "Name" text, "Latitude" text, "Longitude" text, "Diameter (km)" real, "Year named" text )
SELECT MIN("Diameter (km)") FROM table_45119 WHERE "Name" = 'eirene tholus'
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 diameter for Eirene Tholus? ### Input: CREATE TABLE table_45119 ( "Name" text, "Latitude" text,...
List the distinct payment method codes with the number of orders made
CREATE TABLE drama_workshop_groups ( workshop_group_id number, address_id number, currency_code text, marketing_region_code text, store_name text, store_phone text, store_email_address text, other_details text ) CREATE TABLE addresses ( address_id text, line_1 text, line_2 t...
SELECT payment_method_code, COUNT(*) FROM invoices GROUP BY payment_method_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: List the distinct payment method codes with the number of orders made ### Input: CREATE TABLE drama_workshop_groups ( wo...
calculate the number of patients with gastrointestinal hemorrhage nos who received iv drip therapy
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 demographic ...
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 = "Gastrointest hemorr NOS" AND prescriptions.route = "IV DRIP"
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: calculate the number of patients with gastrointestinal hemorrhage nos who received iv drip therapy ### Input: CREATE TABLE p...
What is Set 1, when Set 2 is 17-25?
CREATE TABLE table_name_22 ( set_1 VARCHAR, set_2 VARCHAR )
SELECT set_1 FROM table_name_22 WHERE set_2 = "17-25"
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 Set 1, when Set 2 is 17-25? ### Input: CREATE TABLE table_name_22 ( set_1 VARCHAR, set_2 VARCHAR ) ### Respo...
Which position was picked before 63, for Oklahoma College?
CREATE TABLE table_65135 ( "Pick" real, "Team" text, "Player" text, "Position" text, "College" text )
SELECT "Position" FROM table_65135 WHERE "Pick" < '63' AND "College" = 'oklahoma'
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 position was picked before 63, for Oklahoma College? ### Input: CREATE TABLE table_65135 ( "Pick" real, "Team"...
What channels have stations that were affiliated in 2002?
CREATE TABLE table_11147852_1 ( channel_tv___dt__ VARCHAR, year_of_affiliation VARCHAR )
SELECT channel_tv___dt__ FROM table_11147852_1 WHERE year_of_affiliation = "2002"
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 channels have stations that were affiliated in 2002? ### Input: CREATE TABLE table_11147852_1 ( channel_tv___dt__ V...
For those records from the products and each product's manufacturer, what is the relationship between code and price ?
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 T1.Code, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.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: For those records from the products and each product's manufacturer, what is the relationship between code and price ? ### I...
give me the number of patients whose diagnoses short title is abnormal loss of weight and lab test fluid is pleural?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Abnormal loss of weight" AND lab.fluid = "Pleural"
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 diagnoses short title is abnormal loss of weight and lab test fluid is pleural? ### Inp...
What are the names of the ships that are from either the US or the UK?
CREATE TABLE ship ( ship_id number, name text, type text, nationality text, tonnage number ) CREATE TABLE mission ( mission_id number, ship_id number, code text, launched_year number, location text, speed_knots number, fate text )
SELECT name FROM ship WHERE nationality = "United States" OR nationality = "United Kingdom"
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 names of the ships that are from either the US or the UK? ### Input: CREATE TABLE ship ( ship_id number, ...
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 first_name and salary , and display by the total number in asc.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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), CO...
SELECT FIRST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY
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...
Return the names of the regions affected by storms that had a death count of at least 10.
CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE region ( region_id number, region_code text, region_name text ) CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions...
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10
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 the names of the regions affected by storms that had a death count of at least 10. ### Input: CREATE TABLE affected_r...
Find the relationship between minimum and average gpa of all students in each department with a scatter chart grouping by department code.
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varch...
SELECT AVG(STU_GPA), MIN(STU_GPA) FROM STUDENT 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: Find the relationship between minimum and average gpa of all students in each department with a scatter chart grouping by de...
tell me the authority that has a decile less than 6 and roll less than 65.
CREATE TABLE table_68263 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real )
SELECT "Authority" FROM table_68263 WHERE "Decile" < '6' AND "Roll" < '65'
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 authority that has a decile less than 6 and roll less than 65. ### Input: CREATE TABLE table_68263 ( "Name" ...
What is the most gold medals a team with less than 2 silvers, more than 7 total medals, and less than 8 bronze medals has?
CREATE TABLE table_name_19 ( gold INTEGER, bronze VARCHAR, silver VARCHAR, total VARCHAR )
SELECT MAX(gold) FROM table_name_19 WHERE silver < 2 AND total > 7 AND bronze < 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: What is the most gold medals a team with less than 2 silvers, more than 7 total medals, and less than 8 bronze medals has? #...
Can I take 532 some time in the next 2 years ?
CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar ) CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test...
SELECT DISTINCT semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 532 AND semester.semester_id = course_offering.semester AND semester.year IN (2016, 2017)
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 I take 532 some time in the next 2 years ? ### Input: CREATE TABLE program ( program_id int, name varchar, c...
Which round has an offensive tackle position?
CREATE TABLE table_11072 ( "Pick" real, "Round" real, "Player" text, "Position" text, "School" text )
SELECT "Round" FROM table_11072 WHERE "Position" = 'offensive tackle'
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 round has an offensive tackle position? ### Input: CREATE TABLE table_11072 ( "Pick" real, "Round" real, "...
What was the home team's score when they played Richmond?
CREATE TABLE table_33790 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Home team score" FROM table_33790 WHERE "Away team" = 'richmond'
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 home team's score when they played Richmond? ### Input: CREATE TABLE table_33790 ( "Home team" text, "H...
Name the date for 6-2 record
CREATE TABLE table_24129 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Black Knights points" real, "Opponents" real, "Record" text )
SELECT "Date" FROM table_24129 WHERE "Record" = '6-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: Name the date for 6-2 record ### Input: CREATE TABLE table_24129 ( "Game" real, "Date" text, "Opponent" text, ...
when was patient 016-38131 prescribed medications through the iv push route for the last time in the current hospital encounter?
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREAT...
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-38131' AND patient.hospitaldischargetime IS NULL)) AND med...
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 016-38131 prescribed medications through the iv push route for the last time in the current hospital encoun...
Who is the home team who plays at Glenferrie Oval?
CREATE TABLE table_name_95 ( home_team VARCHAR, venue VARCHAR )
SELECT home_team FROM table_name_95 WHERE venue = "glenferrie oval"
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 home team who plays at Glenferrie Oval? ### Input: CREATE TABLE table_name_95 ( home_team VARCHAR, venue ...
show me the flights from OAKLAND to DENVER
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) 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 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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'OAKLAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER...
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 me the flights from OAKLAND to DENVER ### Input: CREATE TABLE time_interval ( period text, begin_time int, ...
Draw a pie chart about the proportion of ACC_Regular_Season and School_ID.
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 ACC_Regular_Season, School_ID FROM basketball_match
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: Draw a pie chart about the proportion of ACC_Regular_Season and School_ID. ### Input: CREATE TABLE university ( School_I...
tell me the name of an output that patient 53863 has last had until 03/15/2101?
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 d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABL...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT outputevents.itemid 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 = 53863)) AND STRFTIME('%y-%m-%d', outputeve...
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 name of an output that patient 53863 has last had until 03/15/2101? ### Input: CREATE TABLE chartevents ( ro...
list flights from CINCINNATI to SAN JOSE friday evening
CREATE TABLE time_interval ( period text, begin_time int, end_time int ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) C...
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 = 'SAN JOSE' AND date_day.day_number = 25 AND date_day.month_number = 6 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: list flights from CINCINNATI to SAN JOSE friday evening ### Input: CREATE TABLE time_interval ( period text, begin_t...
provide the number of patients whose year of birth is less than 2109 and procedure long title is coronary arteriography using two catheters?
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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2109" AND procedures.long_title = "Coronary arteriography using two catheters"
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 year of birth is less than 2109 and procedure long title is coronary arteriography usin...
Which player scored 76-68=144?
CREATE TABLE table_79170 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "Player" FROM table_79170 WHERE "Score" = '76-68=144'
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 player scored 76-68=144? ### Input: CREATE TABLE table_79170 ( "Place" text, "Player" text, "Country" text...
is the level of sao2 in patient 027-107035 last measured on the last icu visit greater than the value second to last measured on the last icu visit?
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE v...
SELECT (SELECT vitalperiodic.sao2 FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-107035') AND NOT patient.unitdischargetime IS NULL...
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: is the level of sao2 in patient 027-107035 last measured on the last icu visit greater than the value second to last measure...
tell me the number of government insurance patients who had other partial resection of small intestine.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Part sm bowel resect NEC"
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 number of government insurance patients who had other partial resection of small intestine. ### Input: CREATE TA...
Find meter_400 and ID , and visualize them by a bar chart, and list by the Y from high to low please.
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimme...
SELECT meter_400, ID FROM swimmer ORDER BY 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: Find meter_400 and ID , and visualize them by a bar chart, and list by the Y from high to low please. ### Input: CREATE TABL...
What number episode had a rating of 4.7?
CREATE TABLE table_26307 ( "No." real, "Episode" text, "Rating" text, "Share" real, "Rating/share (18-49)" text, "Viewers (millions)" text, "Rank (timeslot)" real, "Rank (night)" real )
SELECT MIN("No.") FROM table_26307 WHERE "Rating" = '4.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 number episode had a rating of 4.7? ### Input: CREATE TABLE table_26307 ( "No." real, "Episode" text, "Rati...
Where was the game held when Fitzroy was the away team?
CREATE TABLE table_name_24 ( venue VARCHAR, away_team VARCHAR )
SELECT venue FROM table_name_24 WHERE away_team = "fitzroy"
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: Where was the game held when Fitzroy was the away team? ### Input: CREATE TABLE table_name_24 ( venue VARCHAR, away_...
The upper-levels classes that are 15 credits what are they ?
CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE program_requirement ( program_id int...
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.credits = 15 AND program_course.category LIKE 'ULCS'
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: The upper-levels classes that are 15 credits what are they ? ### Input: CREATE TABLE jobs ( job_id int, job_title va...
what were the top five most frequent specimen test for patients within the same month after the diagnosis of valvular insufficiency - mitral valve?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, ...
SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'valvular insufficiency - mitral valve') AS t...
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 top five most frequent specimen test for patients within the same month after the diagnosis of valvular insuff...
Display a bar chart for what is the name of each aircraft and how many flights does each one complete?, show in asc by the names.
CREATE TABLE flight ( flno number(4,0), origin varchar2(20), destination varchar2(20), distance number(6,0), departure_date date, arrival_date date, price number(7,2), aid number(9,0) ) CREATE TABLE employee ( eid number(9,0), name varchar2(30), salary number(10,2) ) CREATE...
SELECT name, COUNT(*) FROM flight AS T1 JOIN aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid ORDER BY 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: Display a bar chart for what is the name of each aircraft and how many flights does each one complete?, show in asc by the n...
How big of a crowd does the home team of essendon have?
CREATE TABLE table_52815 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Crowd" FROM table_52815 WHERE "Home team" = 'essendon'
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 big of a crowd does the home team of essendon have? ### Input: CREATE TABLE table_52815 ( "Home team" text, "Hom...
Find the total credits of all classes offered by each department.
CREATE TABLE CLASS ( crs_code VARCHAR ) CREATE TABLE course ( dept_code VARCHAR, crs_credit INTEGER, crs_code VARCHAR )
SELECT SUM(T1.crs_credit), T1.dept_code FROM course AS T1 JOIN CLASS AS T2 ON T1.crs_code = T2.crs_code GROUP BY T1.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: Find the total credits of all classes offered by each department. ### Input: CREATE TABLE CLASS ( crs_code VARCHAR ) CR...
Name the highest cuts made when top 5 is less than 3 and top ten is more than 4
CREATE TABLE table_name_99 ( cuts_made INTEGER, top_5 VARCHAR, top_10 VARCHAR )
SELECT MAX(cuts_made) FROM table_name_99 WHERE top_5 < 3 AND top_10 > 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: Name the highest cuts made when top 5 is less than 3 and top ten is more than 4 ### Input: CREATE TABLE table_name_99 ( ...
has patient 005-26011 received during the last hospital encounter a pleural effusion - etiology unknown diagnosis?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREA...
SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-26011' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.ho...
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 005-26011 received during the last hospital encounter a pleural effusion - etiology unknown diagnosis? ### Input...
What's the sum of the Pick that has the Player of Robert Ingalls?
CREATE TABLE table_name_47 ( pick VARCHAR, player VARCHAR )
SELECT COUNT(pick) FROM table_name_47 WHERE player = "robert ingalls"
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 sum of the Pick that has the Player of Robert Ingalls? ### Input: CREATE TABLE table_name_47 ( pick VARCHAR, ...
What is the customer id of the customer who has the most orders?
CREATE TABLE orders ( order_id number, customer_id number, order_status text, date_order_placed time, order_details text ) CREATE TABLE invoices ( invoice_number number, invoice_date time, invoice_details text ) CREATE TABLE order_items ( order_item_id number, product_id number...
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY COUNT(*) 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 is the customer id of the customer who has the most orders? ### Input: CREATE TABLE orders ( order_id number, c...
how many patients died?
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "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 many patients died? ### Input: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, ...
Find the number of trains for each station, as well as the station network name Show the result with a bar graph, could you order Y from high to low order?
CREATE TABLE weekly_weather ( station_id int, day_of_week text, high_temperature int, low_temperature int, precipitation real, wind_speed_mph int ) CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE station ( id int, network_name text, services text, local...
SELECT network_name, COUNT(*) FROM station AS t1 JOIN route AS t2 ON t1.id = t2.station_id GROUP BY t2.station_id 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: Find the number of trains for each station, as well as the station network name Show the result with a bar graph, could you ...
Find the average and minimum weight for each gender.
CREATE TABLE people ( sex VARCHAR, weight INTEGER )
SELECT AVG(weight), MIN(weight), sex FROM people GROUP BY sex
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 average and minimum weight for each gender. ### Input: CREATE TABLE people ( sex VARCHAR, weight INTEGER ) ...
What classes are Dr. Arlene Saxonhouse teaching next semester ?
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 course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Arlene Saxonhouse%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor...
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 classes are Dr. Arlene Saxonhouse teaching next semester ? ### Input: CREATE TABLE requirement ( requirement_id int...
count the number of patients whose admission location is phys referral/normal deli and drig code is cefe 1i.
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND prescriptions.formulary_drug_cd = "CEFE1I"
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 admission location is phys referral/normal deli and drig code is cefe 1i. ### Input: CREA...
592 is taken by undergrads ?
CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE cour...
SELECT DISTINCT advisory_requirement, enforced_requirement, name FROM course WHERE department = 'EECS' AND number = 592
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: 592 is taken by undergrads ? ### Input: CREATE TABLE requirement ( requirement_id int, requirement varchar, coll...
What was the highest year that Europe/Africa Zone Group I Group B lost?
CREATE TABLE table_name_79 ( year INTEGER, competition VARCHAR, result VARCHAR )
SELECT MAX(year) FROM table_name_79 WHERE competition = "europe/africa zone group i group b" AND result = "lost"
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 year that Europe/Africa Zone Group I Group B lost? ### Input: CREATE TABLE table_name_79 ( year INT...
count the number of patients whose admission location is trsf within this facility and drug code is ketr30i?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "KETR30I"
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 admission location is trsf within this facility and drug code is ketr30i? ### Input: CREA...
Name who directed when the viewers is 5.86
CREATE TABLE table_29489 ( "No." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
SELECT "Directed by" FROM table_29489 WHERE "U.S. viewers (million)" = '5.86'
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 who directed when the viewers is 5.86 ### Input: CREATE TABLE table_29489 ( "No." real, "Title" text, "Dire...
Give me a bar chart showing the total number of each minister, I want to list in asc by the total number.
CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE party_events ( Event_ID in...
SELECT Minister, COUNT(Minister) FROM party GROUP BY Minister ORDER BY COUNT(Minister)
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 a bar chart showing the total number of each minister, I want to list in asc by the total number. ### Input: CREATE ...
when had patient 030-16826 been admitted to the hospital for the last time since 2104?
CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE medication ( medi...
SELECT patient.hospitaladmittime FROM patient WHERE patient.uniquepid = '030-16826' AND STRFTIME('%y', patient.hospitaladmittime) >= '2104' 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 had patient 030-16826 been admitted to the hospital for the last time since 2104? ### Input: CREATE TABLE vitalperiodic...
from MILWAUKEE to ORLANDO one way after 1700 wednesday
CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE restriction ( restriction_code text, advance_purc...
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 AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE (((DATE_DAY_0.day_number = 23 AND DATE_DAY_0.month...
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: from MILWAUKEE to ORLANDO one way after 1700 wednesday ### Input: CREATE TABLE city ( city_code varchar, city_name v...
what was the difference between the attendance in week two and the attendance in week one ?
CREATE TABLE table_203_405 ( id number, "week" number, "date" text, "opponent" text, "result" text, "attendance" number )
SELECT (SELECT "attendance" FROM table_203_405 WHERE "week" = 2) - (SELECT "attendance" FROM table_203_405 WHERE "week" = 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 difference between the attendance in week two and the attendance in week one ? ### Input: CREATE TABLE table_20...
count the number of patients who were diagnosed with septic arthritis and didn't return to the hospital within 2 months until 2102.
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost numbe...
SELECT (SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'septic arthritis' AND STRFTIME('%y', diagnosis.diagnosistime) <= '2102') AS t1) - (SELECT COUNT(DIST...
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 who were diagnosed with septic arthritis and didn't return to the hospital within 2 months unti...
Who is the runner(s)-up with a winning score of +4 (74-77-75=226)?
CREATE TABLE table_13683 ( "Date" text, "Tournament" text, "Winning score" text, "Margin of victory" text, "Runner(s)-up" text )
SELECT "Runner(s)-up" FROM table_13683 WHERE "Winning score" = '+4 (74-77-75=226)'
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 runner(s)-up with a winning score of +4 (74-77-75=226)? ### Input: CREATE TABLE table_13683 ( "Date" text, ...
What's the average crowd size when the venue is western oval?
CREATE TABLE table_name_91 ( crowd INTEGER, venue VARCHAR )
SELECT AVG(crowd) FROM table_name_91 WHERE venue = "western oval"
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 average crowd size when the venue is western oval? ### Input: CREATE TABLE table_name_91 ( crowd INTEGER, ...
compared to last measured on the last icu visit, is arterial bp mean of patient 29161 greater than second to last measured on the last icu visit?
CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, value...
SELECT (SELECT chartevents.valuenum FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 29161) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND chartevents...
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: compared to last measured on the last icu visit, is arterial bp mean of patient 29161 greater than second to last measured o...
For the upper level electives , what classes are offered before noon ?
CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE offering_instructor ( offering_ins...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.end_time <= '12:00:00' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semest...
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 upper level electives , what classes are offered before noon ? ### Input: CREATE TABLE program_requirement ( pro...
What would be the easiest class I could take to satisfy the Other requirement ?
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_c...
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 would be the easiest class I could take to satisfy the Other requirement ? ### Input: CREATE TABLE course ( course_...
what airlines have nonstop early afternoon flights from BOSTON to DENVER
CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE equipment_sequence ( aircraft_code_sequence...
SELECT DISTINCT airline.airline_code FROM airline, 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 = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_...
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 airlines have nonstop early afternoon flights from BOSTON to DENVER ### Input: CREATE TABLE flight_fare ( flight_id...
how many patients whose marital status is widowed and drug route is both eyes?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "WIDOWED" AND prescriptions.route = "BOTH EYES"
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 marital status is widowed and drug route is both eyes? ### Input: CREATE TABLE lab ( subject_id ...
What to par has 7 as the place?
CREATE TABLE table_45815 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "To par" FROM table_45815 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_45815 ( "Place" text, "Player" text, "Country" tex...
Who was the away team for the Etobicoke Kangaroos home game?
CREATE TABLE table_43142 ( "Date" text, "Time" text, "Home" text, "Away" text, "Score" text, "Ground" text )
SELECT "Away" FROM table_43142 WHERE "Home" = 'etobicoke kangaroos'
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 was the away team for the Etobicoke Kangaroos home game? ### Input: CREATE TABLE table_43142 ( "Date" text, "Tim...
What event did he have a 2-0 record?
CREATE TABLE table_name_51 ( event VARCHAR, record VARCHAR )
SELECT event FROM table_name_51 WHERE record = "2-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: What event did he have a 2-0 record? ### Input: CREATE TABLE table_name_51 ( event VARCHAR, record VARCHAR ) ### Res...
What was the country for Sam Snead?
CREATE TABLE table_78651 ( "Place" text, "Player" text, "Country" text, "Score" text, "To Par" real, "Money ( $ )" text )
SELECT "Country" FROM table_78651 WHERE "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 was the country for Sam Snead? ### Input: CREATE TABLE table_78651 ( "Place" text, "Player" text, "Country"...
find the number of american indian/alaska native patients who were born before 2134.
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.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.dob_year < "2134"
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 american indian/alaska native patients who were born before 2134. ### Input: CREATE TABLE prescriptions (...
provide the number of patients whose age is less than 51 and drug code is senn5l?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "51" AND prescriptions.formulary_drug_cd = "SENN5L"
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 age is less than 51 and drug code is senn5l? ### Input: CREATE TABLE procedures ( s...
Name the record for golden state
CREATE TABLE table_23186738_6 ( record VARCHAR, team VARCHAR )
SELECT record FROM table_23186738_6 WHERE team = "Golden 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: Name the record for golden state ### Input: CREATE TABLE table_23186738_6 ( record VARCHAR, team VARCHAR ) ### Respo...
User List: Top N - Italy - with false positive exclusions.
CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name te...
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation, Location, LastAccessDate, UpVotes, DownVotes FROM Users WHERE (LOWER(Location) LIKE '%cagliari%' OR LOWER(Location) LIKE '%cagliari%') AND NOT (LOWER(Location) LIKE '%mit%') AND LENGTH(Location) > 1 LIMIT 100
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: User List: Top N - Italy - with false positive exclusions. ### Input: CREATE TABLE Tags ( Id number, TagName text, ...
What is the first episode number?
CREATE TABLE table_15187735_20 ( episode INTEGER )
SELECT MIN(episode) FROM table_15187735_20
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 first episode number? ### Input: CREATE TABLE table_15187735_20 ( episode INTEGER ) ### Response: SELECT MIN...
how many patients had been staying in ward 57?
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_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 57)
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 had been staying in ward 57? ### Input: CREATE TABLE inputevents_cv ( row_id number, subject_id nu...
Mondays and Wednesdays can I take 443 ?
CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREA...
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course_offering.friday = 'N' AND course_offering.monday = 'Y' AND course_offering.thursday = 'N' AND course_offering.tuesday = 'N' AND course_offering.wednesday = 'Y' AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND cour...
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: Mondays and Wednesdays can I take 443 ? ### Input: CREATE TABLE student_record ( student_id int, course_id int, ...
what is the number of patients whose age is less than 49 and procedure short title is clo endosc bx bile duct?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "49" AND procedures.short_title = "Clo endosc bx bile duct"
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 whose age is less than 49 and procedure short title is clo endosc bx bile duct? ### Input: CR...
How much Bronze has a Gold larger than 1, and a Silver smaller than 3, and a Nation of germany, and a Total larger than 11?
CREATE TABLE table_79516 ( "Rank" text, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT COUNT("Bronze") FROM table_79516 WHERE "Gold" > '1' AND "Silver" < '3' AND "Nation" = 'germany' AND "Total" > '11'
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 much Bronze has a Gold larger than 1, and a Silver smaller than 3, and a Nation of germany, and a Total larger than 11? ...
Name the high assists for 70 game
CREATE TABLE table_21207 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
SELECT "High assists" FROM table_21207 WHERE "Game" = '70'
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 high assists for 70 game ### Input: CREATE TABLE table_21207 ( "Game" real, "Date" text, "Team" text, ...
What is the to par of the player from England with a t1 place?
CREATE TABLE table_name_93 ( to_par VARCHAR, country VARCHAR, place VARCHAR )
SELECT to_par FROM table_name_93 WHERE country = "england" AND place = "t1"
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 of the player from England with a t1 place? ### Input: CREATE TABLE table_name_93 ( to_par VARCHAR, ...
What is Name, when Games are less than 38, when Rank is less than 4, and when Points are 357?
CREATE TABLE table_name_11 ( name VARCHAR, points VARCHAR, games VARCHAR, rank VARCHAR )
SELECT name FROM table_name_11 WHERE games < 38 AND rank < 4 AND points = 357
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 Name, when Games are less than 38, when Rank is less than 4, and when Points are 357? ### Input: CREATE TABLE table_...
Who did the housemate that nominated Kashmera Rakhi in week 3 and Amit Bobby in week 1 nominate in week 6?
CREATE TABLE table_65572 ( "Week 1" text, "Week 3" text, "Week 4" text, "Week 6" text, "Week 7" text, "Week 8" text, "Week 9" text, "Week 10" text, "Final Week 12" text )
SELECT "Week 6" FROM table_65572 WHERE "Week 3" = 'kashmera rakhi' AND "Week 1" = 'amit bobby'
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 did the housemate that nominated Kashmera Rakhi in week 3 and Amit Bobby in week 1 nominate in week 6? ### Input: CREATE...
If the district is Virginia 8, who is the Incumbent?
CREATE TABLE table_28950 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
SELECT "Incumbent" FROM table_28950 WHERE "District" = 'Virginia 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: If the district is Virginia 8, who is the Incumbent? ### Input: CREATE TABLE table_28950 ( "District" text, "Incumbe...
i need flights that arrive in BALTIMORE from PITTSBURGH
CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BAL...
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 flights that arrive in BALTIMORE from PITTSBURGH ### Input: CREATE TABLE date_day ( month_number int, day_num...
what is patient 006-36108's first urine catheter output time on last month/30?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number,...
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-36108')) AND intakeoutput.cellpath LIKE '%output%...
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 patient 006-36108's first urine catheter output time on last month/30? ### Input: CREATE TABLE microlab ( microl...
What was the latest week that had a game on November 18, 1951?
CREATE TABLE table_5502 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
SELECT MAX("Week") FROM table_5502 WHERE "Date" = 'november 18, 1951'
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 latest week that had a game on November 18, 1951? ### Input: CREATE TABLE table_5502 ( "Week" real, "Da...
count the number of patients who had had a loc exc bone lesion nec procedure done two or more times until 2104.
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE outputevents ( row_id number, subject_id number, ...
SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, COUNT(*) AS c1 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_title = 'loc exc bone lesion n...
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 who had had a loc exc bone lesion nec procedure done two or more times until 2104. ### Input: C...
For each bed type, find the average base price of different bed type Show bar chart, and list in desc by the X-axis.
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY bedType 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 each bed type, find the average base price of different bed type Show bar chart, and list in desc by the X-axis. ### Inp...
what is four of the most frequent intakes in 2102?
CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREA...
SELECT t1.celllabel FROM (SELECT intakeoutput.celllabel, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM intakeoutput WHERE intakeoutput.cellpath LIKE '%intake%' AND STRFTIME('%y', intakeoutput.intakeoutputtime) = '2102' GROUP BY intakeoutput.celllabel) 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 is four of the most frequent intakes in 2102? ### Input: CREATE TABLE medication ( medicationid number, patient...
What was week 17's date?
CREATE TABLE table_name_21 ( date VARCHAR, week VARCHAR )
SELECT date FROM table_name_21 WHERE week = 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: What was week 17's date? ### Input: CREATE TABLE table_name_21 ( date VARCHAR, week VARCHAR ) ### Response: SELECT d...
Show me a bar chart for what is the average rating of songs for each language?, and I want to order by the x axis in asc.
CREATE TABLE song ( song_name varchar2(50), artist_name varchar2(50), country varchar2(20), f_id number(10), genre_is varchar2(20), rating number(10), languages varchar2(20), releasedate Date, resolution number(10) ) CREATE TABLE files ( f_id number(10), artist_name varchar2...
SELECT languages, AVG(rating) FROM song GROUP BY languages ORDER BY languages
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 me a bar chart for what is the average rating of songs for each language?, and I want to order by the x axis in asc. ##...
how many patients who were injected oxazolidinone were admitted before 2158?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2158" AND procedures.short_title = "Injection oxazolidinone"
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 who were injected oxazolidinone were admitted before 2158? ### Input: CREATE TABLE procedures ( subjec...
Show me the total number by outcome code in a histogram, and sort by the bar in descending.
CREATE TABLE Premises ( premise_id INTEGER, premises_type VARCHAR(15), premise_details VARCHAR(255) ) CREATE TABLE Mailshot_Campaigns ( mailshot_id INTEGER, product_category VARCHAR(15), mailshot_name VARCHAR(80), mailshot_start_date DATETIME, mailshot_end_date DATETIME ) CREATE TABLE ...
SELECT outcome_code, COUNT(*) FROM Mailshot_Customers GROUP BY outcome_code ORDER BY outcome_code 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 me the total number by outcome code in a histogram, and sort by the bar in descending. ### Input: CREATE TABLE Premises...