instruction
stringlengths
11
446
input
stringlengths
195
2.3k
response
stringlengths
26
460
provide the number of patients whose death status is 0 and lab test name is ck-mb index.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "CK-MB Index"
Find the first and last name of the staff members who reported problems from the product 'rem' but not 'aut'?
CREATE TABLE staff ( staff_first_name VARCHAR, staff_last_name VARCHAR, staff_id VARCHAR ) CREATE TABLE problems ( product_id VARCHAR, reported_by_staff_id VARCHAR ) CREATE TABLE product ( product_name VARCHAR, product_id VARCHAR )
SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON T1.product_id = T2.product_id AND T1.reported_by_staff_id = T3.staff_id WHERE T2.product_name = "rem" EXCEPT SELECT T3.staff_first_name, T3.staff_last_name FROM problems AS T1 JOIN product AS T2 JOIN staff AS T3 ON...
count the number of patients whose year of birth is less than 2065 and procedure short title is skin closure nec?
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.dob_year < "2065" AND procedures.short_title = "Skin closure NEC"
What are the different pilot names who had piloted a flight in the country 'United States' or in the airport named 'Billund Airport'?
CREATE TABLE operate_company ( id number, name text, type text, principal_activities text, incorporated_in text, group_equity_shareholding number ) CREATE TABLE airport ( id number, city text, country text, iata text, icao text, name text ) CREATE TABLE flight ( id ...
SELECT DISTINCT T2.pilot FROM airport AS T1 JOIN flight AS T2 ON T1.id = T2.airport_id WHERE T1.country = 'United States' OR T1.name = 'Billund Airport'
how many of the patients admitted to emergency had icd9 code 5185?
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.admission_type = "EMERGENCY" AND procedures.icd9_code = "5185"
Show the number of courses each instructor taught in a stacked bar chart The x-axis is the instructor's first name and group by course code, list from high to low by the names.
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), ...
SELECT EMP_FNAME, COUNT(EMP_FNAME) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM GROUP BY CRS_CODE, EMP_FNAME ORDER BY EMP_FNAME DESC
Calculate the number of private insurance patients who have had other closed (endoscopic) biopsy of biliary duct or sphincter of oddi.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Other closed [endoscopic] biopsy of biliary duct or sphincter of Oddi"
What are the start date and end date of the apartment bookings made by female guests (gender code 'Female')?
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 TABLE apartments ( apt_id number, building_id number, apt_type_code tex...
SELECT T1.booking_start_date, T1.booking_start_date FROM apartment_bookings AS T1 JOIN guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female"
Show the number of apartment bookings for each weekday and bin booking start date by weekday interval in a bar chart, and rank in ascending by the Y-axis please.
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartments ( apt_id INTEGER, ...
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id ORDER BY COUNT(booking_start_date)
Find the policy types more than 4 customers use. Show their type code.
CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE available_policies ( policy_id number, policy_type_code text, customer_phone text ) CREATE TABLE services ( service_id number, service_name text ) CREAT...
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code HAVING COUNT(*) > 4
Return a bar chart about the distribution of Nationality and the amount of Nationality , and group by attribute Nationality, list by the bars in desc.
CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE swimmer ( ID int, name text, Nationality text, meter_100 real, meter_200 text, meter_300 text, meter_40...
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
among patients who remained admitted in hospital for more than 10 days, how many of them got drug administered in both eyes?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "10" AND prescriptions.route = "BOTH EYES"
calculate the total number of patients born in the year less than 2066
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.dob_year < "2066"
What is the number of patients who were ordered an albumin body fluid lab test and stayed in hospital for more than 13 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 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.days_stay > "13" AND lab.label = "Albumin, Body Fluid"
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, give me the comparison about the average of manager_id over the hire_date bin hire_date by time by a bar chart.
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
count the number of patients whose marital status is single and drug route is po?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "SINGLE" AND prescriptions.route = "PO"
how many patients are diagnosed with primary disease atrial fibrillation\thoracoscopic maze procedure bilateral/sda and died before 2115?
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 WHERE demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" AND demographic.dod_year <= "2115.0"
Which is the most popular voting method for Hall of Fame in 2000?
CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, notes text ) CREATE TABLE player ( player_id text, birth_year text, birth_month text, birth_day text, birth_country text, birth_state text, birth_city text, death_ye...
SELECT votedby FROM hall_of_fame WHERE yearid = "2000" GROUP BY votedby ORDER BY COUNT(*) DESC LIMIT 1
How many patients with aortic valve insuffiency ortic valve replacement /sda as their primary disease had abnormal delta lab test results?
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.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND lab.flag = "delta"
give the birthdate and gender of subject id 990.
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, demographic.gender FROM demographic WHERE demographic.subject_id = "990"
How many civil liberties 2013 values are associated with a 2010 political rights value of 6, civil liberties 2012 values over 5, and political rights 2011 under 6?
CREATE TABLE table_75637 ( "Country" text, "Political Rights 2010" real, "Civil Liberties 2010" real, "Status 2010" text, "Political Rights 2011" real, "Civil Liberties 2011" real, "Status 2011" text, "Political Rights 2012" real, "Civil Liberties 2012" real, "Status 2012" text, ...
SELECT COUNT("Civil Liberties 2013") FROM table_75637 WHERE "Political Rights 2010" = '6' AND "Civil Liberties 2012" > '5' AND "Political Rights 2011" < '6'
How many papers are related to deep learning ?
CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE writes ( paperid int, ...
SELECT DISTINCT COUNT(DISTINCT paper.paperid) FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'deep learning' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid
what is the number of patients whose ethnicity is american indian/alaska native and age is less than 81?
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 WHERE demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" AND demographic.age < "81"
give me the number of patients whose diagnoses short title is malfunc oth device/graft and lab test name is urea nitrogen?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Malfunc oth device/graft" AND lab.label = "Urea Nitrogen"
For End of Fiscal Years past 1980 that also have as % of GDP Low-High of 83.4-84.4, and a Debt Held By Public ($Billions) smaller than 7,552 what would be the average Gross Debt in $Billions undeflated Treas. in said years?
CREATE TABLE table_54105 ( "End of Fiscal Year" real, "Gross Debt in $Billions undeflated Treas." real, "as % of GDP Low-High" text, "Debt Held By Public ($Billions)" real, "as % of GDP (Treas/MW, OMB or OMB/MW)" real, "GDP $Billions OMB/BEA est.=MW.com" text )
SELECT AVG("Gross Debt in $Billions undeflated Treas.") FROM table_54105 WHERE "End of Fiscal Year" > '1980' AND "as % of GDP Low-High" = '83.4-84.4' AND "Debt Held By Public ($Billions)" < '7,552'
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, display in ascending by the x-axis.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) 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 departments ( DEPARTMENT_ID decimal...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID
count the number of patients whose item id is 51200 and lab test abnormal status is delta?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51200" AND lab.flag = "delta"
For award winners, which position that has the most hall of fame players?
CREATE TABLE salary ( year number, team_id text, league_id text, player_id text, salary number ) CREATE TABLE player_award_vote ( award_id text, year number, league_id text, player_id text, points_won number, points_max number, votes_first text ) CREATE TABLE player ( ...
SELECT T2.notes FROM hall_of_fame AS T1 JOIN player_award AS T2 ON T1.player_id = T2.player_id WHERE T1.inducted = "Y" GROUP BY notes ORDER BY COUNT(*) DESC LIMIT 1
what is age of subject id 2560?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT demographic.age FROM demographic WHERE demographic.subject_id = "2560"
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, and show by the bar in asc please.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID
what is the number of patients whose diagnoses short title is hx surgery to organs nec and drug route is iv drip?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hx surgery to organs NEC" AND prescriptions.route = "IV DRIP"
count the number of patients with drug code keto15i who were admitted in hospital via clinic referral/premature.
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 demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND prescriptions.formulary_drug_cd = "KETO15I"
For those employees who was hired before 2002-06-21, give me the comparison about the sum of employee_id over the hire_date bin hire_date by weekday.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID ...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
what is maximum age of patients whose language is engl and primary disease is bradycardia?
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 MAX(demographic.age) FROM demographic WHERE demographic.language = "ENGL" AND demographic.diagnosis = "BRADYCARDIA"
provide the number of patients whose admission type is urgent and admission year is less than 2195?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear < "2195"
count the number of patients whose diagnoses long title is chronic total occlusion of coronary artery and drug name is ondansetron?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Chronic total occlusion of coronary artery" AND prescriptions.drug = "Ondansetron"
Show last names for all student who are on scholarship, and count them by a bar chart, I want to display from low to high by the names please.
CREATE TABLE SportsInfo ( StuID INTEGER, SportName VARCHAR(32), HoursPerWeek INTEGER, GamesPlayed INTEGER, OnScholarship VARCHAR(1) ) CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, ...
SELECT LName, COUNT(LName) FROM SportsInfo AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T1.OnScholarship = 'Y' GROUP BY LName ORDER BY LName
A bar chart about how many different locations does each school have?
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE COURSE ( CRS_CODE...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_ADDRESS) FROM DEPARTMENT
what was the first deep learning paper ?
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE writes ( paperid int, authorid int ...
SELECT DISTINCT dataset.datasetid, paper.year FROM dataset, keyphrase, paper, paperdataset, paperkeyphrase WHERE keyphrase.keyphrasename = 'deep learning' AND paperdataset.datasetid = dataset.datasetid AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paperkeyphrase.paperid = paperdataset.paperid AND paper.pap...
Which policy type appears most frequently in the available policies?
CREATE TABLE available_policies ( policy_id number, policy_type_code text, customer_phone text ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE services ( service_id number, service_name text ) CREAT...
SELECT policy_type_code FROM available_policies GROUP BY policy_type_code ORDER BY COUNT(*) DESC LIMIT 1
provide the number of patients whose marital status is divorced and drug route is pr?
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 = "DIVORCED" AND prescriptions.route = "PR"
count the number of patients with procedure icd9 code 5732 who were hospitalized for more than 4 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 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "4" AND procedures.icd9_code = "5732"
count the number of patients whose year of birth is less than 2156 and item id is 51358?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2156" AND lab.itemid = "51358"
provide the number of patients whose marital status is married and procedure long title is percutaneous (endoscopic) jejunostomy [pej]?
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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "MARRIED" AND procedures.long_title = "Percutaneous (endoscopic) jejunostomy [PEJ]"
What is the first and last name of the faculty members who participated in at least one activity? For each of them, also show the number of activities they participated in.
CREATE TABLE faculty ( facid number, lname text, fname text, rank text, sex text, phone number, room text, building text ) CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex...
SELECT T1.fname, T1.lname, COUNT(*), T1.facid FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid GROUP BY T1.facid
count the number of patients whose admission location is emergency room admit and item id is 50902?
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.admission_location = "EMERGENCY ROOM ADMIT" AND lab.itemid = "50902"
give me the number of patients whose age is less than 80 and diagnoses short title is hx-ven thrombosis/embols?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "80" AND diagnoses.short_title = "Hx-ven thrombosis/embols"
provide the number of patients whose diagnoses long title is hyperacusis and lab test category is blood gas?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Hyperacusis" AND lab."CATEGORY" = "Blood Gas"
How many students taking a course who received an A or C? Group by students' first name with a bar chart, and show by the how many stu fname in asc please.
CREATE TABLE EMPLOYEE ( EMP_NUM int, EMP_LNAME varchar(15), EMP_FNAME varchar(12), EMP_INITIAL varchar(1), EMP_JOBCODE varchar(5), EMP_HIREDATE datetime, EMP_DOB datetime ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1),...
SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_FNAME ORDER BY COUNT(STU_FNAME)
get me the number of inpatient hospital admitted patients who had blood lab test.
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND lab.fluid = "Blood"
What are the number of the facility codes of the apartments with more than four bedrooms?, and list by the y axis from high to low.
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Bookings ( apt_bookin...
SELECT facility_code, COUNT(facility_code) FROM Apartment_Facilities AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 4 GROUP BY facility_code ORDER BY COUNT(facility_code) DESC
what is diagnoses icd9 code and diagnoses long title of subject name dona cole?
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 diagnoses.icd9_code, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Dona Cole"
give me the number of patients whose item id is 51214?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51214"
count the number of patients whose age is less than 70 and diagnoses long title is acute myocardial infarction of inferolateral wall, initial episode of care?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "70" AND diagnoses.long_title = "Acute myocardial infarction of inferolateral wall, initial episode of care"
calculate the total number of patients diagnosed with icd9 code 30390 who had their blood gas tested by lab
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "30390" AND lab."CATEGORY" = "Blood Gas"
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(*)
Calculate the number of patients who had coronary artery disease or coronary artery bypass graft sda as their primary disease.
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 WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "CORONARY ARTERY DISEASE\CORONARY ARTERY BYPASS GRAFT /SDA"
For all course_name from courses table, group by the course name and count them with a bar chart, and list by the the number of course name from low to high.
CREATE TABLE People ( person_id INTEGER, first_name VARCHAR(255), middle_name VARCHAR(255), last_name VARCHAR(255), cell_mobile_number VARCHAR(40), email_address VARCHAR(40), login_name VARCHAR(40), password VARCHAR(40) ) CREATE TABLE Courses ( course_id VARCHAR(100), course_nam...
SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name ORDER BY COUNT(course_name)
provide the number of patients whose lab test chart time is 2144-12-08 03:27:00?
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 lab.charttime = "2144-12-08 03:27:00"
what is the number of patients whose marital status is single and procedure short title is transplant cadaver donor?
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.marital_status = "SINGLE" AND procedures.short_title = "Transplant cadaver donor"
Bar chart of mean salary from each dept name, and rank by the X-axis in desc.
CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0) ) CREATE TABLE course ( course_id varchar(8), title v...
SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY dept_name DESC
what is drug type and drug route of drug name tuberculin protein?
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 prescriptions.drug_type, prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Tuberculin Protein"
What is the name of the customer who has made the minimum amount of payment in one claim?
CREATE TABLE claims_processing_stages ( claim_stage_id number, next_claim_stage_id number, claim_status_name text, claim_status_description text ) CREATE TABLE claims_documents ( claim_id number, document_type_code text, created_by_staff_id number, created_date number ) CREATE TABLE po...
SELECT t3.customer_details FROM claim_headers AS t1 JOIN policies AS t2 ON t1.policy_id = t2.policy_id JOIN customers AS t3 ON t2.customer_id = t3.customer_id WHERE t1.amount_piad = (SELECT MIN(amount_piad) FROM claim_headers)
Draw a bar chart for what is the first name and GPA of every student that has a GPA lower than average?, could you rank by the y-axis from high to low?
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 STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1),...
SELECT STU_FNAME, SUM(STU_GPA) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME ORDER BY SUM(STU_GPA) DESC
how many patients whose gender is m and drug code is clin1000i?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "CLIN1000I"
provide the number of patients whose primary disease is brain mass;intracranial hemorrhage and year of birth is less than 2056?
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 WHERE demographic.diagnosis = "BRAIN MASS;INTRACRANIAL HEMORRHAGE" AND demographic.dob_year < "2056"
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and employee_id , 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 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),...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
what is admission time and discharge time of subject name bryant johnson?
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 demographic.admittime, demographic.dischtime FROM demographic WHERE demographic.name = "Bryant Johnson"
what is the admission location and procedure icd9 code for patient id 1121?
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 demographic.admission_location, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "1121"
report the number of patients with other convulsions diagnoses who had csf lab test done.
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Convulsions NEC" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
count the number of patients whose death status is 0 and diagnoses short title is ac diastolic hrt failure?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Ac diastolic hrt failure"
give the number of newborns who were born before the year 2121.
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.admission_type = "NEWBORN" AND demographic.dob_year < "2121"
Show me a line chart to show the change of salary for those employees whose first name does not containing the letter M over the corresponding hire date.
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE departments ( DEPARTME...
SELECT HIRE_DATE, SALARY FROM employees WHERE NOT FIRST_NAME LIKE '%M%'
give the primary disease of jane dillard.
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 demographic.diagnosis FROM demographic WHERE demographic.name = "Jane Dillard"
Visualize a bar chart about the distribution of Days and the amount of Days , and group by attribute Days.
CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) CREATE TABLE Gradeconversion ( lettergrade VARCHAR(2), gradepoint FLOAT ) CREATE TABLE Minor_in ( StuID INTEGER, ...
SELECT Days, COUNT(Days) FROM Course GROUP BY Days ORDER BY Credits
Find the number of patients whose admission type is elective that had a procedure named umbilical vein catheterization.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND procedures.long_title = "Umbilical vein catheterization"
count the number of patients whose procedure long title is creation of conduit between left ventricle and aorta?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Creation of conduit between left ventricle and aorta"
What are the apartment number and the room count of each apartment Visualize by bar chart, and list x-axis from high to low order.
CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) CREATE TABLE Apartment_Bookings ( apt_bookin...
SELECT apt_number, room_count FROM Apartments ORDER BY apt_number DESC
What is the name and country of origin for each artist who has released a song with a resolution higher than 900?
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE artist ( artist_name text, country text, gender text, preferred_genre text ) CREATE TABLE files ( f_id number, artist_name text, file_size text, duration text, formats text ) CREATE TABL...
SELECT T1.artist_name, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T2.resolution > 900 GROUP BY T2.artist_name HAVING COUNT(*) >= 1
Give me the name and description of the location with code x.
CREATE TABLE documents_to_be_destroyed ( document_id number, destruction_authorised_by_employee_id number, destroyed_by_employee_id number, planned_destruction_date time, actual_destruction_date time, other_details text ) CREATE TABLE ref_document_types ( document_type_code text, docume...
SELECT location_name, location_description FROM ref_locations WHERE location_code = "x"
calculate the minimum age of patients admitted on or after 2156 who stayed in hospital for 29 days.
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.days_stay = "29" AND demographic.admityear >= "2156"
how many patients are below 77 years of age and tested with lab item id 51032?
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.age < "77" AND lab.itemid = "51032"
count the number of patients whose insurance is government and procedure short title is skin closure nec?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.short_title = "Skin closure NEC"
How many papers has ras bodik written ?
CREATE TABLE field ( fieldid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE T...
SELECT DISTINCT COUNT(DISTINCT writes.paperid) FROM author, writes WHERE author.authorname = 'ras bodik' AND writes.authorid = author.authorid
Return the average price of products that have each category code in a bar chart, could you rank x axis in desc order?
CREATE TABLE Staff ( staff_id INTEGER, gender VARCHAR(1), first_name VARCHAR(80), last_name VARCHAR(80), email_address VARCHAR(255), phone_number VARCHAR(80) ) CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR(20), date_product_...
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code ORDER BY product_category_code DESC
What conferences did Yejin Kim submit to in 2015 ?
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE journal ( journalid int, jo...
SELECT DISTINCT paper.venueid FROM author, paper, writes WHERE author.authorname = 'Yejin Kim' AND paper.year = 2015 AND writes.authorid = author.authorid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
count the number of patients whose discharge location is short term hospital and age is less than 67?
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.discharge_location = "SHORT TERM HOSPITAL" AND demographic.age < "67"
count the number of patients whose diagnoses long title is perforation of intestine and lab test abnormal status is abnormal?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Perforation of intestine" AND lab.flag = "abnormal"
count the number of patients whose admission type is elective?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE"
Calculate the minimum age of urgent hospital admission patients admitted in or after the year 2178.
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 MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear >= "2178"
provide the number of patients whose insurance is medicare and year of birth is less than 2182?
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 WHERE demographic.insurance = "Medicare" AND demographic.dob_year < "2182"
Return the names of songs for which format is mp3 and resolution is below 1000.
CREATE TABLE genre ( g_name text, rating text, most_popular_in text ) CREATE TABLE song ( song_name text, artist_name text, country text, f_id number, genre_is text, rating number, languages text, releasedate time, resolution number ) CREATE TABLE files ( f_id numbe...
SELECT T2.song_name FROM files AS T1 JOIN song AS T2 ON T1.f_id = T2.f_id WHERE T1.formats = "mp3" INTERSECT SELECT song_name FROM song WHERE resolution < 1000
count the number of patients whose diagnoses short title is atrial fibrillation and drug route is tp?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Atrial fibrillation" AND prescriptions.route = "TP"
what is admission location and discharge location of subject id 17787?
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 demographic.admission_location, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "17787"
tell me the discharge time and days for which patient with patient id 45962 was hospitalized.
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 demographic.days_stay, demographic.dischtime FROM demographic WHERE demographic.subject_id = "45962"
what is diagnoses short title and diagnoses long title of diagnoses icd9 code 42823?
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 diagnoses.short_title, diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "42823"
how many patients whose diagnoses long title is hypoxemia and lab test fluid is blood?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Hypoxemia" AND lab.fluid = "Blood"
what is the number of patients whose ethnicity is white - russian and diagnoses long title is unspecified septicemia?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND diagnoses.long_title = "Unspecified septicemia"
get the number of patients with diagnoses icd9 code 99662 who had ascitic fluid lab test done.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "99662" AND lab.fluid = "Ascites"
Find all users who have written tips for ' Barrio Cafe ' in 2015
CREATE TABLE user ( uid int, user_id varchar, name varchar ) CREATE TABLE review ( rid int, business_id varchar, user_id varchar, rating float, text longtext, year int, month varchar ) CREATE TABLE checkin ( cid int, business_id varchar, count int, day varchar )...
SELECT user.name FROM business, tip, user WHERE business.name = 'Barrio Cafe' AND tip.business_id = business.business_id AND tip.year = 2015 AND user.user_id = tip.user_id