instruction
stringlengths
5
766
input
stringlengths
38
5.51k
response
stringlengths
4
3.91k
List the names and emails of customers who payed by Visa card.
CREATE TABLE order_deliveries ( location_code text, actual_order_id number, delivery_status_code text, driver_employee_id number, truck_id number, delivery_date time ) CREATE TABLE trucks ( truck_id number, truck_licence_number text, truck_details text ) CREATE TABLE products ( ...
SELECT customer_email, customer_name FROM customers WHERE payment_method = 'Visa'
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, show me about the distribution of hire_date and the average of employee_id bin hire_date by weekday in a bar chart.
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 job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
provide the number of patients whose year of birth is less than 2146 and procedure icd9 code is 966?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2146" AND procedures.icd9_code = "966"
presence of any unstable cardiovascular disease, uncontrolled diabetes, chronic inflammatory or infectious conditions. retinoids have been associated with chest pain of unclear etiology, increased serum glucose, myelosuppression and increased risk of infection.
CREATE TABLE table_train_124 ( "id" int, "loss_of_consciousness" bool, "serum_glucose" bool, "myelosuppression" bool, "retinoids_hepatotoxic" bool, "pulmonary_disease" bool, "etiology" bool, "abnormal_thyroid_function" bool, "laboratory_abnormality" bool, "chest_pain" bool, "...
SELECT * FROM table_train_124 WHERE cardiovascular_disease = 1 OR diabetes = 1 OR chronic_inflammatory = 1 OR active_infection = 1 OR (retinoids = 1 AND chest_pain = 1 AND etiology = 1 OR serum_glucose = 1 OR myelosuppression = 1 OR active_infection = 1)
For those employees who did not have any job in the past, show me about the distribution of hire_date and the average of manager_id bin hire_date by time in a bar chart.
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
How many courses for each subject? Plot a bar chart, could you display bar in ascending order?
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) CREATE TABLE Student_Tests_Taken ( registration_id INTEGER, date_test_taken DATETIME, test_result VARCHAR(255) ) CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATET...
SELECT subject_name, COUNT(*) FROM Courses AS T1 JOIN Subjects AS T2 ON T1.subject_id = T2.subject_id GROUP BY T1.subject_id ORDER BY subject_name
How many residents does each property have? List property id and resident count. Visualize by scatter chart.
CREATE TABLE Customer_Events ( Customer_Event_ID INTEGER, customer_id INTEGER, date_moved_in DATETIME, property_id INTEGER, resident_id INTEGER, thing_id INTEGER ) CREATE TABLE Timed_Locations_of_Things ( thing_id INTEGER, Date_and_Time DATETIME, Location_Code CHAR(15) ) CREATE TAB...
SELECT T1.property_id, COUNT(*) FROM Properties AS T1 JOIN Residents AS T2 ON T1.property_id = T2.property_id GROUP BY T1.property_id
provide the number of patients whose insurance is government and procedure long title is closed [needle] biopsy of tongue?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Government" AND procedures.long_title = "Closed [needle] biopsy of tongue"
count the number of patients whose age is less than 77 and item id is 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"
Find the names and average salaries of all departments whose average salary is greater than 42000.
CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE student ( ID varchar(5), name varchar(20), dept_name varchar(20), tot_cred numeric(3,0) ) CREATE TABLE course ( course_id varchar(8), title varchar(50), dept_name varchar(20), credits numeric(2,0) )...
SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name
For all employees who have the letters D or S in their first name, show me about the distribution of job_id and the average of manager_id , and group by attribute job_id in a bar chart, rank bar from low to high order.
CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
what is the patient name and icu stay id of the patient id 76446?
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 demographic.name, prescriptions.icustay_id FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "76446"
how many patients posses self pay insurance and were diagnosed with blood in stool?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescription...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.insurance = "Self Pay" AND diagnoses.long_title = "Blood in stool"
Just show the employee's last name and their manager's id using a bar chart, show in ascending by the x-axis.
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
SELECT LAST_NAME, MANAGER_ID FROM employees ORDER BY LAST_NAME
Visualize a bar chart about the distribution of Days and the average of Instructor , and group by attribute Days.
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 Member_of ( FacID INTEGER, DNO INTEGER, Appt_Type VARCHAR(15) ) CREATE TABLE Minor_in ( StuI...
SELECT Days, AVG(Instructor) FROM Course GROUP BY Days ORDER BY Credits
how many patients stayed in hospital for more than 9 days and used the drug ibuprofen suspension?
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "9" AND prescriptions.drug = "Ibuprofen Suspension"
what is admission type of subject name gus marques?
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 demographic.admission_type FROM demographic WHERE demographic.name = "Gus Marques"
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of hire_date and the sum of manager_id bin hire_date by weekday.
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_I...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the average of salary , and group by attribute job_id in a bar chart, could you list the average of salary in desc order please?
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC
Which state has grow the most apples?
CREATE TABLE resultsdata15 ( sample_pk number, commod text, commtype text, lab text, pestcode text, testclass text, concen number, lod number, conunit text, confmethod text, confmethod2 text, annotate text, quantitate text, mean text, extract text, determi...
SELECT growst FROM sampledata15 WHERE commod = "AP" GROUP BY growst ORDER BY COUNT(*) DESC LIMIT 1
provide the number of patients whose ethnicity is hispanic or latino and item id is 51044?
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND lab.itemid = "51044"
how many patients aged below 43 year with joint fluid as the lab test fluid?
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.age < "43" AND lab.fluid = "Joint Fluid"
how many patients whose admission year is less than 2144 and diagnoses icd9 code is 28802?
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 demographic.admityear < "2144" AND diagnoses.icd9_code = "28802"
count the number of patients whose year of death is less than or equal to 2186 and diagnoses long title is hyperacusis?
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.dod_year <= "2186.0" AND diagnoses.long_title = "Hyperacusis"
For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about salary over the last_name by a bar chart, display by the Y in descending please.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
SELECT LAST_NAME, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY DESC
provide the number of patients with death status as 0 and procedure title as endoscopic removal of stone(s) from biliary tract.
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Endoscopic removal of stone(s) from biliary tract"
display the average salary of employees for each department who gets a commission percentage.
CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE locations ( location_id number, street_address text, postal_code text, city text, state_province text, country_id text ) CREATE TABLE regions ( region_id number, region_name text ) ...
SELECT department_id, AVG(salary) FROM employees WHERE commission_pct <> "null" GROUP BY department_id
List the name and the number of stations for all the cities that have at least 15 stations with a bar chart, and show by the y-axis from low to high please.
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, e...
SELECT city, COUNT(*) FROM station GROUP BY city ORDER BY COUNT(*)
A bar chart for what are the number of the dates that have an average sea level pressure between 30.3 and 31?
CREATE TABLE station ( id INTEGER, name TEXT, lat NUMERIC, long NUMERIC, dock_count INTEGER, city TEXT, installation_date TEXT ) CREATE TABLE status ( station_id INTEGER, bikes_available INTEGER, docks_available INTEGER, time TEXT ) CREATE TABLE trip ( id INTEGER, d...
SELECT date, COUNT(date) FROM weather WHERE mean_sea_level_pressure_inches BETWEEN 30.3 AND 31
give me the number of patients whose admission type is emergency and year of birth is less than 2064?
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 = "EMERGENCY" AND demographic.dob_year < "2064"
calculate the total number of unmarried male patients.
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.marital_status = "SINGLE" AND demographic.gender = "M"
how many patients whose admission year is less than 2195 and item id is 50836?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2195" AND lab.itemid = "50836"
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id, and show Y in desc 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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY...
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID) DESC
What are all the distinct premise types?
CREATE TABLE mailshot_campaigns ( mailshot_id number, product_category text, mailshot_name text, mailshot_start_date time, mailshot_end_date time ) CREATE TABLE mailshot_customers ( mailshot_id number, customer_id number, outcome_code text, mailshot_customer_date time ) CREATE TABL...
SELECT DISTINCT premises_type FROM premises
count the number of phys referral/normal deli patients who were admitted before 2176.
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "PHYS REFERRAL/NORMAL DELI" AND demographic.admityear < "2176"
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, show me about the distribution of hire_date and the amount of hire_date bin hire_date by time in a bar chart, show by the y axis in desc.
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 employees ( EMPLOYEE_ID decimal(6,0...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY COUNT(HIRE_DATE) DESC
What is the temperature of 'Shanghai' city in January?
CREATE TABLE temperature ( city_id number, jan number, feb number, mar number, apr number, jun number, jul number, aug number, sep number, oct number, nov number, dec number ) CREATE TABLE hosting_city ( year number, match_id number, host_city text ) CREATE ...
SELECT T2.jan FROM city AS T1 JOIN temperature AS T2 ON T1.city_id = T2.city_id WHERE T1.city = "Shanghai"
give the discharge location of kelly gallardo.
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 demographic.discharge_location FROM demographic WHERE demographic.name = "Kelly Gallardo"
For all employees who have the letters D or S in their first name, find job_id and the average of manager_id , and group by attribute job_id, and visualize them by a bar chart, could you order by the bar in desc please?
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(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC
Which students are advised by Michael Goodrich? Give me their first and last names.
CREATE TABLE activity ( actid number, activity_name text ) CREATE TABLE participates_in ( stuid number, actid number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE faculty...
SELECT T2.fname, T2.lname FROM faculty AS T1 JOIN student AS T2 ON T1.facid = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
Is popl or oopsla better ?
CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE paperda...
SELECT DISTINCT COUNT(cite.citedpaperid), venue.venuename FROM cite, paper, venue WHERE paper.paperid = cite.citedpaperid AND venue.venueid = paper.venueid AND venue.venuename IN ('popl', 'oopsla') GROUP BY venue.venuename
How many patients are admitted in transfer within this facility and use the lab item id 51427?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.itemid = "51427"
give me the number of patients whose primary disease is femoral artery thrombosis and age is less than 85?
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.diagnosis = "FEMORAL ARTERY THROMBOSIS" AND demographic.age < "85"
give me the number of patients whose admission location is transfer from hosp/extram and days of hospital stay is greater than 10?
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 WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.days_stay > "10"
count the number of patients whose year of death is less than or equal to 2111?
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.dod_year <= "2111.0"
give the number of patients whose diagnosis long title is acute on chronic combined systolic and diastolic heart failure.
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 diagnoses.long_title = "Acute on chronic combined systolic and diastolic heart failure"
provide the number of patients whose year of birth is less than 2098 and drug code is syringens?
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.dob_year < "2098" AND prescriptions.formulary_drug_cd = "SYRINGENS"
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the average of employee_id , and group by attribute job_id, display by the Y-axis in descending.
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0),...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY AVG(EMPLOYEE_ID) DESC
how many patients aged below 58 years had the procedure icd9 code 3612?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "58" AND procedures.icd9_code = "3612"
what is drug route and drug dose of drug name neo*po*ferrous sulfate elixir?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT prescriptions.route, prescriptions.drug_dose FROM prescriptions WHERE prescriptions.drug = "NEO*PO*Ferrous Sulfate Elixir"
what is the number of emergency room hospital admitted patients who were diagnosed with other malignant lymphomas, unspecified site, extranodal and solid organ sites?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Other malignant lymphomas, unspecified site, extranodal and solid organ sites"
give me the number of patients whose drug route is id?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "ID"
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, order total number in asc order.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SUM(SALARY)
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, could you rank total number of manager id in ascending order please?
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varcha...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
Show the names and details of all the staff members.
CREATE TABLE ref_attraction_types ( attraction_type_code text, attraction_type_description text ) CREATE TABLE theme_parks ( theme_park_id number, theme_park_details text ) CREATE TABLE museums ( museum_id number, museum_details text ) CREATE TABLE staff ( staff_id number, tourist_att...
SELECT name, other_details FROM staff
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of email and department_id , sort in desc by the X.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varcha...
SELECT EMAIL, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL DESC
what is drug type of drug name hydrocerin?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Hydrocerin"
let me know the number of patients with diagnoses icd9 code 29634 who were admitted in hospital before 2124.
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.admityear < "2124" AND diagnoses.icd9_code = "29634"
tell me the number of patients with delta abnormal lab test status who have diagnoses icd9 code 25002.
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "25002" AND lab.flag = "delta"
what is the number of patients whose gender is m and primary disease is abdominal pain?
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 WHERE demographic.gender = "M" AND demographic.diagnosis = "ABDOMINAL PAIN"
Plot how many date from by grouped by date from as a bar graph, list Y in asc order.
CREATE TABLE Organisation_Types ( organisation_type VARCHAR(10), organisation_type_description VARCHAR(255) ) CREATE TABLE Project_Staff ( staff_id DOUBLE, project_id INTEGER, role_code VARCHAR(10), date_from DATETIME, date_to DATETIME, other_details VARCHAR(255) ) CREATE TABLE Documen...
SELECT date_from, COUNT(date_from) FROM Project_Staff ORDER BY COUNT(date_from)
give me the number of patients whose days of hospital stay is greater than 15 and drug name is meropenem?
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "15" AND prescriptions.drug = "Meropenem"
provide the number of patients whose admission location is emergency room admit and days of hospital stay is greater than 3?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.days_stay > "3"
For all employees in the Finance department, compare the total number of different job id using a bar chart, and could you list by the bar in descending?
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T2.DEPARTMENT_NAME = 'Finance' GROUP BY JOB_ID ORDER BY JOB_ID DESC
what is gender of subject name estrella carroll?
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 demographic.gender FROM demographic WHERE demographic.name = "Estrella Carroll"
what is maximum age of patients whose ethnicity is white - russian and days of hospital stay is 29?
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.ethnicity = "WHITE - RUSSIAN" AND demographic.days_stay = "29"
what is the number of patients whose gender is m and discharge location is left against medical advi?
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 WHERE demographic.gender = "M" AND demographic.discharge_location = "LEFT AGAINST MEDICAL ADVI"
provide the number of patients who have the procedure long title as hemodialysis.
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 demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Hemodialysis"
how many patients whose death status is 1 and drug code is clin300l?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.expire_flag = "1" AND prescriptions.formulary_drug_cd = "CLIN300L"
calculate the maximum days for which elective hospital admission patients stayed in hospital.
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 MAX(demographic.days_stay) FROM demographic WHERE demographic.admission_type = "ELECTIVE"
For all employees who have the letters D or S in their first name, return a bar chart about the distribution of hire_date and the average of manager_id bin hire_date by weekday.
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 jobs ( JOB_ID varchar(10), JOB_...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
For all employees who have the letters D or S in their first name, a line chart shows the change of manager_id over hire_date, and sort HIRE_DATE in descending order.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS va...
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of email and manager_id , and list x-axis in ascending order please.
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT EMAIL, MANAGER_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY EMAIL
A bar chart about what are the statuses and average populations of each city?, I want to sort by the the average of population in ascending.
CREATE TABLE farm ( Farm_ID int, Year int, Total_Horses real, Working_Horses real, Total_Cattle real, Oxen real, Bulls real, Cows real, Pigs real, Sheep_and_Goats real ) CREATE TABLE city ( City_ID int, Official_Name text, Status text, Area_km_2 real, Populat...
SELECT Status, AVG(Population) FROM city GROUP BY Status ORDER BY AVG(Population)
What are the number of the dates with a maximum temperature higher than 85?, I want to show the number of date from low to high order.
CREATE TABLE trip ( id INTEGER, duration INTEGER, start_date TEXT, start_station_name TEXT, start_station_id INTEGER, end_date TEXT, end_station_name TEXT, end_station_id INTEGER, bike_id INTEGER, subscription_type TEXT, zip_code INTEGER ) CREATE TABLE weather ( date TEX...
SELECT date, COUNT(date) FROM weather WHERE max_temperature_f > 85 ORDER BY COUNT(date)
give me the number of patients whose insurance is medicare and days of hospital stay is greater than 13?
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 prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Medicare" AND demographic.days_stay > "13"
What is the id of the trip that has the shortest duration?
CREATE TABLE status ( station_id number, bikes_available number, docks_available number, time text ) CREATE TABLE station ( id number, name text, lat number, long number, dock_count number, city text, installation_date text ) CREATE TABLE trip ( id number, duration ...
SELECT id FROM trip ORDER BY duration LIMIT 1
Find Nationality and the sum of meter_100 , and group by attribute Nationality, and visualize them by a bar chart, and sort by the X-axis from high to low.
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) 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 swimme...
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
how many patients whose ethnicity is hispanic/latino - puerto rican and diagnoses long title is closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, with loss of consciousness of unspecified duration?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND diagnoses.long_title = "Closed fracture of base of skull with subarachnoid, subdural, and extradural hemorrhage, with loss of ...
give me the number of patients whose admission year is less than 2131 and procedure short title is open biopsy soft tissue?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2131" AND procedures.short_title = "Open biopsy soft tissue"
give me the number of patients whose discharge location is home health care and diagnoses long title is psoas muscle abscess?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND diagnoses.long_title = "Psoas muscle abscess"
count the number of patients whose diagnoses short title is pyelonephritis nos?
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 diagnoses.short_title = "Pyelonephritis NOS"
how many patients are with white ethnicity and with oral drug route?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.route = "ORAL"
what is the diagnosis short title and procedure short title of subject id 83678?
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 prescriptions ( subject_id text, hadm_id...
SELECT diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "83678"
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and list from high to low by the Y.
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 ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), ...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC
how many patients less than 85 years of age have bladder cancer/sda 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 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 = "BLADDER CANCER/SDA" AND demographic.age < "85"
how many patients with an emergency admission type had the diagnosis icd9 code 56210?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.icd9_code = "56210"
give me the number of patients whose year of birth is less than 2170 and lab test name is urea nitrogen, urine?
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 < "2170" AND lab.label = "Urea Nitrogen, Urine"
What are the number of the descriptions of the categories that products with product descriptions that contain the letter t are in?
CREATE TABLE Ref_Colors ( color_code VARCHAR(15), color_description VARCHAR(80) ) CREATE TABLE Characteristics ( characteristic_id INTEGER, characteristic_type_code VARCHAR(15), characteristic_data_type VARCHAR(10), characteristic_name VARCHAR(80), other_characteristic_details VARCHAR(255) ...
SELECT product_category_description, COUNT(product_category_description) FROM Ref_Product_Categories AS T1 JOIN Products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%' GROUP BY product_category_description
For all employees who have the letters D or S in their first name, a bar chart shows the distribution of hire_date and the sum of employee_id bin hire_date by time, and rank by the y axis from low to high.
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) 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...
SELECT HIRE_DATE, SUM(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY SUM(EMPLOYEE_ID)
Calculate the minimum age of patients who have posterior communicating aneurysm/sda and were discharged home.
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 MIN(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME" AND demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
What is the average price of clothes?
CREATE TABLE staff_department_assignments ( staff_id number, department_id number, date_assigned_from time, job_title_code text, date_assigned_to time ) CREATE TABLE products ( product_id number, product_type_code text, product_name text, product_price number ) CREATE TABLE supplie...
SELECT AVG(product_price) FROM products WHERE product_type_code = 'Clothes'
Find all cities which has a ' Taj Mahal ' .
CREATE TABLE neighborhood ( id int, business_id varchar, neighborhood_name varchar ) CREATE TABLE business ( bid int, business_id varchar, name varchar, full_address varchar, city varchar, latitude varchar, longitude varchar, review_count bigint, is_open tinyint, rat...
SELECT city FROM business WHERE name = 'Taj Mahal'
provide the number of patients whose diagnoses long title is drug induced neutropenia and drug route is left eye?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Drug induced neutropenia" AND prescriptions.route = "LEFT EYE"
Show the names and heights of buildings with at least two institutions founded after 1880 Plot them as bar chart, and I want to show Y-axis in descending order.
CREATE TABLE Institution ( Institution_id text, Institution text, Location text, Founded real, Type text, Enrollment int, Team text, Primary_Conference text, building_id text ) CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real...
SELECT Name, Height_feet FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id WHERE T2.Founded > 1880 ORDER BY Height_feet DESC
what is the code of each location and the number of documents in that location?, display in desc by the X.
CREATE TABLE Employees ( Employee_ID INTEGER, Role_Code CHAR(15), Employee_Name VARCHAR(255), Gender_MFU CHAR(1), Date_of_Birth DATETIME, Other_Details VARCHAR(255) ) CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Na...
SELECT Location_Code, COUNT(*) FROM Document_Locations GROUP BY Location_Code ORDER BY Location_Code DESC
Return the code of the document type that is most common.
CREATE TABLE ref_budget_codes ( budget_type_code text, budget_type_description text ) CREATE TABLE documents ( document_id number, document_type_code text, project_id number, document_date time, document_name text, document_description text, other_details text ) CREATE TABLE statem...
SELECT document_type_code FROM documents GROUP BY document_type_code ORDER BY COUNT(*) DESC LIMIT 1
For all employees who have the letters D or S in their first name, visualize a bar chart about the distribution of job_id and the amount of job_id , and group by attribute job_id, list x-axis in asc order please.
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID
get the short title as well as the icd9 code of diagnoses for patient with patient id 55094.
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 demographic ...
SELECT diagnoses.icd9_code, diagnoses.short_title FROM diagnoses WHERE diagnoses.subject_id = "55094"
What are the number of dates of birth of all the guests whose gender is 'Male'?, I want to show x axis in ascending 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 View_Unit_Status ( apt_id INTEG...
SELECT date_of_birth, COUNT(date_of_birth) FROM Guests WHERE gender_code = "Male" ORDER BY date_of_birth