instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
How many patients admitted before the year 2198 are diagnosed with primary disease coronary artery disease\coronary artery bypass graft /sda?
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 WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA" AND demographic.admityear < "2198"
Below are sql tables 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 admitted before the year 2198 are diagnosed with primary disease coronary artery disease\coronary artery b...
Who won the Women's doubles the year that there was no competition in both the Men's doubles and the Men's singles?
CREATE TABLE table_34274 ( "Year" text, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text )
SELECT "Women's doubles" FROM table_34274 WHERE "Men's doubles" = 'no competition' AND "Men's singles" = 'no competition'
Below are sql tables 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 won the Women's doubles the year that there was no competition in both the Men's doubles and the Men's singles? ### Inpu...
What is minimum age for different job title, and could you list names from low to high order please?
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY job
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is minimum age for different job title, and could you list names from low to high order please? ### Input: CREATE TABLE...
Which driver has a grid value larger than 11, and drove more than 52 laps?
CREATE TABLE table_52956 ( "Driver" text, "Constructor" text, "Laps" real, "Time/Retired" text, "Grid" real )
SELECT "Driver" FROM table_52956 WHERE "Grid" > '11' AND "Laps" > '52'
Below are sql tables 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 driver has a grid value larger than 11, and drove more than 52 laps? ### Input: CREATE TABLE table_52956 ( "Driver...
What is the average value of Bronze when silver is 0 and the total is less than 1?
CREATE TABLE table_name_18 ( bronze INTEGER, silver VARCHAR, total VARCHAR )
SELECT AVG(bronze) FROM table_name_18 WHERE silver = 0 AND total < 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 average value of Bronze when silver is 0 and the total is less than 1? ### Input: CREATE TABLE table_name_18 ( ...
what is the first time patient 83894 was admitted through the phys referral/normal deli to the hospital in 2102?
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom te...
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 83894 AND admissions.admission_location = 'phys referral/normal deli' AND STRFTIME('%y', admissions.admittime) = '2102' 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 is the first time patient 83894 was admitted through the phys referral/normal deli to the hospital in 2102? ### Input: ...
Name the opponents for record of 2-1
CREATE TABLE table_24124 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Black Knights points" real, "Opponents" real, "Record" text )
SELECT "Opponents" FROM table_24124 WHERE "Record" = '2-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: Name the opponents for record of 2-1 ### Input: CREATE TABLE table_24124 ( "Game" real, "Date" text, "Opponent" ...
what was the top five most common specimen tests that followed within the same month for those who had been diagnosed with nausea in this year?
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code tex...
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 = 'nausea' AND DATETIME(diagnosis.diagnosistime...
Below are sql tables 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 top five most common specimen tests that followed within the same month for those who had been diagnosed with n...
A visualization to show the headquarter and revenue of all manufacturers sorted by their revenue in the descending order.
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 Headquarter, Revenue FROM Manufacturers ORDER BY Revenue DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: A visualization to show the headquarter and revenue of all manufacturers sorted by their revenue in the descending order. ##...
had patient 035-19333 been prescribed cordarone, lactated ringers or lantus last year?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemics...
SELECT COUNT(*) > 0 FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-19333')) AND medication.drugname IN ('cordarone', 'lactated ringers', ...
Below are sql tables 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 035-19333 been prescribed cordarone, lactated ringers or lantus last year? ### Input: CREATE TABLE lab ( lab...
What is the lowest Bronze, when Gold is less than 0?
CREATE TABLE table_name_58 ( bronze INTEGER, gold INTEGER )
SELECT MIN(bronze) FROM table_name_58 WHERE gold < 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 the lowest Bronze, when Gold is less than 0? ### Input: CREATE TABLE table_name_58 ( bronze INTEGER, gold IN...
What was the place when the score was 68-75-68=211?
CREATE TABLE table_78676 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "Place" FROM table_78676 WHERE "Score" = '68-75-68=211'
Below are sql tables 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 place when the score was 68-75-68=211? ### Input: CREATE TABLE table_78676 ( "Place" text, "Player" tex...
show me cheap flights from BALTIMORE to DALLAS
CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) CREATE TABLE month ( month_number int, month_name text ) CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) CREATE TABLE date_day ( month_number int, ...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, airport_service AS AIRPORT_SERVICE_2, city AS CITY_0, city AS CITY_1, city AS CITY_2, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BALTIMORE' 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: show me cheap flights from BALTIMORE to DALLAS ### Input: CREATE TABLE food_service ( meal_code text, meal_number in...
What is the department name and corresponding building for the department with the greatest budget?
CREATE TABLE classroom ( building text, room_number text, capacity number ) CREATE TABLE course ( course_id text, title text, dept_name text, credits number ) CREATE TABLE section ( course_id text, sec_id text, semester text, year number, building text, room_number ...
SELECT dept_name, building FROM department ORDER BY budget 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 department name and corresponding building for the department with the greatest budget? ### Input: CREATE TABLE ...
provide me the number of patients with procedure icd9 code 17 who were discharged to skilled nursing facility.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "SNF" AND procedures.icd9_code = "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: provide me the number of patients with procedure icd9 code 17 who were discharged to skilled nursing facility. ### Input: CR...
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of founder and the average of manufacturer , and group by attribute founder.
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, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP 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, draw a bar chart about the distribution of founder and ...
Find the number of departments in each school Plot them as bar chart, could you list in ascending by the X?
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE PR...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the number of departments in each school Plot them as bar chart, could you list in ascending by the X? ### Input: CREAT...
When was the record of 0-1 set?
CREATE TABLE table_18028 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Record" text, "Attendance" text )
SELECT "Date" FROM table_18028 WHERE "Record" = '0-1'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When was the record of 0-1 set? ### Input: CREATE TABLE table_18028 ( "Week" real, "Date" text, "Opponent" text,...
Give me the comparison about the average of Height over the Sex , and group by attribute Sex.
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(Height) 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: Give me the comparison about the average of Height over the Sex , and group by attribute Sex. ### Input: CREATE TABLE candid...
Who is the listed opponent in Week 2?
CREATE TABLE table_57371 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
SELECT "Opponent" FROM table_57371 WHERE "Week" = '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: Who is the listed opponent in Week 2? ### Input: CREATE TABLE table_57371 ( "Week" real, "Date" text, "Opponent"...
What was the Record on September 21?
CREATE TABLE table_36422 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Save" text, "Record" text )
SELECT "Record" FROM table_36422 WHERE "Date" = 'september 21'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the Record on September 21? ### Input: CREATE TABLE table_36422 ( "Date" text, "Opponent" text, "Score"...
What is Score, when Attendance is '349'?
CREATE TABLE table_60028 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Attendance" text )
SELECT "Score" FROM table_60028 WHERE "Attendance" = '349'
Below are sql tables 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 Score, when Attendance is '349'? ### Input: CREATE TABLE table_60028 ( "Tie no" text, "Home team" text, ...
What is the lowest rank of Jens Kruppa in a lane larger than 2?
CREATE TABLE table_71392 ( "Rank" real, "Lane" real, "Name" text, "Nationality" text, "Time" text )
SELECT MIN("Rank") FROM table_71392 WHERE "Name" = 'jens kruppa' AND "Lane" > '2'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the lowest rank of Jens Kruppa in a lane larger than 2? ### Input: CREATE TABLE table_71392 ( "Rank" real, "...
Show the booking status code and the corresponding number of bookings by a pie chart.
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Facilities ( apt_id I...
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_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: Show the booking status code and the corresponding number of bookings by a pie chart. ### Input: CREATE TABLE Apartment_Buil...
What intelligent systems courses are prerequisites for 590 ?
CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREAT...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0 INNER JOIN course_prerequisite ON COURSE_0.course_id = course_prerequisite.pre_course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.course_id INNER JOIN area ON COURSE_0.course_id = area.course_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: What intelligent systems courses are prerequisites for 590 ? ### Input: CREATE TABLE offering_instructor ( offering_inst...
is there any microbiology test results for patient 73652 until 141 months ago?
CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 73652) AND DATETIME(microbiologyevents.charttime) <= DATETIME(CURRENT_TIME(), '-141 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: is there any microbiology test results for patient 73652 until 141 months ago? ### Input: CREATE TABLE transfers ( row_i...
how many times did patient 005-46456 receive surgery consultation in 2104?
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(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-46456')) AND treatment.treatmentname = 'surgery consultation' AND STRFTIME('...
Below are sql tables 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 times did patient 005-46456 receive surgery consultation in 2104? ### Input: CREATE TABLE treatment ( treatment...
what is the number of patients diagnosed with ath ext ntv at w claudct who didn't come back to the hospital within 2 months since 3 years ago?
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE d_labitems ( row_i...
SELECT (SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'ath ext nt...
Below are sql tables 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 diagnosed with ath ext ntv at w claudct who didn't come back to the hospital within 2 months ...
Which townland has an area of 165 acres?
CREATE TABLE table_30120619_1 ( townland VARCHAR, area__acres__ VARCHAR )
SELECT townland FROM table_30120619_1 WHERE area__acres__ = 165
Below are sql tables 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 townland has an area of 165 acres? ### Input: CREATE TABLE table_30120619_1 ( townland VARCHAR, area__acres__ ...
what is the number of patients whose year of birth is less than 2104 and drug route is td?
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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
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.route = "TD"
Below are sql tables 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 year of birth is less than 2104 and drug route is td? ### Input: CREATE TABLE prescript...
What is the sum of the week for the Denver Broncos?
CREATE TABLE table_name_60 ( week INTEGER, opponent VARCHAR )
SELECT SUM(week) FROM table_name_60 WHERE opponent = "denver broncos"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the sum of the week for the Denver Broncos? ### Input: CREATE TABLE table_name_60 ( week INTEGER, opponent V...
Return a bar chart on how many patients do each physician take care of? List their names and number of patients they take care of, sort in desc by the x-axis.
CREATE TABLE Stay ( StayID INTEGER, Patient INTEGER, Room INTEGER, StayStart DATETIME, StayEnd DATETIME ) CREATE TABLE On_Call ( Nurse INTEGER, BlockFloor INTEGER, BlockCode INTEGER, OnCallStart DATETIME, OnCallEnd DATETIME ) CREATE TABLE Medication ( Code INTEGER, Name...
SELECT T1.Name, COUNT(*) FROM Physician AS T1 JOIN Patient AS T2 ON T1.EmployeeID = T2.PCP GROUP BY T1.EmployeeID ORDER BY T1.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: Return a bar chart on how many patients do each physician take care of? List their names and number of patients they take ca...
What party did the re-elected incumbent of the Texas 11 district belong to?
CREATE TABLE table_1342149_43 ( party VARCHAR, result VARCHAR, district VARCHAR )
SELECT party FROM table_1342149_43 WHERE result = "Re-elected" AND district = "Texas 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: What party did the re-elected incumbent of the Texas 11 district belong to? ### Input: CREATE TABLE table_1342149_43 ( p...
had patient 5828's arterial bp [systolic] normal been in the previous day?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE chartevents...
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [systo...
Below are sql tables 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 5828's arterial bp [systolic] normal been in the previous day? ### Input: CREATE TABLE procedures_icd ( row_...
What is the Tries against for the team that has 207 points for?
CREATE TABLE table_44337 ( "Team" text, "Tries for" text, "Tries against" text, "Try diff" text, "Points for" text, "Points against" text, "Points diff" text )
SELECT "Tries against" FROM table_44337 WHERE "Points for" = '207'
Below are sql tables 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 Tries against for the team that has 207 points for? ### Input: CREATE TABLE table_44337 ( "Team" text, "...
count the number of patients still living who have diagnoses icd9 code 5589.
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 WHERE demographic.expire_flag = "0" AND diagnoses.icd9_code = "5589"
Below are sql tables 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 still living who have diagnoses icd9 code 5589. ### Input: CREATE TABLE demographic ( subje...
What was the Surface on during 10 November 2006?
CREATE TABLE table_66440 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponents in the final" text, "Score" text )
SELECT "Surface" FROM table_66440 WHERE "Date" = '10 november 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 the Surface on during 10 November 2006? ### Input: CREATE TABLE table_66440 ( "Date" text, "Tournament" tex...
Return a pie chart on what is the average song rating for each language?
CREATE TABLE artist ( artist_name varchar2(50), country varchar2(20), gender varchar2(20), preferred_genre varchar2(50) ) CREATE TABLE files ( f_id number(10), artist_name varchar2(50), file_size varchar2(20), duration varchar2(20), formats varchar2(20) ) CREATE TABLE song ( so...
SELECT languages, AVG(rating) FROM song GROUP 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: Return a pie chart on what is the average song rating for each language? ### Input: CREATE TABLE artist ( artist_name va...
provide the number of patients whose admission location is trsf within this facility and year of birth is less than 2137?
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 lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.dob_year < "2137"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: provide the number of patients whose admission location is trsf within this facility and year of birth is less than 2137? ##...
Courses for Spring-Summer 2011 included Prof. Xiaoyang Li for HISTORY 773 ?
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 COUNT(*) > 0 FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND course.department = 'HISTORY' AND course.number = 773 AND instructor.name LIKE '%Xiaoyang Li%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Courses for Spring-Summer 2011 included Prof. Xiaoyang Li for HISTORY 773 ? ### Input: CREATE TABLE program ( program_id...
Compare the number of items in each color scheme using a bar chart, and I want to display by the x axis from low to high.
CREATE TABLE photos ( id int, camera_lens_id int, mountain_id int, color text, name text ) CREATE TABLE camera_lens ( id int, brand text, name text, focal_length_mm real, max_aperture real ) CREATE TABLE mountain ( id int, name text, Height real, Prominence real...
SELECT color, COUNT(color) FROM photos GROUP BY color ORDER BY color
Below are sql tables 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 items in each color scheme using a bar chart, and I want to display by the x axis from low to high. ##...
PERIODON 790 has been offered for how long now ?
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABL...
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'PERIODON' AND course.number = 790 AND semester.semester_id = course_offering.semester ORDER BY semester.year 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: PERIODON 790 has been offered for how long now ? ### Input: CREATE TABLE gsi ( course_offering_id int, student_id in...
For those employees who was hired before 2002-06-21, give me the comparison about the average of employee_id over the job_id , and group by attribute job_id by a bar chart, show Y-axis in descending order.
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_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: For those employees who was hired before 2002-06-21, give me the comparison about the average of employee_id over the job_id...
What day did Footscray play as the home team?
CREATE TABLE table_56237 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Date" FROM table_56237 WHERE "Home team" = 'footscray'
Below are sql tables 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 day did Footscray play as the home team? ### Input: CREATE TABLE table_56237 ( "Home team" text, "Home team sco...
What is the greatest capacity for rooms in each building? Draw a bar chart.
CREATE TABLE department ( dept_name varchar(20), building varchar(15), budget numeric(12,2) ) CREATE TABLE course ( course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) ) CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE student...
SELECT building, MAX(capacity) FROM classroom GROUP 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: What is the greatest capacity for rooms in each building? Draw a bar chart. ### Input: CREATE TABLE department ( dept_na...
what is admission type and days of hospital stay of subject id 91588?
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 lab ( subject_id text, hadm_id text, ...
SELECT demographic.admission_type, demographic.days_stay FROM demographic WHERE demographic.subject_id = "91588"
Below are sql tables 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 admission type and days of hospital stay of subject id 91588? ### Input: CREATE TABLE diagnoses ( subject_id tex...
What is the format for the label Mightier than Sword on January 12, 2010 in the United States?
CREATE TABLE table_59369 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
SELECT "Format" FROM table_59369 WHERE "Region" = 'united states' AND "Date" = 'january 12, 2010' AND "Label" = 'mightier than sword'
Below are sql tables 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 format for the label Mightier than Sword on January 12, 2010 in the United States? ### Input: CREATE TABLE table...
List the number of games in each season and group by home team in a group line chart, and I want to show by the Season in ascending.
CREATE TABLE game ( stadium_id int, id int, Season int, Date text, Home_team text, Away_team text, Score text, Competition text ) CREATE TABLE injury_accident ( game_id int, id int, Player text, Injury text, Number_of_matches text, Source text ) CREATE TABLE sta...
SELECT Season, COUNT(Season) FROM game GROUP BY Home_team, Season ORDER BY Season
Below are sql tables 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 number of games in each season and group by home team in a group line chart, and I want to show by the Season in as...
Would MODGREEK 305 fit the ULCS requirements ?
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 COUNT(*) > 0 FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.department = 'MODGREEK' AND course.number = 305 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: Would MODGREEK 305 fit the ULCS requirements ? ### Input: CREATE TABLE requirement ( requirement_id int, requirement...
List the total number of years that have a score of 3 6, 4 6, 2 6.
CREATE TABLE table_2201724_1 ( year VARCHAR, score_in_the_final VARCHAR )
SELECT COUNT(year) FROM table_2201724_1 WHERE score_in_the_final = "3–6, 4–6, 2–6"
Below are sql tables 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 total number of years that have a score of 3 6, 4 6, 2 6. ### Input: CREATE TABLE table_2201724_1 ( year VARCHA...
Name the tournament for semifinal hard surface for opponent of pam casale
CREATE TABLE table_name_86 ( tournament VARCHAR, opponent VARCHAR, round VARCHAR, surface VARCHAR )
SELECT tournament FROM table_name_86 WHERE round = "semifinal" AND surface = "hard" AND opponent = "pam casale"
Below are sql tables 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 tournament for semifinal hard surface for opponent of pam casale ### Input: CREATE TABLE table_name_86 ( tourna...
Find total capacity of dorms for each gender in a bar chart, and I want to sort y-axis in ascending order.
CREATE TABLE Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEG...
SELECT gender, SUM(student_capacity) FROM Dorm GROUP BY gender ORDER BY SUM(student_capacity)
Below are sql tables 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 total capacity of dorms for each gender in a bar chart, and I want to sort y-axis in ascending order. ### Input: CREATE...
which month held the least amount of competitions ?
CREATE TABLE table_203_442 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text )
SELECT "date" FROM table_203_442 GROUP BY "date" 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: which month held the least amount of competitions ? ### Input: CREATE TABLE table_203_442 ( id number, "#" number, ...
How many of the patients diagnosed with icd9 code 7098 died in or before the year 2132?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2132.0" AND diagnoses.icd9_code = "7098"
Below are sql tables 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 diagnosed with icd9 code 7098 died in or before the year 2132? ### Input: CREATE TABLE lab ( su...
In what year was Phil J. Welch first elected?
CREATE TABLE table_1342198_25 ( first_elected VARCHAR, incumbent VARCHAR )
SELECT first_elected FROM table_1342198_25 WHERE incumbent = "Phil J. Welch"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: In what year was Phil J. Welch first elected? ### Input: CREATE TABLE table_1342198_25 ( first_elected VARCHAR, incu...
What round pick was pick number 101 who plays defensive back?
CREATE TABLE table_39718 ( "Round" real, "Pick #" text, "Player" text, "Position" text, "College" text, "Tenure w/ Steelers" text )
SELECT "Round" FROM table_39718 WHERE "Position" = 'defensive back' AND "Pick #" = '101'
Below are sql tables 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 round pick was pick number 101 who plays defensive back? ### Input: CREATE TABLE table_39718 ( "Round" real, "P...
List the authors who do not have submission to any workshop.
CREATE TABLE acceptance ( submission_id number, workshop_id number, result text ) CREATE TABLE submission ( submission_id number, scores number, author text, college text ) CREATE TABLE workshop ( workshop_id number, date text, venue text, name text )
SELECT author FROM submission WHERE NOT submission_id IN (SELECT submission_id FROM acceptance)
Below are sql tables 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 authors who do not have submission to any workshop. ### Input: CREATE TABLE acceptance ( submission_id number, ...
count the number of patients whose death status is 0 and diagnoses long title is chronic diastolic heart failure?
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 prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.long_title = "Chronic diastolic heart failure"
Below are sql tables 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 death status is 0 and diagnoses long title is chronic diastolic heart failure? ### Input:...
what is the number of patients under the age of 86 whose drug code is levobase2?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "86" AND prescriptions.formulary_drug_cd = "LEVOBASE2"
Below are sql tables 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 under the age of 86 whose drug code is levobase2? ### Input: CREATE TABLE diagnoses ( sub...
how many of the current patients are 40s?
CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, ...
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.hospitaldischargetime IS NULL AND patient.age BETWEEN 40 AND 49
Below are sql tables 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 current patients are 40s? ### Input: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayi...
what is patient 006-195310's height for the first time until 19 months ago?
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 patient ( uniquep...
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-195310') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime) <= DATETIME(CURRENT_TIME(), '-19 month') ORDER BY patient.unit...
Below are sql tables 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-195310's height for the first time until 19 months ago? ### Input: CREATE TABLE vitalperiodic ( vita...
Which Artist has a Draw of 6?
CREATE TABLE table_name_7 ( artist VARCHAR, draw VARCHAR )
SELECT artist FROM table_name_7 WHERE draw = 6
Below are sql tables 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 Artist has a Draw of 6? ### Input: CREATE TABLE table_name_7 ( artist VARCHAR, draw VARCHAR ) ### Response: SE...
how many times does patient 017-7283 get a mchc test during the last hospital visit?
CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE cost ( costid number, uniquepi...
SELECT COUNT(*) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-7283' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime 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: how many times does patient 017-7283 get a mchc test during the last hospital visit? ### Input: CREATE TABLE treatment ( ...
Who was the opponent against which the result was w20-0?
CREATE TABLE table_name_3 ( opponent VARCHAR, result VARCHAR )
SELECT opponent FROM table_name_3 WHERE result = "w20-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: Who was the opponent against which the result was w20-0? ### Input: CREATE TABLE table_name_3 ( opponent VARCHAR, re...
what is days of hospital stay and procedure long title of subject id 25543?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
SELECT demographic.days_stay, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "25543"
Below are sql tables 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 days of hospital stay and procedure long title of subject id 25543? ### Input: CREATE TABLE diagnoses ( subject_...
when did patient 013-17922 receive a prescription for insulin aspart in 05/last year first?
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, d...
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 = '013-17922')) AND medication.drugname = 'insulin aspart' AND DA...
Below are sql tables 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 013-17922 receive a prescription for insulin aspart in 05/last year first? ### Input: CREATE TABLE cost ( ...
Show all the faculty ranks and the number of students advised by each rank. Visualize by bar chart.
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) ) CREATE TABLE Activity ( actid INTEGER, acti...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank
Below are sql tables 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 all the faculty ranks and the number of students advised by each rank. Visualize by bar chart. ### Input: CREATE TABLE ...
what is the number of patients whose year of birth is less than 2121 and lab test fluid is cerebrospinal fluid (csf)?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
Below are sql tables 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 year of birth is less than 2121 and lab test fluid is cerebrospinal fluid (csf)? ### In...
how many patients underwent coronar arteriogr-2 cath after having been diagnosed with long-term use anticoagul within the same month?
CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE d_items ( row_id num...
SELECT COUNT(DISTINCT t1.subject_id) 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 d_icd_diagnoses.short_title = 'long-term use anti...
Below are sql tables 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 underwent coronar arteriogr-2 cath after having been diagnosed with long-term use anticoagul within the sa...
what were the five most common drugs prescribed until 2102?
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE chartevents ( row_id number, subject_id number, had...
SELECT t1.drug FROM (SELECT prescriptions.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM prescriptions WHERE STRFTIME('%y', prescriptions.startdate) <= '2102' GROUP BY prescriptions.drug) AS t1 WHERE t1.c1 <= 5
Below are sql tables 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 five most common drugs prescribed until 2102? ### Input: CREATE TABLE icustays ( row_id number, subjec...
What are all the different product names, and how many complains has each received Show bar chart, and rank Y-axis in descending order.
CREATE TABLE Complaints ( complaint_id INTEGER, product_id INTEGER, customer_id INTEGER, complaint_outcome_code VARCHAR(20), complaint_status_code VARCHAR(20), complaint_type_code VARCHAR(20), date_complaint_raised DATETIME, date_complaint_closed DATETIME, staff_id INTEGER ) CREATE ...
SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name 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: What are all the different product names, and how many complains has each received Show bar chart, and rank Y-axis in descen...
find the number of patients with diagnoses icd9 code 34291 for whom ascitic fluid lab test order was placed.
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.icd9_code = "34291" AND lab.fluid = "Ascites"
Below are sql tables 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 patients with diagnoses icd9 code 34291 for whom ascitic fluid lab test order was placed. ### Input: CREA...
What day did the team play week 13?
CREATE TABLE table_name_87 ( date VARCHAR, week VARCHAR )
SELECT date FROM table_name_87 WHERE week = 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: What day did the team play week 13? ### Input: CREATE TABLE table_name_87 ( date VARCHAR, week VARCHAR ) ### Respons...
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by time, rank by the Y from low to high.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(DEPARTMENT_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 all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date an...
What is the NBA draft for ohio state?
CREATE TABLE table_51428 ( "Player" text, "Height" text, "School" text, "Hometown" text, "College" text, "NBA Draft" text )
SELECT "NBA Draft" FROM table_51428 WHERE "College" = 'ohio state'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the NBA draft for ohio state? ### Input: CREATE TABLE table_51428 ( "Player" text, "Height" text, "Schoo...
in 2103 what is the top four most frequent output event?
CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) CREATE TABLE outputevents ( row_id number, subject_id number, ha...
SELECT d_items.label FROM d_items WHERE d_items.itemid IN (SELECT t1.itemid FROM (SELECT outputevents.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM outputevents WHERE STRFTIME('%y', outputevents.charttime) = '2103' GROUP BY outputevents.itemid) 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: in 2103 what is the top four most frequent output event? ### Input: CREATE TABLE icustays ( row_id number, subject_i...
Who did they play when there were only 751 in attendance?
CREATE TABLE table_51075 ( "Date" text, "Opponent" text, "Venue" text, "Result" text, "Attendance" real, "Competition" text, "Man of the Match" text )
SELECT "Opponent" FROM table_51075 WHERE "Attendance" < '751'
Below are sql tables 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 they play when there were only 751 in attendance? ### Input: CREATE TABLE table_51075 ( "Date" text, "Oppone...
Who directed the episode that had 3.55 million viewers?
CREATE TABLE table_29897962_1 ( directed_by VARCHAR, us_viewers__million_ VARCHAR )
SELECT directed_by FROM table_29897962_1 WHERE us_viewers__million_ = "3.55"
Below are sql tables 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 directed the episode that had 3.55 million viewers? ### Input: CREATE TABLE table_29897962_1 ( directed_by VARCHAR, ...
how much was patient 7241's body weight last measured in 05/2103?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, ...
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 = 7241)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' ...
Below are sql tables 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 was patient 7241's body weight last measured in 05/2103? ### Input: CREATE TABLE procedures_icd ( row_id number...
history of type i diabetes
CREATE TABLE table_train_245 ( "id" int, "renal_disease" bool, "diabetic" string, "creatinine_clearance_cl" float, "smoking" bool, "kidney_disease" bool, "body_mass_index_bmi" float, "fasting_glucose" int, "NOUSE" float )
SELECT * FROM table_train_245 WHERE diabetic = 'i'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: history of type i diabetes ### Input: CREATE TABLE table_train_245 ( "id" int, "renal_disease" bool, "diabetic" ...
which competitor came in first for this race ?
CREATE TABLE table_204_713 ( id number, "rank" number, "bib" number, "athlete" text, "country" text, "time" text, "deficit" text )
SELECT "athlete" FROM table_204_713 WHERE id = 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: which competitor came in first for this race ? ### Input: CREATE TABLE table_204_713 ( id number, "rank" number, ...
A bar chart about the number of last name for all female students whose sex is F, and rank in asc by the y-axis.
CREATE TABLE Has_Allergy ( StuID INTEGER, Allergy VARCHAR(20) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Allergy_Type ( Allergy VARCHAR(20), ...
SELECT LName, COUNT(LName) FROM Student WHERE Sex = 'F' GROUP BY LName ORDER BY COUNT(LName)
Below are sql tables 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 about the number of last name for all female students whose sex is F, and rank in asc by the y-axis. ### Input: ...
When November is 153 what is the March number?
CREATE TABLE table_25235489_2 ( march_27_29 VARCHAR, november_3 VARCHAR )
SELECT march_27_29 FROM table_25235489_2 WHERE november_3 = "153"
Below are sql tables 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 November is 153 what is the March number? ### Input: CREATE TABLE table_25235489_2 ( march_27_29 VARCHAR, novem...
what is drug type of drug name hydromorphone?
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 prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Hydromorphone"
Below are sql tables 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 drug type of drug name hydromorphone? ### Input: CREATE TABLE demographic ( subject_id text, hadm_id text, ...
For events with under 3 times played and fewer than 1 cut made, what is the total number of top-10 finishes?
CREATE TABLE table_name_24 ( top_10 VARCHAR, events VARCHAR, cuts_made VARCHAR )
SELECT COUNT(top_10) FROM table_name_24 WHERE events < 3 AND cuts_made < 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: For events with under 3 times played and fewer than 1 cut made, what is the total number of top-10 finishes? ### Input: CREA...
When 20' 58.50 107.929mph is Friday August 27th What is Tuesday 24th August?
CREATE TABLE table_29189 ( "Rank" real, "Rider" text, "Sat 21 Aug" text, "Mon 23 Aug" text, "Tues 24 Aug" text, "Wed 25 Aug" text, "Thurs 26 Aug" text, "Fri 27 Aug" text, "Sat 29 Aug" text )
SELECT "Tues 24 Aug" FROM table_29189 WHERE "Fri 27 Aug" = '20'' 58.50 107.929mph'
Below are sql tables 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 20' 58.50 107.929mph is Friday August 27th What is Tuesday 24th August? ### Input: CREATE TABLE table_29189 ( "Rank...
For all storms with at least 1 death, show me the dates active and the total number of deaths with a bar chart, could you sort by the names in asc?
CREATE TABLE storm ( Storm_ID int, Name text, Dates_active text, Max_speed int, Damage_millions_USD real, Number_Deaths int ) CREATE TABLE region ( Region_id int, Region_code text, Region_name text ) CREATE TABLE affected_region ( Region_id int, Storm_ID int, Number_cit...
SELECT Dates_active, Number_Deaths FROM storm WHERE Number_Deaths >= 1 ORDER BY Dates_active
Below are sql tables 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 storms with at least 1 death, show me the dates active and the total number of deaths with a bar chart, could you so...
bmi between 10 to 85 percentile
CREATE TABLE table_train_230 ( "id" int, "anemia" bool, "diabetic" string, "lactose_intolerance" bool, "hb" float, "body_mass_index_bmi" float, "NOUSE" float )
SELECT * FROM table_train_230 WHERE body_mass_index_bmi >= 10 AND body_mass_index_bmi <= 85
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: bmi between 10 to 85 percentile ### Input: CREATE TABLE table_train_230 ( "id" int, "anemia" bool, "diabetic" st...
Name the sum of laps for 12 grids
CREATE TABLE table_70605 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
SELECT SUM("Laps") FROM table_70605 WHERE "Grid" = '12'
Below are sql tables 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 sum of laps for 12 grids ### Input: CREATE TABLE table_70605 ( "Rider" text, "Manufacturer" text, "Laps...
What is the most common birth place of people?
CREATE TABLE people ( Birth_Place VARCHAR )
SELECT Birth_Place FROM people GROUP BY Birth_Place 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 most common birth place of people? ### Input: CREATE TABLE people ( Birth_Place VARCHAR ) ### Response: SELE...
what is the 2011 performance for the US open?
CREATE TABLE table_15070 ( "Tournament" text, "2009" text, "2010" text, "2011" text, "2012" text )
SELECT "2011" FROM table_15070 WHERE "Tournament" = 'us open'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the 2011 performance for the US open? ### Input: CREATE TABLE table_15070 ( "Tournament" text, "2009" text, ...
Which away team has a team score of 12.11 (83)?
CREATE TABLE table_33039 ( "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_33039 WHERE "Away team score" = '12.11 (83)'
Below are sql tables 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 has a team score of 12.11 (83)? ### Input: CREATE TABLE table_33039 ( "Home team" text, "Home team s...
Which location has 140 stores?
CREATE TABLE table_name_29 ( location VARCHAR, stores VARCHAR )
SELECT location FROM table_name_29 WHERE stores = "140"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which location has 140 stores? ### Input: CREATE TABLE table_name_29 ( location VARCHAR, stores VARCHAR ) ### Respon...
give me the number of patients whose primary disease is morbid obesity/sda and lab test fluid is cerebrospinal fluid (csf)?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "MORBID OBESITY/SDA" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
Below are sql tables 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 primary disease is morbid obesity/sda and lab test fluid is cerebrospinal fluid (csf)? ...
what number of patients have had a inject anticoagulant procedure during this year?
CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE icustays ( row_id number, ...
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 = 'inject anticoagulant') AND DATETIME(procedures_icd.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 number of patients have had a inject anticoagulant procedure during this year? ### Input: CREATE TABLE d_icd_diagnoses ...
Which complaint status has more than 3 records on file?
CREATE TABLE complaints ( complaint_status_code VARCHAR )
SELECT complaint_status_code FROM complaints GROUP BY complaint_status_code HAVING COUNT(*) > 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 complaint status has more than 3 records on file? ### Input: CREATE TABLE complaints ( complaint_status_code VARCH...
What is the names of the physicians who prescribe medication Thesisin?
CREATE TABLE medication ( code VARCHAR, name VARCHAR ) CREATE TABLE physician ( name VARCHAR, employeeid VARCHAR ) CREATE TABLE prescribes ( physician VARCHAR, medication VARCHAR )
SELECT DISTINCT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician JOIN medication AS T3 ON T3.code = T2.medication WHERE T3.name = "Thesisin"
Below are sql tables 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 names of the physicians who prescribe medication Thesisin? ### Input: CREATE TABLE medication ( code VARCHAR...
what is the number of patients who are born before 2175 with lab test item id 50896?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2175" AND lab.itemid = "50896"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the number of patients who are born before 2175 with lab test item id 50896? ### Input: CREATE TABLE diagnoses ( ...
give me the number of patients who had hyaline casts lab test and were born before 2121.
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2121" AND lab.label = "Hyaline Casts"
Below are sql tables 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 who had hyaline casts lab test and were born before 2121. ### Input: CREATE TABLE diagnoses (...
tell me the volume of drain out #1 jackson pratt patient 73693 had on last month/10?
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 transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, ...
SELECT SUM(outputevents.value) 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 = 73693)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'dra...
Below are sql tables 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 volume of drain out #1 jackson pratt patient 73693 had on last month/10? ### Input: CREATE TABLE d_items ( r...