instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
What is the lowest Frequency where the Hemholtz pitch is d?
CREATE TABLE table_name_48 ( frequency___hz__ INTEGER, helmholtz_pitch VARCHAR )
SELECT MIN(frequency___hz__) FROM table_name_48 WHERE helmholtz_pitch = "d"
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 Frequency where the Hemholtz pitch is d? ### Input: CREATE TABLE table_name_48 ( frequency___hz__ INT...
has the po ada ever been given to patient 007-4322?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospita...
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 = '007-4322')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput...
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 the po ada ever been given to patient 007-4322? ### Input: CREATE TABLE microlab ( microlabid number, patientuni...
Tell me the lowest Grid for engine and driver of emerson fittipaldi with more laps than 70
CREATE TABLE table_name_83 ( grid INTEGER, laps VARCHAR, time_retired VARCHAR, driver VARCHAR )
SELECT MIN(grid) FROM table_name_83 WHERE time_retired = "engine" AND driver = "emerson fittipaldi" AND laps > 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: Tell me the lowest Grid for engine and driver of emerson fittipaldi with more laps than 70 ### Input: CREATE TABLE table_nam...
How many millions of people in the US saw the episode number 226?
CREATE TABLE table_23294081_11 ( us_viewers__millions_ VARCHAR, no VARCHAR )
SELECT us_viewers__millions_ FROM table_23294081_11 WHERE no = 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: How many millions of people in the US saw the episode number 226? ### Input: CREATE TABLE table_23294081_11 ( us_viewers...
What is the To par of the Player with a Score of 73-70-71-72=286?
CREATE TABLE table_name_35 ( to_par VARCHAR, score VARCHAR )
SELECT to_par FROM table_name_35 WHERE score = 73 - 70 - 71 - 72 = 286
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 with a Score of 73-70-71-72=286? ### Input: CREATE TABLE table_name_35 ( to_par VARCHAR...
i would like to find flights from MINNEAPOLIS to LONG BEACH after 1600 o'clock on monday june fourteenth please
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TA...
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 ((date_day.day_number = 21 AND date_day.month_number = 2 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_time...
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 would like to find flights from MINNEAPOLIS to LONG BEACH after 1600 o'clock on monday june fourteenth please ### Input: C...
can you show me economy class one way fares for flights from OAKLAND to DALLAS on 12 16
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text...
SELECT DISTINCT fare.fare_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 AS FARE_BASIS_0, fare_basis AS FARE_BASIS_1, flight, flight_fare WHERE (((CITY_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: can you show me economy class one way fares for flights from OAKLAND to DALLAS on 12 16 ### Input: CREATE TABLE airline ( ...
What was the attendance total for week 10?
CREATE TABLE table_44216 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
SELECT "Attendance" FROM table_44216 WHERE "Week" = '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: What was the attendance total for week 10? ### Input: CREATE TABLE table_44216 ( "Week" real, "Date" text, "Oppo...
What score has October 31 as the date?
CREATE TABLE table_79136 ( "Date" text, "Result" text, "Score" text, "Opponent" text, "Record" text, "Attendance" text )
SELECT "Score" FROM table_79136 WHERE "Date" = 'october 31'
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 score has October 31 as the date? ### Input: CREATE TABLE table_79136 ( "Date" text, "Result" text, "Score"...
Draw a bar chart about the distribution of name and ID , and could you rank by the Y in ascending please?
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 swimmer ( ID int, name text, Nationality text, meter_100 real, meter_20...
SELECT name, ID FROM swimmer ORDER BY 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: Draw a bar chart about the distribution of name and ID , and could you rank by the Y in ascending please? ### Input: CREATE ...
What is Race 4, when Race 1 is 28?
CREATE TABLE table_49953 ( "Driver" text, "Race 1" text, "Race 2" text, "Race 3" text, "Race 4" text )
SELECT "Race 4" FROM table_49953 WHERE "Race 1" = '28'
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 Race 4, when Race 1 is 28? ### Input: CREATE TABLE table_49953 ( "Driver" text, "Race 1" text, "Race 2" ...
what flights depart NEWARK for TAMPA on friday
CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) CREATE TABLE days ( days_code varchar, day_name varchar ) CREATE TABLE airport_servic...
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 = 'TAMPA' AND date_day.day_number = 25 AND date_day.month_number = 6 AND dat...
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 flights depart NEWARK for TAMPA on friday ### Input: CREATE TABLE month ( month_number int, month_name text ) ...
whats the sex of patient 14749?
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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, item...
SELECT patients.gender FROM patients WHERE patients.subject_id = 14749
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: whats the sex of patient 14749? ### Input: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) ...
What is the range of married filing jointly or qualified widower in which married filing separately is $33,951 $68,525?
CREATE TABLE table_16994 ( "Marginal Ordinary Income Tax Rate" text, "Single" text, "Married Filing Jointly or Qualified Widow(er)" text, "Married Filing Separately" text, "Head of Household" text )
SELECT "Married Filing Jointly or Qualified Widow(er)" FROM table_16994 WHERE "Married Filing Separately" = '$33,951–$68,525'
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 range of married filing jointly or qualified widower in which married filing separately is $33,951 $68,525? ### ...
For all employees who have the letters D or S in their first name, give me the trend about salary over hire_date .
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
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 all employees who have the letters D or S in their first name, give me the trend about salary over hire_date . ### Input...
give me the number of patients whose admission type is elective and diagnoses icd9 code is v453?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND diagnoses.icd9_code = "V453"
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 admission type is elective and diagnoses icd9 code is v453? ### Input: CREATE TABLE pro...
what were the three most frequent drugs prescribed to patients with an age 60 or above after they had been diagnosed with adv eff arom analgsc nec during a year before within 2 months?
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, ...
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE ...
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 three most frequent drugs prescribed to patients with an age 60 or above after they had been diagnosed with ad...
Does INSTHUM have any 11 -credit classes ?
CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varch...
SELECT DISTINCT name, number FROM course WHERE department = 'INSTHUM' AND credits = 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: Does INSTHUM have any 11 -credit classes ? ### Input: CREATE TABLE student ( student_id int, lastname varchar, f...
could i have listings of flights from NEW YORK to MONTREAL CANADA leaving on wednesday
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 flight_stop ( flight_id int, stop_number int, stop_days text, stop_...
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 = 23...
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: could i have listings of flights from NEW YORK to MONTREAL CANADA leaving on wednesday ### Input: CREATE TABLE restriction (...
A bar chart showing the average weight for each gender, I want to show from low to high by the y axis.
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY AVG(Weight)
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 showing the average weight for each gender, I want to show from low to high by the y axis. ### Input: CREATE TAB...
how many patients whose admission type is elective and procedure short title is hemodialysis?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.short_title = "Hemodialysis"
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 type is elective and procedure short title is hemodialysis? ### Input: CREATE TABLE prescr...
count the number of times that patient 82132 had a discharge of chest tubes right pleural 1 on this month/29.
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE pat...
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82132)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'chest tubes right ...
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 times that patient 82132 had a discharge of chest tubes right pleural 1 on this month/29. ### Input: CRE...
what was the age of patient 99205 in their first hospital visit?
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE labevents ( row_id number, ...
SELECT admissions.age FROM admissions WHERE admissions.subject_id = 99205 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime 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 age of patient 99205 in their first hospital visit? ### Input: CREATE TABLE d_items ( row_id number, it...
What was the score of the Broadview Hawks home game?
CREATE TABLE table_43141 ( "Date" text, "Time" text, "Home" text, "Away" text, "Score" text, "Ground" text )
SELECT "Score" FROM table_43141 WHERE "Home" = 'broadview hawks'
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 score of the Broadview Hawks home game? ### Input: CREATE TABLE table_43141 ( "Date" text, "Time" text,...
What was the Name of the person with a Qual 1 of 1:26.056?
CREATE TABLE table_37747 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" text, "Best" text )
SELECT "Name" FROM table_37747 WHERE "Qual 1" = '1:26.056'
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 person with a Qual 1 of 1:26.056? ### Input: CREATE TABLE table_37747 ( "Name" text, "Team"...
i would like information on ground transportation city of BOS between airport and downtown
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE flight_stop ( flight_id in...
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city AS CITY_0, city AS CITY_1, ground_service WHERE airport.airport_code = airport_service.airport_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = airport_service.city_code AND CITY_1.city_name = 'BOSTON' AND ground_service.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 would like information on ground transportation city of BOS between airport and downtown ### Input: CREATE TABLE time_zone...
How many departments whose budget is more than the average budget in each building? Show me a bar chart, and order X from low to high order please.
CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE time_slot ( time_slot_id varchar(4...
SELECT building, COUNT(building) FROM department WHERE budget > (SELECT AVG(budget) FROM department) GROUP BY building ORDER BY building
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 departments whose budget is more than the average budget in each building? Show me a bar chart, and order X from lo...
Give me a pie chart showing the number of buildings managed by 'Kyle' and group by apartment type codes .
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE Apartments ( ...
SELECT apt_type_code, COUNT(apt_type_code) FROM Apartment_Buildings AS T1 JOIN Apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle" GROUP BY apt_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: Give me a pie chart showing the number of buildings managed by 'Kyle' and group by apartment type codes . ### Input: CREATE ...
What is the average age for a male in each job Visualize by bar chart, and show total number in asc order.
CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER ) CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT )
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job ORDER BY AVG(age)
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 age for a male in each job Visualize by bar chart, and show total number in asc order. ### Input: CREATE...
For those employees who did not have any job in the past, visualize a bar chart about the distribution of hire_date and the sum of employee_id bin hire_date by weekday, I want to sort Y-axis from low to high order.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(EMPLOYEE_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, visualize a bar chart about the distribution of hire_date and the ...
Who had the highest assists on March 18?
CREATE TABLE table_72849 ( "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_72849 WHERE "Date" = 'March 18'
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 had the highest assists on March 18? ### Input: CREATE TABLE table_72849 ( "Game" real, "Date" text, "Team" ...
Find the ids and names of stations from which at least 200 trips started, and rank from low to high by the X-axis.
CREATE TABLE weather ( date TEXT, max_temperature_f INTEGER, mean_temperature_f INTEGER, min_temperature_f INTEGER, max_dew_point_f INTEGER, mean_dew_point_f INTEGER, min_dew_point_f INTEGER, max_humidity INTEGER, mean_humidity INTEGER, min_humidity INTEGER, max_sea_level_pre...
SELECT start_station_name, start_station_id FROM trip ORDER BY start_station_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: Find the ids and names of stations from which at least 200 trips started, and rank from low to high by the X-axis. ### Input...
For the group with 1.92% population in 1981, what was their percentage of the population in 1971?
CREATE TABLE table_name_62 ( population__percentage_1971 VARCHAR, population__percentage_1981 VARCHAR )
SELECT population__percentage_1971 FROM table_name_62 WHERE population__percentage_1981 = "1.92%"
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 group with 1.92% population in 1981, what was their percentage of the population in 1971? ### Input: CREATE TABLE ta...
how many patients whose age is less than 45 and drug route is ih?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "45" AND prescriptions.route = "IH"
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 45 and drug route is ih? ### Input: CREATE TABLE diagnoses ( subject_id text, ...
How many accounts do we have?
CREATE TABLE customers ( customer_id number, customer_first_name text, customer_last_name text, customer_address text, customer_phone text, customer_email text, other_customer_details text ) CREATE TABLE accounts ( account_id number, customer_id number, account_name text, ot...
SELECT COUNT(*) FROM accounts
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 accounts do we have? ### Input: CREATE TABLE customers ( customer_id number, customer_first_name text, ...
what is the number of patients whose admission type is urgent and lab test name is free calcium?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Free Calcium"
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 admission type is urgent and lab test name is free calcium? ### Input: CREATE TABLE dia...
when did patient 027-178495 take an intake for the last time until 230 days ago?
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT 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 = '027-178495')) AND intakeoutput.cellpath LIKE '%intake...
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 027-178495 take an intake for the last time until 230 days ago? ### Input: CREATE TABLE patient ( uniqu...
What is Lowest Crowd, when Home Team is Brisbane Lions?
CREATE TABLE table_44949 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Ground" text, "Crowd" real, "Date" text )
SELECT MIN("Crowd") FROM table_44949 WHERE "Home team" = 'brisbane lions'
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 Lowest Crowd, when Home Team is Brisbane Lions? ### Input: CREATE TABLE table_44949 ( "Home team" text, "Hom...
how did patient 40059 this year first admitted to hospital?
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime ti...
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 40059 AND DATETIME(admissions.admittime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY admissions.admittime 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 did patient 40059 this year first admitted to hospital? ### Input: CREATE TABLE chartevents ( row_id number, sub...
give me the number of patients whose admission location is emergency room admit and drug code is esmobase?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND prescriptions.formulary_drug_cd = "ESMOBASE"
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 admission location is emergency room admit and drug code is esmobase? ### Input: CREATE...
Where did Hawthorn play an away game?
CREATE TABLE table_10619 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Venue" FROM table_10619 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: Where did Hawthorn play an away game? ### Input: CREATE TABLE table_10619 ( "Home team" text, "Home team score" text...
What is the qual 2 when the best is 1:45.172?
CREATE TABLE table_44254 ( "Name" text, "Team" text, "Qual 1" text, "Qual 2" text, "Best" text )
SELECT "Qual 2" FROM table_44254 WHERE "Best" = '1:45.172'
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 qual 2 when the best is 1:45.172? ### Input: CREATE TABLE table_44254 ( "Name" text, "Team" text, "Q...
had patient 26995 had the urine out void output on 11/29/last year?
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE diagnoses_icd ( row_id number, ...
SELECT COUNT(*) > 0 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 = 26995)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out void...
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: had patient 26995 had the urine out void output on 11/29/last year? ### Input: CREATE TABLE d_items ( row_id number, ...
what is the difference of weight last measured on the first hospital visit compared to the second to last value measured on the first hospital visit of patient 006-161415?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE patient ( uniquepid text, ...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-161415' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL O...
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 difference of weight last measured on the first hospital visit compared to the second to last value measured on ...
list all nonstop flights on wednesday from BALTIMORE to NEWARK before 1200
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, res...
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 (((date_day.day_number = 23 AND date_day.month_number = 4 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.departure_tim...
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 all nonstop flights on wednesday from BALTIMORE to NEWARK before 1200 ### Input: CREATE TABLE code_description ( co...
give me the number of patients whose death status is 0 and procedure long title is open biopsy of soft tissue?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Open biopsy of soft tissue"
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 death status is 0 and procedure long title is open biopsy of soft tissue? ### Input: CR...
What was the highest amount of losses when there were 45 goals and the play was smaller than 38?
CREATE TABLE table_name_52 ( losses INTEGER, goals_for VARCHAR, played VARCHAR )
SELECT MAX(losses) FROM table_name_52 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...
The 13 -credit CHEM classes are which ones ?
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 name, number FROM course WHERE department = 'CHEM' AND credits = 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: The 13 -credit CHEM classes are which ones ? ### Input: CREATE TABLE area ( course_id int, area varchar ) CREATE TA...
what is the number of patients in careunit tsicu until 2103?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE patients ( row_id number, subject_id number, g...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.careunit = 'tsicu' AND STRFTIME('%y', transfers.intime) <= '2103')
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 in careunit tsicu until 2103? ### Input: CREATE TABLE d_icd_diagnoses ( row_id number, ...
What is the IcAO of Frankfurt?
CREATE TABLE table_79538 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
SELECT "ICAO" FROM table_79538 WHERE "City" = 'frankfurt'
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 IcAO of Frankfurt? ### Input: CREATE TABLE table_79538 ( "City" text, "Country" text, "IATA" text, ...
provide the number of patients whose insurance is private and whose diagnosis long title is severe sepsis.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Private" AND diagnoses.long_title = "Severe sepsis"
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 insurance is private and whose diagnosis long title is severe sepsis. ### Input: CREATE...
For those payments processed with Visa, bin the payment day into the Day of week interval and count them for a bar chart, and list total number in descending order.
CREATE TABLE Claims ( Claim_ID INTEGER, Policy_ID INTEGER, Date_Claim_Made DATE, Date_Claim_Settled DATE, Amount_Claimed INTEGER, Amount_Settled INTEGER ) CREATE TABLE Payments ( Payment_ID INTEGER, Settlement_ID INTEGER, Payment_Method_Code VARCHAR(255), Date_Payment_Made DATE,...
SELECT Date_Payment_Made, COUNT(Date_Payment_Made) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY COUNT(Date_Payment_Made) 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 payments processed with Visa, bin the payment day into the Day of week interval and count them for a bar chart, an...
how many of the patients with icd9 code 3783 received po therapy?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3783" AND prescriptions.route = "PO"
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 of the patients with icd9 code 3783 received po therapy? ### Input: CREATE TABLE procedures ( subject_id text, ...
Which Opponent has a Date of november 17, 1963?
CREATE TABLE table_76945 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
SELECT "Opponent" FROM table_76945 WHERE "Date" = 'november 17, 1963'
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 Opponent has a Date of november 17, 1963? ### Input: CREATE TABLE table_76945 ( "Week" real, "Date" text, ...
How many staffs have contacted with each engineer? Give me a bar chart grouping by each engineer's first name, rank from high to low by the x axis please.
CREATE TABLE Parts ( part_id INTEGER, part_name VARCHAR(255), chargeable_yn VARCHAR(1), chargeable_amount VARCHAR(20), other_part_details VARCHAR(255) ) CREATE TABLE Third_Party_Companies ( company_id INTEGER, company_type VARCHAR(5), company_name VARCHAR(255), company_address VARCH...
SELECT first_name, COUNT(first_name) FROM Staff AS T1 JOIN Engineer_Visits AS T2 ON T1.staff_id = T2.contact_staff_id JOIN Maintenance_Engineers AS T3 ON T2.engineer_id = T3.engineer_id GROUP BY first_name ORDER BY first_name 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: How many staffs have contacted with each engineer? Give me a bar chart grouping by each engineer's first name, rank from hig...
what was the last intake that patient 005-64055 had received since 614 days ago?
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 intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-64055')) AND intakeoutput.cellpath LIKE '%intake%' AND D...
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 last intake that patient 005-64055 had received since 614 days ago? ### Input: CREATE TABLE intakeoutput ( ...
What was being played on Nov 23, 2006?
CREATE TABLE table_58276 ( "Competition" text, "Stage" text, "Venue" text, "Date" text, "Result" text )
SELECT "Competition" FROM table_58276 WHERE "Date" = 'nov 23, 2006'
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 being played on Nov 23, 2006? ### Input: CREATE TABLE table_58276 ( "Competition" text, "Stage" text, "...
count the number of patients whose diagnoses icd9 code is 78057 and drug route is ih?
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.icd9_code = "78057" AND prescriptions.route = "IH"
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 diagnoses icd9 code is 78057 and drug route is ih? ### Input: CREATE TABLE demographic ( ...
how many patients whose procedure short title is radiotherapeut proc nec?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Radiotherapeut proc 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: how many patients whose procedure short title is radiotherapeut proc nec? ### Input: CREATE TABLE prescriptions ( subjec...
what is average age of patients whose ethnicity is white and admission year is greater than or equal to 2123?
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 AVG(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.admityear >= "2123"
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 average age of patients whose ethnicity is white and admission year is greater than or equal to 2123? ### Input: CRE...
when was the last time in yesterday that patient 6170 had an intake?
CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id numbe...
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6170)) AND DATETIME(inputevents_cv.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'st...
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 last time in yesterday that patient 6170 had an intake? ### Input: CREATE TABLE d_items ( row_id number, ...
What is the average Year, when Country is 'U.S.', and when Location is 'Edmond , OK'?
CREATE TABLE table_62629 ( "Perpetrator" text, "Date" text, "Year" real, "Location" text, "Country" text, "Killed" real, "Injured" text )
SELECT AVG("Year") FROM table_62629 WHERE "Country" = 'u.s.' AND "Location" = 'edmond , ok'
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 Year, when Country is 'U.S.', and when Location is 'Edmond , OK'? ### Input: CREATE TABLE table_62629 ( ...
Which prod code was series 11?
CREATE TABLE table_25996938_1 ( production_code VARCHAR, no_in_series VARCHAR )
SELECT production_code FROM table_25996938_1 WHERE no_in_series = 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: Which prod code was series 11? ### Input: CREATE TABLE table_25996938_1 ( production_code VARCHAR, no_in_series VARC...
when did patient 030-556 receive the first intake until 558 days ago?
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugst...
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 = '030-556')) AND intakeoutput.cellpath LIKE '%intake%' ...
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 030-556 receive the first intake until 558 days ago? ### Input: CREATE TABLE diagnosis ( diagnosisid nu...
when on 12/20/this year patient 002-4486 had an intake for the last time?
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 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 = '002-4486')) AND intakeoutput.cellpath LIKE '%intake%'...
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 on 12/20/this year patient 002-4486 had an intake for the last time? ### Input: CREATE TABLE allergy ( allergyid nu...
What is listed as the highest Gold that also has a Silver that's smaller than 1, and has a Total that's smaller than 0?
CREATE TABLE table_name_23 ( gold INTEGER, silver VARCHAR, total VARCHAR )
SELECT MAX(gold) FROM table_name_23 WHERE silver < 1 AND total < 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 is listed as the highest Gold that also has a Silver that's smaller than 1, and has a Total that's smaller than 0? ### ...
what is the round when the pick # is less than 236 and the position is offensive guard?
CREATE TABLE table_name_64 ( round INTEGER, pick__number VARCHAR, position VARCHAR )
SELECT AVG(round) FROM table_name_64 WHERE pick__number < 236 AND position = "offensive guard"
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 round when the pick # is less than 236 and the position is offensive guard? ### Input: CREATE TABLE table_name_6...
Compare all train names' total numbers, and display by the total number from low to high.
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TA...
SELECT name, COUNT(name) FROM train 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: Compare all train names' total numbers, and display by the total number from low to high. ### Input: CREATE TABLE train ( ...
For those records from the products and each product's manufacturer, a bar chart shows the distribution of founder and the sum of manufacturer , and group by attribute founder, and I want to display by the names 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 Founder, SUM(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY Founder
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, a bar chart shows the distribution of founder and the s...
how many maximum series number have 2apx05 prod. code.
CREATE TABLE table_21994729_3 ( series__number INTEGER, prod_code VARCHAR )
SELECT MAX(series__number) FROM table_21994729_3 WHERE prod_code = "2APX05"
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 maximum series number have 2apx05 prod. code. ### Input: CREATE TABLE table_21994729_3 ( series__number INTEGER...
how many female patients died?
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 WHERE demographic.gender = "F" AND 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 female patients died? ### Input: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id...
Find the country of origin for the artist who made the least number of songs?
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE song ( song_name text, artist_name text, country text, f_id number, genre_is text, rating num...
SELECT T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name GROUP BY T2.artist_name ORDER BY COUNT(*) 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: Find the country of origin for the artist who made the least number of songs? ### Input: CREATE TABLE genre ( g_name tex...
Name the height in feet for the guard from north carolina-charlotte
CREATE TABLE table_56336 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "School/Club Team/Country" text )
SELECT "Height in Ft." FROM table_56336 WHERE "Position" = 'guard' AND "School/Club Team/Country" = 'north carolina-charlotte'
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 height in feet for the guard from north carolina-charlotte ### Input: CREATE TABLE table_56336 ( "Player" text,...
Which away team scored 18.11 (119)?
CREATE TABLE table_56455 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Away team" FROM table_56455 WHERE "Away team score" = '18.11 (119)'
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 away team scored 18.11 (119)? ### Input: CREATE TABLE table_56455 ( "Home team" text, "Home team score" text, ...
On what date was their record 46-39?
CREATE TABLE table_5592 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" text, "Record" text )
SELECT "Date" FROM table_5592 WHERE "Record" = '46-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: On what date was their record 46-39? ### Input: CREATE TABLE table_5592 ( "Date" text, "Opponent" text, "Score" ...
Show different nationalities along with the number of hosts of each nationality in a bar chart, and could you list in ascending by the y axis?
CREATE TABLE host ( Host_ID int, Name text, Nationality text, Age text ) CREATE TABLE party_host ( Party_ID int, Host_ID int, Is_Main_in_Charge bool ) CREATE TABLE party ( Party_ID int, Party_Theme text, Location text, First_year text, Last_year text, Number_of_host...
SELECT Nationality, COUNT(*) FROM host GROUP BY Nationality ORDER BY COUNT(*)
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 nationalities along with the number of hosts of each nationality in a bar chart, and could you list in ascend...
count the number of patients whose gender is m?
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 WHERE demographic.gender = "M"
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 gender is m? ### Input: CREATE TABLE prescriptions ( subject_id text, hadm_id tex...
Why did the manager who departed on August 1, 2008 leave?
CREATE TABLE table_name_69 ( reason_of_departure VARCHAR, date_outgoing VARCHAR )
SELECT reason_of_departure FROM table_name_69 WHERE date_outgoing = "august 1, 2008"
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: Why did the manager who departed on August 1, 2008 leave? ### Input: CREATE TABLE table_name_69 ( reason_of_departure VA...
how many patients have had infusion of vasopressor the previous year?
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT procedures_icd.hadm_id FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'infusion of vasopressor') AND DATETIME(procedures_ic...
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 have had infusion of vasopressor the previous year? ### Input: CREATE TABLE labevents ( row_id number,...
Return a bar chart showing the minimum room count of apartments in different type, and show by the total number from low to high.
CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CH...
SELECT apt_type_code, MIN(room_count) FROM Apartments GROUP BY apt_type_code ORDER BY MIN(room_count)
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 the minimum room count of apartments in different type, and show by the total number from low to ...
What is Player, when To Par is '+1', when Country is 'United States', and when Score is '71-70=141'?
CREATE TABLE table_43880 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "Player" FROM table_43880 WHERE "To par" = '+1' AND "Country" = 'united states' AND "Score" = '71-70=141'
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 Player, when To Par is '+1', when Country is 'United States', and when Score is '71-70=141'? ### Input: CREATE TABLE...
What is the average year with 7th (heats) position?
CREATE TABLE table_61538 ( "Year" real, "Competition" text, "Venue" text, "Position" text, "Notes" text )
SELECT AVG("Year") FROM table_61538 WHERE "Position" = '7th (heats)'
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 year with 7th (heats) position? ### Input: CREATE TABLE table_61538 ( "Year" real, "Competition"...
What is the away team's score when the away team is geelong?
CREATE TABLE table_name_16 ( away_team VARCHAR )
SELECT away_team AS score FROM table_name_16 WHERE away_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 is the away team's score when the away team is geelong? ### Input: CREATE TABLE table_name_16 ( away_team VARCHAR )...
Up vs Down votes by hour of day of Accepted Answer.
CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, ...
SELECT TIME_TO_STR(p.CreationDate, '%-HOUR') AS Hour, COUNT(*) AS Amount, SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS UpVotes, SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS DownVotes, (CAST(SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END) AS FLOAT) / CAST(SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END) AS FL...
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: Up vs Down votes by hour of day of Accepted Answer. ### Input: CREATE TABLE PendingFlags ( Id number, FlagTypeId num...
show me the flights on DL from ATLANTA in the morning
CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE TABLE flight_fare ( flight_id int, fare_id int ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )...
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE (city.city_code = airport_service.city_code AND city.city_name = 'ATLANTA' AND flight.airline_code = 'DL' AND flight.from_airport = airport_service.airport_code) AND flight.departure_time BETWEEN 0 AND 1200
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 on DL from ATLANTA in the morning ### Input: CREATE TABLE state ( state_code text, state_name te...
what was the last time during their current hospital visit patient 55360 had the maximum hemoglobin.
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, ...
SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55360 AND admissions.dischtime IS NULL) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') ORDER BY labevents.valuenum 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 was the last time during their current hospital visit patient 55360 had the maximum hemoglobin. ### Input: CREATE TABLE...
can you give me the evening flight on wednesday from WASHINGTON to ATLANTA again
CREATE TABLE code_description ( code varchar, description text ) CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airli...
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 = 'ATLANTA' AND date_day.day_number = 23 AND date_day.month_number = 4 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: can you give me the evening flight on wednesday from WASHINGTON to ATLANTA again ### Input: CREATE TABLE code_description ( ...
who wrote papers in 2015
CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrase...
SELECT DISTINCT writes.authorid FROM paper, writes WHERE paper.year = 2015 AND writes.paperid = paper.paperid
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 wrote papers in 2015 ### Input: CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE writes ( ...
Which Team 1 has a 2nd leg of 1-3?
CREATE TABLE table_59762 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text )
SELECT "Team 1" FROM table_59762 WHERE "2nd leg" = '1-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: Which Team 1 has a 2nd leg of 1-3? ### Input: CREATE TABLE table_59762 ( "Team 1" text, "Agg." text, "Team 2" te...
Compare the number of the local authority by the local authority, and rank in descending by the bar please.
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 local_authority, COUNT(local_authority) FROM station GROUP BY local_authority ORDER BY local_authority 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: Compare the number of the local authority by the local authority, and rank in descending by the bar please. ### Input: CREAT...
Who was the young rider classification when Alessandro Petacchi won?
CREATE TABLE table_30586 ( "Stage" real, "Winner" text, "General classification" text, "Points classification" text, "Mountains classification" text, "Young rider classification" text )
SELECT "Young rider classification" FROM table_30586 WHERE "Winner" = 'Alessandro Petacchi'
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 young rider classification when Alessandro Petacchi won? ### Input: CREATE TABLE table_30586 ( "Stage" real,...
what was the total input amount that patient 006-157753 has received on the current icu visit?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE patient ( uniquepid text, patientheal...
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 = '006-157753') AND patient.unitdischargetime IS NU...
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 input amount that patient 006-157753 has received on the current icu visit? ### Input: CREATE TABLE treat...
For all employees who have the letters D or S in their first name, a line chart shows the change of commission_pct over hire_date
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
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 all employees who have the letters D or S in their first name, a line chart shows the change of commission_pct over hire...
Visualize a bar chart for the number of trains for each station by the station network name, display names in desc order please.
CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE weekly_weather ( station_id int, day_of_week text...
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 network_name 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: Visualize a bar chart for the number of trains for each station by the station network name, display names in desc order ple...
give me the number of patients whose ethnicity is american indian/alaska native and admission year is less than 2148?
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 WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.admityear < "2148"
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 ethnicity is american indian/alaska native and admission year is less than 2148? ### In...
How many people were in attendance in a week over 4 on December 6, 1981?
CREATE TABLE table_69021 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real )
SELECT COUNT("Attendance") FROM table_69021 WHERE "Week" > '4' AND "Date" = 'december 6, 1981'
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 people were in attendance in a week over 4 on December 6, 1981? ### Input: CREATE TABLE table_69021 ( "Week" re...
And does 584 have a lab ?
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 semester ( semester_id int, semester varchar, year int ) CREATE TABLE...
SELECT COUNT(*) > 0 FROM course WHERE department = 'EECS' AND has_lab = 'Y' AND number = 584
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: And does 584 have a lab ? ### Input: CREATE TABLE student_record ( student_id int, course_id int, semester int, ...
Which Auckland has an Adelaide of no, a Melbourne of yes, and a Sydney of yes?
CREATE TABLE table_name_1 ( auckland VARCHAR, sydney VARCHAR, adelaide VARCHAR, melbourne VARCHAR )
SELECT auckland FROM table_name_1 WHERE adelaide = "no" AND melbourne = "yes" AND sydney = "yes"
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 Auckland has an Adelaide of no, a Melbourne of yes, and a Sydney of yes? ### Input: CREATE TABLE table_name_1 ( au...
Which Goals for has a Position smaller than 16, and Wins smaller than 19, and Goals against smaller than 32?
CREATE TABLE table_59876 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
SELECT MIN("Goals for") FROM table_59876 WHERE "Position" < '16' AND "Wins" < '19' AND "Goals against" < '32'
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 Goals for has a Position smaller than 16, and Wins smaller than 19, and Goals against smaller than 32? ### Input: CREA...
How many living patients were diagnosed with procedure icd9 code 3897?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.icd9_code = "3897"
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 living patients were diagnosed with procedure icd9 code 3897? ### Input: CREATE TABLE prescriptions ( subject_i...