instruction
stringlengths
11
303
input
stringlengths
38
5.51k
output
stringlengths
25
1.92k
text
stringlengths
321
6.52k
let me know the number of patients less than 83 years who stayed in hospital for more than 6 days.
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 WHERE demographic.age < "83" AND demographic.days_stay > "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: let me know the number of patients less than 83 years who stayed in hospital for more than 6 days. ### Input: CREATE TABLE p...
Name the viewers for production code for 3x6704
CREATE TABLE table_24932 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" text, "U.S. viewers (million)" text )
SELECT "U.S. viewers (million)" FROM table_24932 WHERE "Production code" = '3X6704'
Below are sql tables 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 viewers for production code for 3x6704 ### Input: CREATE TABLE table_24932 ( "No. in series" real, "No. in ...
Attendance of 35,842 had what date?
CREATE TABLE table_name_77 ( date VARCHAR, attendance VARCHAR )
SELECT date FROM table_name_77 WHERE attendance = "35,842"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Attendance of 35,842 had what date? ### Input: CREATE TABLE table_name_77 ( date VARCHAR, attendance VARCHAR ) ### R...
Who are the candidates in the race where Wright Patman is the incumbent?
CREATE TABLE table_1342315_42 ( candidates VARCHAR, incumbent VARCHAR )
SELECT candidates FROM table_1342315_42 WHERE incumbent = "Wright Patman"
Below are sql tables 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 in the race where Wright Patman is the incumbent? ### Input: CREATE TABLE table_1342315_42 ( cand...
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and commission_pct , and visualize them by a bar chart, and rank bar in ascending order.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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)...
SELECT FIRST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY FIRST_NAME
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and comm...
Name the score for september 12, 1993
CREATE TABLE table_name_34 ( score VARCHAR, date VARCHAR )
SELECT score FROM table_name_34 WHERE date = "september 12, 1993"
Below are sql tables 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 score for september 12, 1993 ### Input: CREATE TABLE table_name_34 ( score VARCHAR, date VARCHAR ) ### Resp...
Of the NAVARCH classes offered this Fall , which are considered upper-level ?
CREATE TABLE gsi ( course_offering_id int, student_id int ) CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar ) CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int ) CREATE TABLE instructor ( instructo...
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course.course_id = course_offering.course_id AND course.department = 'NAVARCH' AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'Fal...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Of the NAVARCH classes offered this Fall , which are considered upper-level ? ### Input: CREATE TABLE gsi ( course_offer...
when patient 18841 the last year first received a procedure?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE d_items ( row_id number, itemid ...
SELECT procedures_icd.charttime FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 18841) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY procedures_icd.charttime LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: when patient 18841 the last year first received a procedure? ### Input: CREATE TABLE procedures_icd ( row_id number, ...
Top users per tag in Sweden.
CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", TagName, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Top users per tag in Sweden. ### Input: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, Us...
count the number of patients whose discharge location is left against medical advi and procedure icd9 code is 3808?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI" AND procedures.icd9_code = "3808"
Below are sql tables 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 discharge location is left against medical advi and procedure icd9 code is 3808? ### Inpu...
Show the name and service for all trains in order by time.
CREATE TABLE train ( name VARCHAR, service VARCHAR, TIME VARCHAR )
SELECT name, service FROM train ORDER BY TIME
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the name and service for all trains in order by time. ### Input: CREATE TABLE train ( name VARCHAR, service VAR...
which college had a running back player
CREATE TABLE table_20898602_1 ( college VARCHAR, position VARCHAR )
SELECT college FROM table_20898602_1 WHERE position = "Running back"
Below are sql tables 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 college had a running back player ### Input: CREATE TABLE table_20898602_1 ( college VARCHAR, position VARCHAR...
Which Date has an Attendance of 54,626?
CREATE TABLE table_48900 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text )
SELECT "Date" FROM table_48900 WHERE "Attendance" = '54,626'
Below are sql tables 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 Date has an Attendance of 54,626? ### Input: CREATE TABLE table_48900 ( "Week" real, "Date" text, "Opponen...
how many patients whose admission type is newborn and item id is 51276?
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.admission_type = "NEWBORN" AND lab.itemid = "51276"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose admission type is newborn and item id is 51276? ### Input: CREATE TABLE diagnoses ( subject_id t...
Who is the candidate with 73,494 votes?
CREATE TABLE table_8478 ( "Election" real, "Candidate" text, "Number of votes" text, "Share of votes" text, "Outcome of election" text )
SELECT "Candidate" FROM table_8478 WHERE "Number of votes" = '73,494'
Below are sql tables 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 candidate with 73,494 votes? ### Input: CREATE TABLE table_8478 ( "Election" real, "Candidate" text, ...
what is the number of patients with american indian/aslaska native ethnicity with procedure icd9 code 4575?
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 demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND procedures.icd9_code = "4575"
Below are sql tables 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 with american indian/aslaska native ethnicity with procedure icd9 code 4575? ### Input: CREAT...
Create a pie chart showing the number of payment method code across payment method code.
CREATE TABLE Customers ( customer_id INTEGER, payment_method_code VARCHAR(15), customer_number VARCHAR(20), customer_name VARCHAR(80), customer_address VARCHAR(255), customer_phone VARCHAR(80), customer_email VARCHAR(80) ) CREATE TABLE Products ( product_id INTEGER, product_type_cod...
SELECT payment_method_code, COUNT(payment_method_code) FROM Customers GROUP BY payment_method_code
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Create a pie chart showing the number of payment method code across payment method code. ### Input: CREATE TABLE Customers (...
give the minimum age of patients whose admission location is transfer within this facility and discharge location is home health care.
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.discharge_location = "HOME HEALTH CARE"
Below are sql tables 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 minimum age of patients whose admission location is transfer within this facility and discharge location is home he...
What date has a Home team score of 7.11 (53)?
CREATE TABLE table_52900 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT "Date" FROM table_52900 WHERE "Home team score" = '7.11 (53)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What date has a Home team score of 7.11 (53)? ### Input: CREATE TABLE table_52900 ( "Home team" text, "Home team sco...
how many patients whose discharge location is disch-tran to psych hosp and diagnoses short title is neonatal hypoglycemia?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND diagnoses.short_title = "Neonatal hypoglycemia"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose discharge location is disch-tran to psych hosp and diagnoses short title is neonatal hypoglycemia? #...
Closed and edited questions by month.
CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Bod...
SELECT TIME_TO_STR(e.CreationDate, '%M') AS "month", TIME_TO_STR(e.CreationDate, '%Y') AS "year", COUNT(DISTINCT e.PostId) AS closes FROM PostHistory AS c JOIN PostHistory AS e ON e.PostId = c.PostId WHERE c.CreationDate < e.CreationDate AND c.PostHistoryTypeId = 10 AND (e.PostHistoryTypeId = 4 OR e.PostHistoryTypeId =...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Closed and edited questions by month. ### Input: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, ...
The score in the final is 2 6, 6 2, 6 0, on what surface?
CREATE TABLE table_26202847_6 ( surface VARCHAR, score_in_the_final VARCHAR )
SELECT surface FROM table_26202847_6 WHERE score_in_the_final = "2–6, 6–2, 6–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: The score in the final is 2 6, 6 2, 6 0, on what surface? ### Input: CREATE TABLE table_26202847_6 ( surface VARCHAR, ...
What episode number in the series had a production code of bdf405?
CREATE TABLE table_28019988_5 ( series__number INTEGER, production_code VARCHAR )
SELECT MIN(series__number) FROM table_28019988_5 WHERE production_code = "BDF405"
Below are sql tables 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 episode number in the series had a production code of bdf405? ### Input: CREATE TABLE table_28019988_5 ( series__nu...
find the number of patients whose admission type is elective and lab test name is potassium, urine.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.label = "Potassium, 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: find the number of patients whose admission type is elective and lab test name is potassium, urine. ### Input: CREATE TABLE ...
Who is the head coach for the club from Estoril?
CREATE TABLE table_60067 ( "Club" text, "Head Coach" text, "City" text, "Stadium" text, "2003\u20132004 season" text )
SELECT "Head Coach" FROM table_60067 WHERE "City" = 'estoril'
Below are sql tables 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 head coach for the club from Estoril? ### Input: CREATE TABLE table_60067 ( "Club" text, "Head Coach" tex...
What series had a high points of Prince (23)?
CREATE TABLE table_name_32 ( series VARCHAR, high_points VARCHAR )
SELECT series FROM table_name_32 WHERE high_points = "prince (23)"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What series had a high points of Prince (23)? ### Input: CREATE TABLE table_name_32 ( series VARCHAR, high_points VA...
Return the number of music festivals of each category in a bar chart, could you show by the Y in asc?
CREATE TABLE artist ( Artist_ID int, Artist text, Age int, Famous_Title text, Famous_Release_date text ) CREATE TABLE volume ( Volume_ID int, Volume_Issue text, Issue_Date text, Weeks_on_Top real, Song text, Artist_ID int ) CREATE TABLE music_festival ( ID int, Musi...
SELECT Category, COUNT(*) FROM music_festival GROUP BY Category 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: Return the number of music festivals of each category in a bar chart, could you show by the Y in asc? ### Input: CREATE TABL...
Display a pie chart for how many players are from each country?
CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text ) CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Draft_Class text, College text ) CREATE TABLE playe...
SELECT Country_name, COUNT(*) FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country GROUP BY T1.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: Display a pie chart for how many players are from each country? ### Input: CREATE TABLE country ( Country_id int, Co...
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, display in ascending by the the average of salary.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varch...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about...
What is the total of crowd with Home team score of 14.12 (96)?
CREATE TABLE table_77896 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
SELECT SUM("Crowd") FROM table_77896 WHERE "Home team score" = '14.12 (96)'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What is the total of crowd with Home team score of 14.12 (96)? ### Input: CREATE TABLE table_77896 ( "Home team" text, ...
Show the average share count of transactions each each investor, ordered by average share count.
CREATE TABLE transactions ( transaction_id number, investor_id number, transaction_type_code text, date_of_transaction time, amount_of_transaction number, share_count text, other_details text ) CREATE TABLE purchases ( purchase_transaction_id number, purchase_details text ) CREATE ...
SELECT investor_id, AVG(share_count) FROM transactions GROUP BY investor_id ORDER BY AVG(share_count)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Show the average share count of transactions each each investor, ordered by average share count. ### Input: CREATE TABLE tra...
what is date of birth of subject id 65652?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT demographic.dob FROM demographic WHERE demographic.subject_id = "65652"
Below are sql tables 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 date of birth of subject id 65652? ### Input: CREATE TABLE prescriptions ( subject_id text, hadm_id text, ...
for a Goals Against greater than 42 what is the number of losses?
CREATE TABLE table_name_9 ( losses INTEGER, goals_against INTEGER )
SELECT AVG(losses) FROM table_name_9 WHERE goals_against > 42
Below are sql tables 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 a Goals Against greater than 42 what is the number of losses? ### Input: CREATE TABLE table_name_9 ( losses INTEGER,...
Who is the player from the United States with a score of 71-75=146?
CREATE TABLE table_50016 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text )
SELECT "Player" FROM table_50016 WHERE "Country" = 'united states' AND "Score" = '71-75=146'
Below are sql tables 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 player from the United States with a score of 71-75=146? ### Input: CREATE TABLE table_50016 ( "Place" text, ...
Return a histogram on what is average age of male for different job title?, I want to rank in asc by the Y-axis.
CREATE TABLE Person ( name varchar(20), age INTEGER, city TEXT, gender TEXT, job TEXT ) CREATE TABLE PersonFriend ( name varchar(20), friend varchar(20), year INTEGER )
SELECT job, AVG(age) FROM Person WHERE gender = 'male' GROUP BY job ORDER BY AVG(age)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Return a histogram on what is average age of male for different job title?, I want to rank in asc by the Y-axis. ### Input: ...
how many attended the 18 apr-68 match ?
CREATE TABLE table_204_350 ( id number, "date" text, "opponents" text, "venue" text, "result" text, "scorers" text, "attendance" number, "report 1" text, "report 2" text )
SELECT "attendance" FROM table_204_350 WHERE "date" = '18-apr-68'
Below are sql tables 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 attended the 18 apr-68 match ? ### Input: CREATE TABLE table_204_350 ( id number, "date" text, "opponen...
Return a pie on how many captains are in each rank?
CREATE TABLE Ship ( Ship_ID int, Name text, Type text, Built_Year real, Class text, Flag text ) CREATE TABLE captain ( Captain_ID int, Name text, Ship_ID int, age text, Class text, Rank text )
SELECT Rank, COUNT(*) FROM captain GROUP BY 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: Return a pie on how many captains are in each rank? ### Input: CREATE TABLE Ship ( Ship_ID int, Name text, Type ...
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and revenue , and group by attribute founder, sort by the X-axis in descending.
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 T1.Name, T2.Revenue FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder, T1.Name 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: For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and rev...
Bar graph to show the total number from different payment method code
CREATE TABLE Departments ( department_id INTEGER, dept_store_id INTEGER, department_name VARCHAR(80) ) CREATE TABLE Product_Suppliers ( product_id INTEGER, supplier_id INTEGER, date_supplied_from DATETIME, date_supplied_to DATETIME, total_amount_purchased VARCHAR(80), total_value_pu...
SELECT payment_method_code, COUNT(*) FROM Customers GROUP BY payment_method_code
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Bar graph to show the total number from different payment method code ### Input: CREATE TABLE Departments ( department_i...
What was the highest amount of episodes for the season with 5.74 million viewers?
CREATE TABLE table_25402 ( "Season" real, "Episodes" real, "Timeslot (ET)" text, "Season Premiere" text, "Season Finale" text, "TV Season" text, "Rank" text, "Viewers (in millions)" text )
SELECT MAX("Episodes") FROM table_25402 WHERE "Viewers (in millions)" = '5.74'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was the highest amount of episodes for the season with 5.74 million viewers? ### Input: CREATE TABLE table_25402 ( ...
give me the number of patients whose admission year is less than 2146 and item id is 51439?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2146" AND lab.itemid = "51439"
Below are sql tables 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 year is less than 2146 and item id is 51439? ### Input: CREATE TABLE lab ( ...
give me the number of patients whose marital status is married and ethnicity is asian?
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 WHERE demographic.marital_status = "MARRIED" AND demographic.ethnicity = "ASIAN"
Below are sql tables 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 marital status is married and ethnicity is asian? ### Input: CREATE TABLE procedures ( ...
Return the characteristic names of the 'sesame' product.
CREATE TABLE ref_product_categories ( product_category_code text, product_category_description text, unit_of_measure text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE ref_colors ( color_code text, ...
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Return the characteristic names of the 'sesame' product. ### Input: CREATE TABLE ref_product_categories ( product_catego...
what is the earliest flight that goes from ATLANTA to WASHINGTON on THURSDAY
CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) CREATE TABLE airline ( airline_code varchar, airline_name ...
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, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'WASHINGTON' AND days.day_name = 'THURSDAY' AND flight.flight_days = days.days_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: what is the earliest flight that goes from ATLANTA to WASHINGTON on THURSDAY ### Input: CREATE TABLE time_zone ( time_zo...
what was the levetiracetam dosage that patient 83709 was last prescribed since 66 months ago?
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 prescriptions ( row_id number, subject_id number, h...
SELECT prescriptions.dose_val_rx FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 83709) AND prescriptions.drug = 'levetiracetam' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-66 month') ORDER BY prescriptions.startdate DESC...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the levetiracetam dosage that patient 83709 was last prescribed since 66 months ago? ### Input: CREATE TABLE icusta...
count the number of patients whose age is less than 83 and diagnoses short title is pneumococcal pneumonia?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "83" AND diagnoses.short_title = "Pneumococcal pneumonia"
Below are sql tables 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 age is less than 83 and diagnoses short title is pneumococcal pneumonia? ### Input: CREAT...
What are the names of regions that were affected by the storm in which the most people died?
CREATE TABLE storm ( storm_id number, name text, dates_active text, max_speed number, damage_millions_usd number, number_deaths number ) CREATE TABLE affected_region ( region_id number, storm_id number, number_city_affected number ) CREATE TABLE region ( region_id number, r...
SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.number_deaths 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 are the names of regions that were affected by the storm in which the most people died? ### Input: CREATE TABLE storm (...
give me the time at which patient with patient id 81923 was admitted to hospital.
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 demographic.admittime FROM demographic WHERE demographic.subject_id = "81923"
Below are sql tables 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 time at which patient with patient id 81923 was admitted to hospital. ### Input: CREATE TABLE lab ( subject_...
what is the first ward identifier of patient 51663 until 3 years ago?
CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime t...
SELECT transfers.wardid FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 51663) AND NOT transfers.wardid IS NULL AND DATETIME(transfers.intime) <= DATETIME(CURRENT_TIME(), '-3 year') ORDER BY transfers.intime LIMIT 1
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what is the first ward identifier of patient 51663 until 3 years ago? ### Input: CREATE TABLE d_labitems ( row_id number...
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, I want to sort by the bar in desc.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0),...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_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 did not have any job in the past, visualize a bar chart about the distribution of job_id and the ave...
When did a Venue of Antigua Recreation Ground happen?
CREATE TABLE table_name_40 ( date VARCHAR, venue VARCHAR )
SELECT date FROM table_name_40 WHERE venue = "antigua recreation ground"
Below are sql tables 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 a Venue of Antigua Recreation Ground happen? ### Input: CREATE TABLE table_name_40 ( date VARCHAR, venue VA...
tell me the minimum total hospital cost that involves warfarin the last year?
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE v...
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'warfarin')) AND DATETIME(cost.chargetime, 'sta...
Below are sql tables 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 minimum total hospital cost that involves warfarin the last year? ### Input: CREATE TABLE cost ( costid numb...
What is the averag weights for people of each sex? Show a bar chart, and list bar in desc order.
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight re...
SELECT Sex, AVG(Weight) FROM people GROUP BY Sex ORDER BY Sex 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 is the averag weights for people of each sex? Show a bar chart, and list bar in desc order. ### Input: CREATE TABLE can...
Which Condition has a Bleeding time of unaffected, and a Partial thromboplastin time of prolonged, and a Prothrombin time of unaffected?
CREATE TABLE table_name_53 ( condition VARCHAR, prothrombin_time VARCHAR, bleeding_time VARCHAR, partial_thromboplastin_time VARCHAR )
SELECT condition FROM table_name_53 WHERE bleeding_time = "unaffected" AND partial_thromboplastin_time = "prolonged" AND prothrombin_time = "unaffected"
Below are sql tables 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 Condition has a Bleeding time of unaffected, and a Partial thromboplastin time of prolonged, and a Prothrombin time of...
how many of the patients were treated with nitroglycerin sl?
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 prescriptions.drug = "Nitroglycerin SL"
Below are sql tables 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 were treated with nitroglycerin sl? ### Input: CREATE TABLE prescriptions ( subject_id text, ...
List all the participant ids and their details using a bar chart.
CREATE TABLE Participants_in_Events ( Event_ID INTEGER, Participant_ID INTEGER ) CREATE TABLE Services ( Service_ID INTEGER, Service_Type_Code CHAR(15) ) CREATE TABLE Events ( Event_ID INTEGER, Service_ID INTEGER, Event_Details VARCHAR(255) ) CREATE TABLE Participants ( Participant_ID...
SELECT Participant_Details, Participant_ID FROM Participants
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: List all the participant ids and their details using a bar chart. ### Input: CREATE TABLE Participants_in_Events ( Event...
At 1:48.16 what was the number of track time?
CREATE TABLE table_1499 ( "Finish" text, "Race" text, "Distance" text, "Jockey" text, "Time" text, "Victory Margin (in lengths)" text, "Runner up" text, "Track" text, "Surface" text, "Date" text )
SELECT COUNT("Track") FROM table_1499 WHERE "Time" = '1:48.16'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: At 1:48.16 what was the number of track time? ### Input: CREATE TABLE table_1499 ( "Finish" text, "Race" text, "...
What player has a round larger than 6 with a D position.
CREATE TABLE table_name_82 ( player VARCHAR, round VARCHAR, position VARCHAR )
SELECT player FROM table_name_82 WHERE round > 6 AND position = "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 player has a round larger than 6 with a D position. ### Input: CREATE TABLE table_name_82 ( player VARCHAR, rou...
How many laps have a Time/Retired of +1:35.553?
CREATE TABLE table_name_84 ( laps VARCHAR, time_retired VARCHAR )
SELECT COUNT(laps) FROM table_name_84 WHERE time_retired = "+1:35.553"
Below are sql tables 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 laps have a Time/Retired of +1:35.553? ### Input: CREATE TABLE table_name_84 ( laps VARCHAR, time_retired V...
Which Prothrombin time has a Platelet count of unaffected, and a Bleeding time of unaffected, and a Partial thromboplastin time of normal or mildly prolonged?
CREATE TABLE table_74968 ( "Condition" text, "Prothrombin time" text, "Partial thromboplastin time" text, "Bleeding time" text, "Platelet count" text )
SELECT "Prothrombin time" FROM table_74968 WHERE "Platelet count" = 'unaffected' AND "Bleeding time" = 'unaffected' AND "Partial thromboplastin time" = 'normal or mildly prolonged'
Below are sql tables 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 Prothrombin time has a Platelet count of unaffected, and a Bleeding time of unaffected, and a Partial thromboplastin t...
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the amount of name , and group by attribute name.
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 T2.Name, COUNT(T2.Name) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the...
What is the magnitude with epicenter at Vrancea County, unknown intensity and which happened at 06:36?
CREATE TABLE table_name_67 ( magnitude VARCHAR, time__utc_ VARCHAR, epicenter VARCHAR, intensity VARCHAR )
SELECT magnitude FROM table_name_67 WHERE epicenter = "vrancea county" AND intensity = "unknown" AND time__utc_ = "06:36"
Below are sql tables 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 magnitude with epicenter at Vrancea County, unknown intensity and which happened at 06:36? ### Input: CREATE TAB...
when was the first time that , patient 030-10407 had the maximum of rdw?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-10407')) AND lab.labname = 'rdw' ORDER BY lab.labresult DESC, lab.labresulttime...
Below are sql tables 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 first time that , patient 030-10407 had the maximum of rdw? ### Input: CREATE TABLE microlab ( microlabid n...
count the number of times patient 027-28154 has received a calcium laboratory test until 3 years ago.
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE l...
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 = '027-28154')) AND lab.labname = 'calcium' AND DATETIME(lab.labresulttime) <= DATETIME(CURRENT...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count the number of times patient 027-28154 has received a calcium laboratory test until 3 years ago. ### Input: CREATE TABL...
on the first icu visit what was the minimum value of sao2 of patient 009-15?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE diagnosis ( diagnosisid num...
SELECT MIN(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-15') AND NOT patient.unitdischargetime IS NULL ORDER ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: on the first icu visit what was the minimum value of sao2 of patient 009-15? ### Input: CREATE TABLE microlab ( microlab...
Which courses are available after taking HJCS 277 ?
CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_proje...
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.course_id INNER JOIN course AS COURSE_1 ON COURSE_1.course_id = course_prerequisite.pre_course_id WHERE COURSE_1.department = 'HJCS' 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: Which courses are available after taking HJCS 277 ? ### Input: CREATE TABLE course_offering ( offering_id int, cours...
what was the name of the last intake of patient 002-58565 that they had on 02/09/last year?
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, ...
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-58565')) AND intakeoutput.cellpath LIKE '%intake%' AND D...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the name of the last intake of patient 002-58565 that they had on 02/09/last year? ### Input: CREATE TABLE intakeou...
how many patients whose gender is f and diagnoses icd9 code is 4271?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.gender = "F" AND diagnoses.icd9_code = "4271"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: how many patients whose gender is f and diagnoses icd9 code is 4271? ### Input: CREATE TABLE lab ( subject_id text, ...
When the Away team was south melbourne what was the home team?
CREATE TABLE table_52429 ( "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_52429 WHERE "Away team" = 'south melbourne'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: When the Away team was south melbourne what was the home team? ### Input: CREATE TABLE table_52429 ( "Home team" text, ...
which patients had emergency hospital admission?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "EMERGENCY"
Below are sql tables 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 patients had emergency hospital admission? ### Input: CREATE TABLE procedures ( subject_id text, hadm_id text,...
when did the first microbiology testing of patient 031-1337 take place since 18 months ago?
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number...
SELECT microlab.culturetakentime FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-1337')) AND DATETIME(microlab.culturetakentime) >= DATETIME(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: when did the first microbiology testing of patient 031-1337 take place since 18 months ago? ### Input: CREATE TABLE diagnosi...
For those records from the products and each product's manufacturer, find headquarter and the amount of headquarter , and group by attribute headquarter, and visualize them by a bar chart, display y axis in asc 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, COUNT(Headquarter) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY COUNT(Headquarter)
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: For those records from the products and each product's manufacturer, find headquarter and the amount of headquarter , and gr...
What airport has an ICAP of BGBW?
CREATE TABLE table_76249 ( "City" text, "Country" text, "IATA" text, "ICAO" text, "Airport" text )
SELECT "Airport" FROM table_76249 WHERE "ICAO" = 'bgbw'
Below are sql tables 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 airport has an ICAP of BGBW? ### Input: CREATE TABLE table_76249 ( "City" text, "Country" text, "IATA" text...
What was the original air date for season 11?
CREATE TABLE table_20704243_6 ( original_air_date VARCHAR, season__number VARCHAR )
SELECT original_air_date FROM table_20704243_6 WHERE season__number = 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 was the original air date for season 11? ### Input: CREATE TABLE table_20704243_6 ( original_air_date VARCHAR, ...
count how many intensive care unit visits patient 022-87224 until 2103.
CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9cod...
SELECT COUNT(DISTINCT patient.patientunitstayid) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-87224') AND STRFTIME('%y', patient.unitadmittime) <= '2103'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: count how many intensive care unit visits patient 022-87224 until 2103. ### Input: CREATE TABLE intakeoutput ( intakeout...
How many votes have a Seat of house A, and a Percentage of 75.44%, and a District smaller than 11?
CREATE TABLE table_name_52 ( vote VARCHAR, district VARCHAR, seat VARCHAR, percentage VARCHAR )
SELECT COUNT(vote) FROM table_name_52 WHERE seat = "house a" AND percentage = "75.44%" AND district < 11
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: How many votes have a Seat of house A, and a Percentage of 75.44%, and a District smaller than 11? ### Input: CREATE TABLE t...
Who was the second rider when papayero raced as Horse 1 in the city of rancagua?
CREATE TABLE table_name_2 ( rider_2 VARCHAR, city VARCHAR, horse_1 VARCHAR )
SELECT rider_2 FROM table_name_2 WHERE city = "rancagua" AND horse_1 = "papayero"
Below are sql tables 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 second rider when papayero raced as Horse 1 in the city of rancagua? ### Input: CREATE TABLE table_name_2 ( ...
Who directed the show that was viewed by 2.06 million U.S. people?
CREATE TABLE table_11694832_1 ( directed_by VARCHAR, us_viewers__millions_ VARCHAR )
SELECT directed_by FROM table_11694832_1 WHERE us_viewers__millions_ = "2.06"
Below are sql tables 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 show that was viewed by 2.06 million U.S. people? ### Input: CREATE TABLE table_11694832_1 ( directed_b...
What are the first names and ids for customers who have two or more accounts, and show by the y axis in asc please.
CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, production_type_code VARCHAR(15), unit_price DECIMAL(19,4), product_name VARCHAR(80), product_color VARCHAR(20), product_size VARCHAR(20) ) CREATE TABLE Customers ( customer_id INTEGER, customer_first_name VARCHA...
SELECT T2.customer_first_name, T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.customer_id
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What are the first names and ids for customers who have two or more accounts, and show by the y axis in asc please. ### Inpu...
give me the number of patients whose admission type is urgent and lab test fluid is blood?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.fluid = "Blood"
Below are sql tables 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 urgent and lab test fluid is blood? ### Input: CREATE TABLE lab ( ...
What's the Japanese title when the Romaji Title was Atsu-Hime?
CREATE TABLE table_14092 ( "Japanese Title" text, "Romaji Title" text, "TV Station" text, "Episodes" text, "Average Ratings" text )
SELECT "Japanese Title" FROM table_14092 WHERE "Romaji Title" = 'atsu-hime'
Below are sql tables 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 Japanese title when the Romaji Title was Atsu-Hime? ### Input: CREATE TABLE table_14092 ( "Japanese Title" te...
What's the Chinese (simplified/traditional) name of Susong County?
CREATE TABLE table_1976898_1 ( chinese_name__simplified___traditional_ VARCHAR, english_name VARCHAR )
SELECT chinese_name__simplified___traditional_ FROM table_1976898_1 WHERE english_name = "Susong County"
Below are sql tables 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 Chinese (simplified/traditional) name of Susong County? ### Input: CREATE TABLE table_1976898_1 ( chinese_nam...
Find the number of customers that use email as the contact channel for each weekday Visualize with a bar chart, list in descending by the y axis.
CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(15), customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255) ) CREATE TABLE Customer_Orders ( order_id INTEGER, customer_id INTEGER, order_status VARCHAR(15), order_date DATETI...
SELECT active_from_date, COUNT(active_from_date) FROM Customers AS t1 JOIN Customer_Contact_Channels AS t2 ON t1.customer_id = t2.customer_id WHERE t2.channel_code = 'Email' ORDER BY COUNT(active_from_date) DESC
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Find the number of customers that use email as the contact channel for each weekday Visualize with a bar chart, list in desc...
how many inpatient hospital admission patients have lab test item id 51181?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "51181"
Below are sql tables 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 inpatient hospital admission patients have lab test item id 51181? ### Input: CREATE TABLE procedures ( subject...
What opponent had an attendance of 63,659?
CREATE TABLE table_name_78 ( opponent_number VARCHAR, attendance VARCHAR )
SELECT opponent_number FROM table_name_78 WHERE attendance = "63,659"
Below are sql tables 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 opponent had an attendance of 63,659? ### Input: CREATE TABLE table_name_78 ( opponent_number VARCHAR, attendan...
what was the name of the drug that since 2 months ago patient 005-73237 was last prescribed?
CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime...
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-73237')) AND DATETIME(medication.drugstarttime) >= DATETIME(CUR...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: what was the name of the drug that since 2 months ago patient 005-73237 was last prescribed? ### Input: CREATE TABLE microla...
among patients on urgent admission, how many of them had a lab test for amylase and body fluid?
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 demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Amylase, 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: among patients on urgent admission, how many of them had a lab test for amylase and body fluid? ### Input: CREATE TABLE diag...
Top User Of a Peticular Tag In Iran.
CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, Rejectio...
WITH USER_BY_TAG AS (SELECT ROW_NUMBER() OVER (ORDER BY COUNT(*) DESC) AS Rank, u.Id AS "user_link", TagName, COUNT(*) AS UpVotes FROM Tags AS t INNER JOIN PostTags AS pt ON pt.TagId = t.Id INNER JOIN Posts AS p ON p.ParentId = pt.PostId INNER JOIN Votes AS v ON v.PostId = p.Id AND VoteTypeId = 2 INNER JOIN Users AS u ...
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Top User Of a Peticular Tag In Iran. ### Input: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name t...
how many of the patients had hemorrhage complicating a procedure?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Hemorrhage complicating a procedure"
Below are sql tables 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 had hemorrhage complicating a procedure? ### Input: CREATE TABLE diagnoses ( subject_id text, ...
What's the loss of who has a Save of Miguel Saladin and played against Chinatrust Whales?
CREATE TABLE table_name_56 ( loss VARCHAR, opponent VARCHAR, save VARCHAR )
SELECT loss FROM table_name_56 WHERE opponent = "chinatrust whales" AND save = "miguel saladin"
Below are sql tables 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 loss of who has a Save of Miguel Saladin and played against Chinatrust Whales? ### Input: CREATE TABLE table_name...
Which loss has a Record of 54-39?
CREATE TABLE table_68227 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Record" text )
SELECT "Loss" FROM table_68227 WHERE "Record" = '54-39'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: Which loss has a Record of 54-39? ### Input: CREATE TABLE table_68227 ( "Date" text, "Opponent" text, "Score" te...
What was South Melbourne's score when they played as the home team?
CREATE TABLE table_name_9 ( home_team VARCHAR )
SELECT home_team AS score FROM table_name_9 WHERE home_team = "south melbourne"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What was South Melbourne's score when they played as the home team? ### Input: CREATE TABLE table_name_9 ( home_team VAR...
Show me a bar chart about the number of races held in each year after 2014, could you list total number in descending order please?
CREATE TABLE drivers ( driverId INTEGER, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT ) CREATE TABLE pitStops ( raceId INTEGER, driverId INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT,...
SELECT year, COUNT(year) FROM races AS T1 JOIN results AS T2 ON T1.raceId = T2.raceId WHERE T1.year > 2014 GROUP BY year ORDER BY COUNT(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: Show me a bar chart about the number of races held in each year after 2014, could you list total number in descending order ...
what is maximum age of patients whose marital status is married and age is greater than or equal to 45?
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 MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "45"
Below are sql tables 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 maximum age of patients whose marital status is married and age is greater than or equal to 45? ### Input: CREATE TA...
give me the number of patients whose death status is 1 and primary disease is rash?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.diagnosis = "RASH"
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: give me the number of patients whose death status is 1 and primary disease is rash? ### Input: CREATE TABLE procedures ( ...
What home team played an away team of melbourne?
CREATE TABLE table_56000 ( "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_56000 WHERE "Away team" = 'melbourne'
Below are sql tables schemas paired with instruction that describes a task. Using valid SQLite, write a response that appropriately completes the request for the provided tables. ### Instruction: What home team played an away team of melbourne? ### Input: CREATE TABLE table_56000 ( "Home team" text, "Home team ...
Does CHE 528 only fulfill the general elective ?
CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_p...
SELECT DISTINCT program_course.category FROM course, program_course WHERE course.department = 'CHE' AND course.number = 528 AND program_course.course_id = course.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: Does CHE 528 only fulfill the general elective ? ### Input: CREATE TABLE course ( course_id int, name varchar, d...
can you show me what flights are available on 12 16 going from OAKLAND to DALLAS
CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar,...
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND date_day.day_number = 16 AND date_day.month_number = 12 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: can you show me what flights are available on 12 16 going from OAKLAND to DALLAS ### Input: CREATE TABLE fare_basis ( fa...
list of ids of patients diagnosed with gout nos during a year before.
CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, ...
SELECT 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 = 'gout nos') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETI...
Below are sql tables 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 of ids of patients diagnosed with gout nos during a year before. ### Input: CREATE TABLE inputevents_cv ( row_id nu...
what is the percentage of male voters where the level of maturity is 123726
CREATE TABLE table_27319 ( "Region" text, "Enrolled men" real, "Enrolled women" real, "Enrolled total" real, "Men of voting age" real, "Women of voting age" real, "Voting age population" real, "E/VAP ratio Men" text, "E/VAP ratio Women" text, "E/VAP ratio Total" text )
SELECT "E/VAP ratio Total" FROM table_27319 WHERE "Men of voting age" = '123726'
Below are sql tables 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 percentage of male voters where the level of maturity is 123726 ### Input: CREATE TABLE table_27319 ( "Regio...