instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
when was the last time that patient 6170 got a urine out foley output today?
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 admissions ( row_id number, subject_id number, hadm_id number, admittime time, ...
SELECT outputevents.charttime 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 = 6170)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when was the last time that patient 6170 got a urine out foley output today? ### Input: CREATE TABLE d_items ( row_id nu...
Which ULCS requirement courses are available in the Fall or Winter
CREATE TABLE semester ( semester_id int, semester varchar, year int ) CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar ) CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city...
SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.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: Which ULCS requirement courses are available in the Fall or Winter ### Input: CREATE TABLE semester ( semester_id int, ...
who is at the top of the chart ?
CREATE TABLE table_204_287 ( id number, "outcome" text, "no." number, "date" number, "championship" text, "surface" text, "opponent in the final" text, "score in the final" text )
SELECT "opponent in the final" FROM table_204_287 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: who is at the top of the chart ? ### Input: CREATE TABLE table_204_287 ( id number, "outcome" text, "no." number...
what were the five most common diagnoses among the patients in the 30s in 2105?
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 t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', diagnosis.diagnosistime) = '2105' GROUP BY diagnosis.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 were the five most common diagnoses among the patients in the 30s in 2105? ### Input: CREATE TABLE patient ( unique...
how many patients had been staying in ward 49 since 2105?
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABL...
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.wardid = 49 AND STRFTIME('%y', transfers.intime) >= '2105')
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients had been staying in ward 49 since 2105? ### Input: CREATE TABLE inputevents_cv ( row_id number, su...
count the number of patients whose marital status is married and drug route is tp?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "MARRIED" AND prescriptions.route = "TP"
Below are sql tables 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 marital status is married and drug route is tp? ### Input: CREATE TABLE demographic ( ...
For each bed type, find the average room price Show bar chart, and show in desc by the total number.
CREATE TABLE Reservations ( Code INTEGER, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate REAL, LastName TEXT, FirstName TEXT, Adults INTEGER, Kids INTEGER ) CREATE TABLE Rooms ( RoomId TEXT, roomName TEXT, beds INTEGER, bedType TEXT, maxOccupancy INTEGER, baseP...
SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType ORDER BY AVG(basePrice) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For each bed type, find the average room price Show bar chart, and show in desc by the total number. ### Input: CREATE TABLE...
information on AA from FORT WORTH texas to PHILADELPHIA
CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length in...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_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: information on AA from FORT WORTH texas to PHILADELPHIA ### Input: CREATE TABLE airline ( airline_code varchar, airl...
count how many times patient 031-23605 came in to icu during the last hospital visit.
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 COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-23605' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime DESC LIMIT 1)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count how many times patient 031-23605 came in to icu during the last hospital visit. ### Input: CREATE TABLE cost ( cos...
Name the high rebounds for record 10-19
CREATE TABLE table_23274514_5 ( high_rebounds VARCHAR, record VARCHAR )
SELECT high_rebounds FROM table_23274514_5 WHERE record = "10-19"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Name the high rebounds for record 10-19 ### Input: CREATE TABLE table_23274514_5 ( high_rebounds VARCHAR, record VAR...
how many students are in each department?
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE...
SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many students are in each department? ### Input: CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(1...
How many students are there?
CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE has_allergy ( stuid number, allergy text ) CREATE TABLE allergy_type ( allergy text, allergytype text )
SELECT COUNT(*) FROM student
Below are sql tables 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 students are there? ### Input: CREATE TABLE student ( stuid number, lname text, fname text, age num...
What Position has no College Hall of Fame?
CREATE TABLE table_34311 ( "Position" text, "Name" text, "School" text, "Unanimous" text, "College Hall of Fame" text )
SELECT "Position" FROM table_34311 WHERE "College Hall of Fame" = 'no'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What Position has no College Hall of Fame? ### Input: CREATE TABLE table_34311 ( "Position" text, "Name" text, "...
What Time/Retired has a Laps of 86 and the Team of HVM Racing?
CREATE TABLE table_34053 ( "Driver" text, "Team" text, "Laps" real, "Time/Retired" text, "Grid" real, "Points" real )
SELECT "Time/Retired" FROM table_34053 WHERE "Laps" = '86' AND "Team" = 'hvm racing'
Below are sql tables 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 Time/Retired has a Laps of 86 and the Team of HVM Racing? ### Input: CREATE TABLE table_34053 ( "Driver" text, ...
Bar graph to show the number of customer details from different customer details, and list in desc by the names.
CREATE TABLE Residents_Services ( resident_id INTEGER, service_id INTEGER, date_moved_in DATETIME, property_id INTEGER, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR(255) ) CREATE TABLE Timed_Status_of_Things ( thing_id INTEGER, Date_and_Date DATETIME, S...
SELECT customer_details, COUNT(customer_details) FROM Customers GROUP BY customer_details ORDER BY customer_details 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: Bar graph to show the number of customer details from different customer details, and list in desc by the names. ### Input: ...
What is the Country of the Player with a Score of 69-71-66=206?
CREATE TABLE table_45149 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "Country" FROM table_45149 WHERE "Score" = '69-71-66=206'
Below are sql tables 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 Country of the Player with a Score of 69-71-66=206? ### Input: CREATE TABLE table_45149 ( "Place" text, ...
give me the number of patients who were diagnosed under icd9 code 76528 and also their lab test category is chemistry.
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 = "76528" AND lab."CATEGORY" = "Chemistry"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients who were diagnosed under icd9 code 76528 and also their lab test category is chemistry. ### I...
How many golds have a bronze greater than 1, a silver greater than 1, with total as the rank?
CREATE TABLE table_name_61 ( gold VARCHAR, rank VARCHAR, bronze VARCHAR, silver VARCHAR )
SELECT COUNT(gold) FROM table_name_61 WHERE bronze > 1 AND silver > 1 AND rank = "total"
Below are sql tables 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 golds have a bronze greater than 1, a silver greater than 1, with total as the rank? ### Input: CREATE TABLE table_...
What is Lost, when Points For is '257'?
CREATE TABLE table_name_11 ( lost VARCHAR, points_for VARCHAR )
SELECT lost FROM table_name_11 WHERE points_for = "257"
Below are sql tables 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 Lost, when Points For is '257'? ### Input: CREATE TABLE table_name_11 ( lost VARCHAR, points_for VARCHAR ) #...
What is the highest value for Byes, when Against is less than 1794, when Losses is '6', and when Draws is less than 0?
CREATE TABLE table_60207 ( "Benalla DFL" text, "Wins" real, "Losses" real, "Draws" real, "Byes" real, "Against" real )
SELECT MAX("Byes") FROM table_60207 WHERE "Against" < '1794' AND "Losses" = '6' AND "Draws" < '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 highest value for Byes, when Against is less than 1794, when Losses is '6', and when Draws is less than 0? ### I...
what is the number of patients whose drug code is metl25?
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 prescriptions.formulary_drug_cd = "METL25"
Below are sql tables 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 drug code is metl25? ### Input: CREATE TABLE diagnoses ( subject_id text, hadm_...
Show different nationalities along with the number of hosts of each nationality.
CREATE TABLE HOST ( Nationality VARCHAR )
SELECT Nationality, COUNT(*) FROM HOST GROUP BY Nationality
Below are sql tables 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. ### Input: CREATE TABLE HOST ( National...
what was the organism found in patient 025-19271's last microbiology test of the urine, catheter specimen until 09/2105?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE intakeoutput ( i...
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-19271')) AND microlab.culturesite = 'urine, catheter specimen' AND 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: what was the organism found in patient 025-19271's last microbiology test of the urine, catheter specimen until 09/2105? ###...
Over the next year , which courses is Prof. Rachel Rinaldo teaching ?
CREATE TABLE gsi ( course_offering_id int, student_id int ) 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 requirement (...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor, semester WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Rachel Rinaldo%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.of...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Over the next year , which courses is Prof. Rachel Rinaldo teaching ? ### Input: CREATE TABLE gsi ( course_offering_id i...
What is the latitude and longitude for Surveyor 3?
CREATE TABLE table_name_87 ( lat___lon VARCHAR, us_mission VARCHAR )
SELECT lat___lon FROM table_name_87 WHERE us_mission = "surveyor 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: What is the latitude and longitude for Surveyor 3? ### Input: CREATE TABLE table_name_87 ( lat___lon VARCHAR, us_mis...
Group by all acc road, show the team id and acc percent in a scatter plot.
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT Team_ID, ACC_Percent FROM basketball_match GROUP BY ACC_Road
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Group by all acc road, show the team id and acc percent in a scatter plot. ### Input: CREATE TABLE basketball_match ( Te...
Which of the highest drawn has a played less than 10?
CREATE TABLE table_name_96 ( drawn INTEGER, played INTEGER )
SELECT MAX(drawn) FROM table_name_96 WHERE played < 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: Which of the highest drawn has a played less than 10? ### Input: CREATE TABLE table_name_96 ( drawn INTEGER, played ...
give me the number of patients whose admission type is newborn and drug route is both eyes?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "NEWBORN" AND prescriptions.route = "BOTH EYES"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients whose admission type is newborn and drug route is both eyes? ### Input: CREATE TABLE procedur...
Return each apartment type code along with the maximum and minimum number of rooms among each type.
CREATE TABLE apartment_facilities ( apt_id number, facility_code text ) CREATE TABLE apartment_buildings ( building_id number, building_short_name text, building_full_name text, building_description text, building_address text, building_manager text, building_phone text ) CREATE TA...
SELECT apt_type_code, MAX(room_count), MIN(room_count) FROM apartments 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: Return each apartment type code along with the maximum and minimum number of rooms among each type. ### Input: CREATE TABLE ...
list patient identifications of patients who were diagnosed with hx-rectal & anal malign in 2101.
CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT admissions.subject_id FROM admissions WHERE admissions.hadm_id IN (SELECT diagnoses_icd.hadm_id FROM diagnoses_icd WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'hx-rectal & anal malign') AND STRFTIME('%y', diagnoses_icd.charttime) = '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: list patient identifications of patients who were diagnosed with hx-rectal & anal malign in 2101. ### Input: CREATE TABLE ou...
What was the home team's score when Geelong was the away team?
CREATE TABLE table_name_1 ( home_team VARCHAR, away_team VARCHAR )
SELECT home_team AS score FROM table_name_1 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 was the home team's score when Geelong was the away team? ### Input: CREATE TABLE table_name_1 ( home_team VARCHAR,...
Where was the game with a score of 13.13 (91) played?
CREATE TABLE table_55683 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Venue" FROM table_55683 WHERE "Away team score" = '13.13 (91)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Where was the game with a score of 13.13 (91) played? ### Input: CREATE TABLE table_55683 ( "Home team" text, "Home ...
Scatterplot of school_id vs team id by ACC_Home
CREATE TABLE basketball_match ( Team_ID int, School_ID int, Team_Name text, ACC_Regular_Season text, ACC_Percent text, ACC_Home text, ACC_Road text, All_Games text, All_Games_Percent int, All_Home text, All_Road text, All_Neutral text ) CREATE TABLE university ( Scho...
SELECT Team_ID, School_ID FROM basketball_match GROUP BY ACC_Home
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Scatterplot of school_id vs team id by ACC_Home ### Input: CREATE TABLE basketball_match ( Team_ID int, School_ID in...
In HISTORY 497 which section is after 17:15 A.M. ?
CREATE TABLE area ( course_id int, area varchar ) CREATE TABLE ta ( campus_job_id int, student_id int, location varchar ) CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requi...
SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '17:15' AND course.course_id = course_offering.course_id AND course.department = 'HISTORY' AND course.number = 497 AND semester.semester = 'WN' A...
Below are sql tables 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 HISTORY 497 which section is after 17:15 A.M. ? ### Input: CREATE TABLE area ( course_id int, area varchar ) CRE...
Show the number of games for each away team in a bar chart.
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 Away_team, COUNT(Away_team) FROM game GROUP BY Away_team
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the number of games for each away team in a bar chart. ### Input: CREATE TABLE game ( stadium_id int, id int, ...
Find the number of ethnically white russian patients born before the year 1846.
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 WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.dob_year < "1846"
Below are sql tables 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 ethnically white russian patients born before the year 1846. ### Input: CREATE TABLE prescriptions ( ...
how much patient 18457 weighs on their last hospital encounter for the first 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, last_wardid number, intime time, outtime time ) CREATE TABLE inputevents_cv ( row_id number, subject_id 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 = 18457 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime DESC LIMIT 1)) AND chartevent...
Below are sql tables 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 patient 18457 weighs on their last hospital encounter for the first time? ### Input: CREATE TABLE icustays ( ro...
how many students are in each department?, order X from low to high order.
CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE classroom ( building varchar(15), room_number varchar(7), capacity numeric(4,0) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), ...
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY dept_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: how many students are in each department?, order X from low to high order. ### Input: CREATE TABLE instructor ( ID varch...
What is the To par and holds the t8 place of the United States player Tiger Woods?
CREATE TABLE table_68086 ( "Place" text, "Player" text, "Country" text, "Score" real, "To par" text )
SELECT "To par" FROM table_68086 WHERE "Country" = 'united states' AND "Place" = 't8' AND "Player" = 'tiger woods'
Below are sql tables 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 and holds the t8 place of the United States player Tiger Woods? ### Input: CREATE TABLE table_68086 ( ...
For AOSS 320 , which prerequisites have I already completed ?
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 gsi ( course_offering_id int, student_id int ) CREATE TABLE instructor ( ...
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite, student_record WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'AOSS' AND COURSE_1.number = ...
Below are sql tables 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 AOSS 320 , which prerequisites have I already completed ? ### Input: CREATE TABLE student_record ( student_id int, ...
Which Total has an FA Cup goals of 1, and a League goals of 4 + 7?
CREATE TABLE table_43815 ( "Club" text, "League goals" text, "FA Cup goals" text, "League Cup goals" text, "Total" real )
SELECT AVG("Total") FROM table_43815 WHERE "FA Cup goals" = '1' AND "League goals" = '4 + 7'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which Total has an FA Cup goals of 1, and a League goals of 4 + 7? ### Input: CREATE TABLE table_43815 ( "Club" text, ...
Find the first names of the faculty members who participate in Canoeing and Kayaking.
CREATE TABLE participates_in ( stuid number, actid number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE faculty...
SELECT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WH...
Below are sql tables 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 first names of the faculty members who participate in Canoeing and Kayaking. ### Input: CREATE TABLE participates_i...
Show first name and last name for all the students advised by Michael Goodrich.
CREATE TABLE Faculty ( FacID VARCHAR, fname VARCHAR, lname VARCHAR ) CREATE TABLE Student ( fname VARCHAR, lname VARCHAR, advisor VARCHAR )
SELECT T2.fname, T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Below are sql tables 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 first name and last name for all the students advised by Michael Goodrich. ### Input: CREATE TABLE Faculty ( FacID ...
Return a bar chart on how many departments are in each school?
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CR...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT
Below are sql tables 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 departments are in each school? ### Input: CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_L...
What is the Region with a Catalog that is vlmx 1087-3?
CREATE TABLE table_41131 ( "Region" text, "Date" text, "Label" text, "Format" text, "Catalog" text )
SELECT "Region" FROM table_41131 WHERE "Catalog" = 'vlmx 1087-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: What is the Region with a Catalog that is vlmx 1087-3? ### Input: CREATE TABLE table_41131 ( "Region" text, "Date" t...
had the heart rate of patient 31854 been greater in 12/this year than 108.0?
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 d_labitems ( row_id number, itemid number, label text ) CREATE TABLE microbiologyeve...
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 = 31854)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' 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: had the heart rate of patient 31854 been greater in 12/this year than 108.0? ### Input: CREATE TABLE d_items ( row_id nu...
Who was featured in 20 questions on 4-03?
CREATE TABLE table_1566852_4 ( date VARCHAR )
SELECT 20 AS _questions FROM table_1566852_4 WHERE date = "4-03"
Below are sql tables 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 featured in 20 questions on 4-03? ### Input: CREATE TABLE table_1566852_4 ( date VARCHAR ) ### Response: SELECT ...
which parts have more than 2 faults? Show the part name and id.
CREATE TABLE Maintenance_Contracts ( maintenance_contract_id INTEGER, maintenance_contract_company_id INTEGER, contract_start_date DATETIME, contract_end_date DATETIME, other_contract_details VARCHAR(255) ) CREATE TABLE Fault_Log ( fault_log_entry_id INTEGER, asset_id INTEGER, recorded_...
SELECT T1.part_name, T1.part_id FROM Parts AS T1 JOIN Part_Faults AS T2 ON T1.part_id = T2.part_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: which parts have more than 2 faults? Show the part name and id. ### Input: CREATE TABLE Maintenance_Contracts ( maintena...
count the number of people who were prescribed lr within 2 months following a diagnosis of personal history of fall since 4 years ago.
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, itemid number, value number ) CREATE TABLE icustays ( row_id number, subj...
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 = 'personal history 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: count the number of people who were prescribed lr within 2 months following a diagnosis of personal history of fall since 4 ...
give me the flights from PHOENIX to MILWAUKEE on wednesday evening
CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text ) CREATE TABLE state ( state_code text, state_name text, country_name text ) CREATE T...
SELECT DISTINCT flight_id FROM flight WHERE (((flight_days IN (SELECT DAYSalias0.days_code FROM days AS DAYSalias0 WHERE DAYSalias0.day_name IN (SELECT DATE_DAYalias0.day_name FROM date_day AS DATE_DAYalias0 WHERE DATE_DAYalias0.day_number = 23 AND DATE_DAYalias0.month_number = 4 AND DATE_DAYalias0.year = 1991)) AND to...
Below are sql tables 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 flights from PHOENIX to MILWAUKEE on wednesday evening ### Input: CREATE TABLE restriction ( restriction_cod...
Show the type of school and the number of buses for each type in a bar chart, list x-axis in descending order.
CREATE TABLE driver ( Driver_ID int, Name text, Party text, Home_city text, Age int ) CREATE TABLE school ( School_ID int, Grade text, School text, Location text, Type text ) CREATE TABLE school_bus ( School_ID int, Driver_ID int, Years_Working int, If_full_time...
SELECT Type, COUNT(*) FROM school_bus AS T1 JOIN school AS T2 ON T1.School_ID = T2.School_ID GROUP BY T2.Type ORDER BY Type DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the type of school and the number of buses for each type in a bar chart, list x-axis in descending order. ### Input: CR...
List the number of the phone numbers of all employees, list in asc by the names please.
CREATE TABLE Album ( AlbumId integer, Title varchar(160), ArtistId integer ) CREATE TABLE InvoiceLine ( InvoiceLineId integer, InvoiceId integer, TrackId integer, UnitPrice decimal(10,2), Quantity integer ) CREATE TABLE Invoice ( InvoiceId integer, CustomerId integer, Invoi...
SELECT Phone, COUNT(Phone) FROM Employee GROUP BY Phone ORDER BY Phone
Below are sql tables 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 the phone numbers of all employees, list in asc by the names please. ### Input: CREATE TABLE Album ( ...
what was the name of procedure, that patient 51698 was first received during this year?
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 inputevents_cv ( row_id number, subject_id number, ...
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51698) AND DATETIME(procedures_icd.charttime, 'start of year') = 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 was the name of procedure, that patient 51698 was first received during this year? ### Input: CREATE TABLE icustays ( ...
who are the candidates with district being kansas 4
CREATE TABLE table_18673 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
SELECT "Candidates" FROM table_18673 WHERE "District" = 'Kansas 4'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: who are the candidates with district being kansas 4 ### Input: CREATE TABLE table_18673 ( "District" text, "Incumben...
count the number of patients whose admission type is emergency and lab test name is ld, body fluid?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "LD, Body Fluid"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of patients whose admission type is emergency and lab test name is ld, body fluid? ### Input: CREATE TABLE ...
give me the number of patients admitted before 2120 who were ordered urine albumin lab test.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2120" AND lab.label = "Albumin, Urine"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients admitted before 2120 who were ordered urine albumin lab test. ### Input: CREATE TABLE diagnos...
Who is the manufacturer for Henk Vd Lagemaat?
CREATE TABLE table_name_68 ( manufacturer VARCHAR, rider VARCHAR )
SELECT manufacturer FROM table_name_68 WHERE rider = "henk vd lagemaat"
Below are sql tables 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 manufacturer for Henk Vd Lagemaat? ### Input: CREATE TABLE table_name_68 ( manufacturer VARCHAR, rider VA...
Which Home team scored 6.11 (47)?
CREATE TABLE table_4703 ( "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_4703 WHERE "Home team score" = '6.11 (47)'
Below are sql tables 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 Home team scored 6.11 (47)? ### Input: CREATE TABLE table_4703 ( "Home team" text, "Home team score" text, ...
Which Extra points is the highest one that has a Player of herrnstein, and Points smaller than 30?
CREATE TABLE table_38931 ( "Player" text, "Touchdowns" real, "Extra points" real, "Field goals" real, "Points" real )
SELECT MAX("Extra points") FROM table_38931 WHERE "Player" = 'herrnstein' AND "Points" < '30'
Below are sql tables 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 Extra points is the highest one that has a Player of herrnstein, and Points smaller than 30? ### Input: CREATE TABLE t...
How many customers for different customer last name? Draw a bar chart, rank by the bar in desc.
CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHAR(20), customer_last_name VARCHAR(20), customer_address VARCHAR(255), customer_phone VARCHAR(255), customer_email VARCHAR(255), other_customer_details VARCHAR(255) ) CREATE TABLE Accounts ( account_id INTEGER, c...
SELECT customer_last_name, COUNT(customer_last_name) FROM Customers GROUP BY customer_last_name ORDER BY customer_last_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 customers for different customer last name? Draw a bar chart, rank by the bar in desc. ### Input: CREATE TABLE Cust...
How many mills of 'Grondzeiler' type are built in each year? Give me the trend, list in descending by the X-axis.
CREATE TABLE mill ( architect_id int, id int, location text, name text, type text, built_year int, notes text ) CREATE TABLE bridge ( architect_id int, id int, name text, location text, length_meters real, length_feet real ) CREATE TABLE architect ( id text, ...
SELECT built_year, COUNT(built_year) FROM mill WHERE type = 'Grondzeiler' ORDER BY built_year 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 mills of 'Grondzeiler' type are built in each year? Give me the trend, list in descending by the X-axis. ### Input:...
For all employees who have the letters D or S in their first name, show me about the change of commission_pct over hire_date in a line chart.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEP...
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, show me about the change of commission_pct over hire_date...
Who was the home team when grimsby town was the away team?
CREATE TABLE table_12654 ( "Tie no" text, "Home team" text, "Score" text, "Away team" text, "Date" text )
SELECT "Home team" FROM table_12654 WHERE "Away team" = 'grimsby town'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Who was the home team when grimsby town was the away team? ### Input: CREATE TABLE table_12654 ( "Tie no" text, "Hom...
Show first name, last name, age for all female students. Their sex is F.
CREATE TABLE Student ( Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Sex VARCHAR )
SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'
Below are sql tables 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 first name, last name, age for all female students. Their sex is F. ### Input: CREATE TABLE Student ( Fname VARCHAR...
calculate the difference between patient 9566's total amount of input and output on the current intensive care unit visit.
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 (SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9566) AND icustays.outtime IS NULL)) - (SELECT SUM(outputevents.value) FROM output...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: calculate the difference between patient 9566's total amount of input and output on the current intensive care unit visit. #...
how many patients are born before 2121 and followed the procedure biopsy of tonsils and adenoids?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2121" AND procedures.long_title = "Biopsy of tonsils and adenoids"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients are born before 2121 and followed the procedure biopsy of tonsils and adenoids? ### Input: CREATE TABLE pr...
How many games were against Furman?
CREATE TABLE table_23872 ( "Game" real, "Date" text, "Opponent" text, "Result" text, "Tar Heels points" real, "Opponents" real, "Record" text )
SELECT MAX("Game") FROM table_23872 WHERE "Opponent" = 'Furman'
Below are sql tables 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 games were against Furman? ### Input: CREATE TABLE table_23872 ( "Game" real, "Date" text, "Opponent" t...
How many faculty members do we have for each faculty rank Show bar chart, I want to list in asc by the Y.
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 Participates_in ( stuid INTEGER, actid INTEGER ) CREATE TABLE Activity ( actid INTEGER, acti...
SELECT Rank, COUNT(*) FROM Faculty GROUP BY Rank 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: How many faculty members do we have for each faculty rank Show bar chart, I want to list in asc by the Y. ### Input: CREATE ...
Who won the regular season when Maryland won the tournament?
CREATE TABLE table_22779004_1 ( regular_season_winner VARCHAR, tournament_winner VARCHAR )
SELECT regular_season_winner FROM table_22779004_1 WHERE tournament_winner = "Maryland"
Below are sql tables 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 regular season when Maryland won the tournament? ### Input: CREATE TABLE table_22779004_1 ( regular_season_w...
what is the number of patients whose admission year is less than 2151 and lab test category is chemistry?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2151" AND lab."CATEGORY" = "Chemistry"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the number of patients whose admission year is less than 2151 and lab test category is chemistry? ### Input: CREATE ...
give the number of patients whose drug name is ascorbic acid.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Ascorbic Acid"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give the number of patients whose drug name is ascorbic acid. ### Input: CREATE TABLE lab ( subject_id text, hadm_id...
How many courses for each teacher? Show me a stacked bar chart. The x-axis is teacher's first name and group by course description.
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), ...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION, EMP_FNAME
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many courses for each teacher? Show me a stacked bar chart. The x-axis is teacher's first name and group by course descr...
Who had high rebounds on May 1?
CREATE TABLE table_39432 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Series" text )
SELECT "High rebounds" FROM table_39432 WHERE "Date" = 'may 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: Who had high rebounds on May 1? ### Input: CREATE TABLE table_39432 ( "Game" real, "Date" text, "Team" text, ...
Scatterplot of customer_id vs card id by card_type_code
CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHAR(15), transaction_date DATETIME, transaction_amount DOUBLE, transaction_comment VARCHAR(255), other_transaction_details VARCHAR(...
SELECT card_id, customer_id FROM Customers_Cards GROUP BY card_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: Scatterplot of customer_id vs card id by card_type_code ### Input: CREATE TABLE Financial_Transactions ( transaction_id ...
Draw a bar chart for what is the average age for each gender?, and could you show by the Y from low to high 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 gender, AVG(age) FROM Person GROUP BY gender 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: Draw a bar chart for what is the average age for each gender?, and could you show by the Y from low to high please? ### Inpu...
R Questions with no answers and no comments.
CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, ...
SELECT p.Id AS "post_link", p.Score, CreationDate FROM Posts AS p INNER JOIN PostTags AS pt ON p.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE p.PostTypeId = 1 AND p.Score >= 2 AND p.ClosedDate IS NULL AND COALESCE(p.AnswerCount, 0) = 0 AND COALESCE(p.CommentCount, 0) = 0 AND t.TagName = 'r' AND Deletion...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: R Questions with no answers and no comments. ### Input: CREATE TABLE CloseReasonTypes ( Id number, Name text, De...
Show all party names and the number of members in each party with a bar chart.
CREATE TABLE party ( Party_ID int, Minister text, Took_office text, Left_office text, Region_ID int, Party_name text ) CREATE TABLE region ( Region_ID int, Region_name text, Date text, Label text, Format text, Catalogue text ) CREATE TABLE member ( Member_ID int, ...
SELECT Party_name, COUNT(*) FROM member AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_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: Show all party names and the number of members in each party with a bar chart. ### Input: CREATE TABLE party ( Party_ID ...
For all employees who have the letters D or S in their first name, find hire_date and the average of salary bin hire_date by weekday, and visualize them by a bar chart.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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), ...
SELECT HIRE_DATE, AVG(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, find hire_date and the average of salary bin hire_date by...
Does 203 have classes on Friday when Prof. Korey Sewell teaches it ?
CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar ) CREATE TABLE course...
SELECT COUNT(*) = 0 FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN offering_instructor ON offering_instructor.offering_id = course_offering.offering_id INNER JOIN instructor ON offering_instructor.instructor_id = instructor.instructor_id WHERE course.number = 203 AND 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: Does 203 have classes on Friday when Prof. Korey Sewell teaches it ? ### Input: CREATE TABLE instructor ( instructor_id ...
What's the total number of bronze medals for Sweden (SWE) having less than 1 gold and silver?
CREATE TABLE table_79719 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real )
SELECT COUNT("Bronze") FROM table_79719 WHERE "Gold" < '1' AND "Nation" = 'sweden (swe)' AND "Silver" < '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's the total number of bronze medals for Sweden (SWE) having less than 1 gold and silver? ### Input: CREATE TABLE table_...
Tell me the degree for chemistry 1965
CREATE TABLE table_name_90 ( degree VARCHAR, award_year VARCHAR, award VARCHAR )
SELECT degree FROM table_name_90 WHERE award_year = 1965 AND award = "chemistry"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Tell me the degree for chemistry 1965 ### Input: CREATE TABLE table_name_90 ( degree VARCHAR, award_year VARCHAR, ...
Draw a bar chart about the distribution of Name and Height , and list by the Name from high to low.
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 Name, Height FROM people ORDER BY 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: Draw a bar chart about the distribution of Name and Height , and list by the Name from high to low. ### Input: CREATE TABLE ...
What are the names of catalog entries with level number 8, and count them by a bar chart, and rank Y in asc order.
CREATE TABLE Catalog_Contents_Additional_Attributes ( catalog_entry_id INTEGER, catalog_level_number INTEGER, attribute_id INTEGER, attribute_value VARCHAR(255) ) CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, previous_en...
SELECT catalog_entry_name, COUNT(catalog_entry_name) FROM Catalog_Contents AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.catalog_entry_id = t2.catalog_entry_id WHERE t2.catalog_level_number = "8" GROUP BY catalog_entry_name ORDER BY COUNT(catalog_entry_name)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What are the names of catalog entries with level number 8, and count them by a bar chart, and rank Y in asc order. ### Input...
what was the name of that allergy that patient 030-40287 had.
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE medication ( medication...
SELECT allergy.allergyname FROM allergy WHERE allergy.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-40287'))
Below are sql tables 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 that allergy that patient 030-40287 had. ### Input: CREATE TABLE microlab ( microlabid number, ...
what is the two year survival rate of hyperosmolality patients who were prescribed acetaminophen?
CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE proced...
SELECT SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t4.charttime) > 2 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.subject_id, t2.charttime FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd...
Below are sql tables 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 two year survival rate of hyperosmolality patients who were prescribed acetaminophen? ### Input: CREATE TABLE di...
What is the nickname of the team who was in the GFL from 1986-1988?
CREATE TABLE table_60138 ( "Club" text, "Nickname" text, "Location" text, "GFL Premierships" text, "Years in GFL" text )
SELECT "Nickname" FROM table_60138 WHERE "Years in GFL" = '1986-1988'
Below are sql tables 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 nickname of the team who was in the GFL from 1986-1988? ### Input: CREATE TABLE table_60138 ( "Club" text, ...
give the number of patients whose admission type is emergency and ethnicity is american indian/alaska native.
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.admission_type = "EMERGENCY" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give the number of patients whose admission type is emergency and ethnicity is american indian/alaska native. ### Input: CRE...
Record of 16 29 is how many attendance?
CREATE TABLE table_35974 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text )
SELECT "Attendance" FROM table_35974 WHERE "Record" = '16–29'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Record of 16 29 is how many attendance? ### Input: CREATE TABLE table_35974 ( "Date" text, "Opponent" text, "Sco...
You can give me a bar chart, that groups and counts the country name.
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT COUNTRY_NAME, COUNT(COUNTRY_NAME) FROM countries GROUP BY COUNTRY_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: You can give me a bar chart, that groups and counts the country name. ### Input: CREATE TABLE departments ( DEPARTMENT_I...
What theme placed as #3 in the finale?
CREATE TABLE table_452 ( "Episode" text, "Theme" text, "Song choice" text, "Original artist" text, "Order #" text, "Result" text )
SELECT "Result" FROM table_452 WHERE "Theme" = 'Finale' AND "Order #" = '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: What theme placed as #3 in the finale? ### Input: CREATE TABLE table_452 ( "Episode" text, "Theme" text, "Song c...
Find the number of users in each role. Plot them as bar chart.
CREATE TABLE Roles ( role_code VARCHAR(15), role_description VARCHAR(80) ) CREATE TABLE Document_Sections ( section_id INTEGER, document_code VARCHAR(15), section_sequence INTEGER, section_code VARCHAR(20), section_title VARCHAR(80) ) CREATE TABLE Document_Sections_Images ( section_id ...
SELECT role_code, COUNT(*) FROM Users GROUP BY role_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 users in each role. Plot them as bar chart. ### Input: CREATE TABLE Roles ( role_code VARCHAR(15), ...
Which venue did the home team score 14.23 (107)?
CREATE TABLE table_56236 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Venue" FROM table_56236 WHERE "Home team score" = '14.23 (107)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which venue did the home team score 14.23 (107)? ### Input: CREATE TABLE table_56236 ( "Home team" text, "Home team ...
what is the number of days since patient 012-20116 first received a procedure on this hospital visit?
CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE diagnosis ( diagnosisid...
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', treatment.treatmenttime)) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-20116'...
Below are sql tables 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 days since patient 012-20116 first received a procedure on this hospital visit? ### Input: CREATE TABL...
What was the record when the score was w 108 93 (ot)?
CREATE TABLE table_18885 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
SELECT "Record" FROM table_18885 WHERE "Score" = 'W 108–93 (OT)'
Below are sql tables 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 when the score was w 108 93 (ot)? ### Input: CREATE TABLE table_18885 ( "Game" real, "Date" text...
exactly how much is patient 015-46307's weight change last measured on the first hospital visit compared to the first value measured on the first hospital visit?
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 microlab ( microl...
SELECT (SELECT patient.admissionweight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-46307' AND NOT patient.hospitaldischargetime IS NULL ORDER BY patient.hospitaladmittime LIMIT 1) AND NOT patient.admissionweight IS NULL OR...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: exactly how much is patient 015-46307's weight change last measured on the first hospital visit compared to the first value ...
how many patients aged below 41 had abnormal lab test results?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab.flag = "abnormal"
Below are sql tables 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 aged below 41 had abnormal lab test results? ### Input: CREATE TABLE prescriptions ( subject_id text, ...
Which home team corresponds to an away team score of 10.12 (72)?
CREATE TABLE table_33794 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Home team" FROM table_33794 WHERE "Away team score" = '10.12 (72)'
Below are sql tables 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 home team corresponds to an away team score of 10.12 (72)? ### Input: CREATE TABLE table_33794 ( "Home team" text,...
What is the most points when the chassis was Jaguar R3 later than 2002?
CREATE TABLE table_68991 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
SELECT MAX("Points") FROM table_68991 WHERE "Chassis" = 'jaguar r3' AND "Year" > '2002'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the most points when the chassis was Jaguar R3 later than 2002? ### Input: CREATE TABLE table_68991 ( "Year" rea...
Visualize a bar chart for how many students are in each department?, and show in descending by the names.
CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), ...
SELECT dept_name, COUNT(*) FROM student GROUP BY dept_name ORDER BY dept_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 how many students are in each department?, and show in descending by the names. ### Input: CREATE ...
What is the average crowd to watch Hawthorn as the away team?
CREATE TABLE table_name_29 ( crowd INTEGER, away_team VARCHAR )
SELECT AVG(crowd) FROM table_name_29 WHERE away_team = "hawthorn"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the average crowd to watch Hawthorn as the away team? ### Input: CREATE TABLE table_name_29 ( crowd INTEGER, ...