instruction
stringlengths
11
446
input
stringlengths
195
2.3k
response
stringlengths
26
460
where does li dong publish ?
CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE field ( fieldid int ) CREATE TABLE key...
SELECT DISTINCT paper.journalid, venue.venueid FROM author, paper, venue, writes WHERE author.authorname = 'li dong' AND venue.venueid = paper.venueid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
count the number of patients whose marital status is married and diagnoses long title is mechanical complication due to other implant and internal device, not elsewhere classified?
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 WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Mechanical complication due to other implant and internal device, not elsewhere classified"
A bar chart for finding the number of the category descriptions of the products whose descriptions include letter 't', and I want to display by the bar from high to low please.
CREATE TABLE Products ( product_id INTEGER, color_code VARCHAR(15), product_category_code VARCHAR(15), product_name VARCHAR(80), typical_buying_price VARCHAR(20), typical_selling_price VARCHAR(20), product_description VARCHAR(255), other_product_details VARCHAR(255) ) CREATE TABLE Ref_P...
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 ORDER BY product_category_description DESC
Give me the number of living patients who have atrial septal defect mitral valve replacement repair atrial-septal defect/sda as their primary disease.
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "ATRIAL SEPTAL DEFECT\MITRAL VALVE REPLACEMENT;REPAIR ATRIAL-SEPTAL DEFECT/SDA"
Find the number of patients who had procedure titled fiber-optic bronchoscopy and have their status as 0.
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.expire_flag = "0" AND procedures.long_title = "Fiber-optic bronchoscopy"
find the number of patients admitted in the emergency room under procedure icd9 code 9229.
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 demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.icd9_code = "9229"
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 first_name and employee_id .
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(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE...
SELECT FIRST_NAME, EMPLOYEE_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
papers by steve seitz
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, nu...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'steve seitz' AND writes.authorid = author.authorid
provide the number of patients whose primary disease is gastrointestinal bleed and days of hospital stay is greater than 2?
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.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.days_stay > "2"
what is maximum age of patients whose ethnicity is asian and days of hospital stay is 23?
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 MAX(demographic.age) FROM demographic WHERE demographic.ethnicity = "ASIAN" AND demographic.days_stay = "23"
give me the number of patients whose primary disease is sigmoid diverticulitis, colovestical fistula/sda and age is less than 71?
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.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" AND demographic.age < "71"
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, rank in ascending by the Y.
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(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY)
how many patients that died were diagnosed with ketoacidosis, type i [juvenile type], not stated as uncontrolled?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.long_title = "Diabetes with ketoacidosis, type I [juvenile type], not stated as uncontrolled"
how many of the female patients were treated with drug d10w?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "D10W"
how many female patients have benzodiazepine-based tranquilizers causing adverse effects in therapeutic use diagnoses?
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.gender = "F" AND diagnoses.long_title = "Benzodiazepine-based tranquilizers causing adverse effects in therapeutic use"
authors of ACL 2014 papers
CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE journal ( journalid int, journalname va...
SELECT DISTINCT writes.authorid FROM paper, venue, writes WHERE paper.year = 2014 AND venue.venueid = paper.venueid AND venue.venuename = 'ACL' AND writes.paperid = paper.paperid
what is the number of patients whose admission type is urgent and insurance is medicaid?
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 = "URGENT" AND demographic.insurance = "Medicaid"
what is the number of patients born before 2137 who are still alive?
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 WHERE demographic.expire_flag = "0" AND demographic.dob_year < "2137"
Get the list of patients diagnosed with personal history of malignant neoplasm of bladder who have a prescription for base type drug.
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.short_title = "Hx of bladder malignancy" AND prescriptions.drug_type = "BASE"
provide the diagnoses icd9 code for kelly gallardo.
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 demographic.diagnosis, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Kelly Gallardo"
how many female patients are aged below 36 years?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.age < "36"
what is maximum days of hospital stay of patients whose admission year is greater than or equal to 2177?
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 MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2177"
provide me the number of patients taking base type drug prescription who have diagnoses icd9 code 28860.
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "28860" AND prescriptions.drug_type = "BASE"
Show me the correlation about what are the ids of the trips that lasted the longest and how long did they last?
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 status ( station_i...
SELECT id, duration FROM trip ORDER BY duration DESC LIMIT 3
provide the number of patients whose lab test name is wbc?
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 lab.label = "WBC"
what is diagnoses long title of diagnoses icd9 code 76403?
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 diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "76403"
give me the number of patients born before the year 2049 who have aortic valve insufficiency/aortic valve replacement/sda primary disease.
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 WHERE demographic.diagnosis = "AORTIC VALVE INSUFFIENCY\AORTIC VALVE REPLACEMENT /SDA" AND demographic.dob_year < "2049"
how many patients whose admission location is trsf within this facility and drug code is bume05?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "BUME05"
give me the number of patients whose primary disease is hyperglycemia and days of hospital stay is greater than 14?
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.diagnosis = "HYPERGLYCEMIA" AND demographic.days_stay > "14"
How many of the patients aged below 30 had other electric countershock of the heart?
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.age < "30" AND procedures.long_title = "Other electric countershock of heart"
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of hire_date and the average of manager_id bin hire_date by weekday, and could you display y axis in ascending order?
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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(MANAGER_ID)
List the phone numbers of all employees.
CREATE TABLE playlisttrack ( playlistid number, trackid number ) CREATE TABLE genre ( genreid number, name text ) CREATE TABLE customer ( customerid number, firstname text, lastname text, company text, address text, city text, state text, country text, postalcode te...
SELECT phone FROM employee
Return the structure description of the document that has been accessed the fewest number of times.
CREATE TABLE roles ( role_code text, role_description text ) CREATE TABLE images ( image_id number, image_alt_text text, image_name text, image_url text ) CREATE TABLE users ( user_id number, role_code text, user_name text, user_login text, password text ) CREATE TABLE doc...
SELECT t2.document_structure_description FROM documents AS t1 JOIN document_structures AS t2 ON t1.document_structure_code = t2.document_structure_code GROUP BY t1.document_structure_code ORDER BY COUNT(*) DESC LIMIT 1
Show the faculty id of each faculty member, along with the number of students he or she advises in a scatter chart
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 Faculty_Participates_in ( FacID INTEGER, actid INTEGER ) CREATE TABLE Student ( StuID INTEGER, ...
SELECT FacID, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.FacID
give me the number of patients whose drug code is lope2?
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 prescriptions.formulary_drug_cd = "LOPE2"
What are the name and level of catalog structure with level number between 5 and 1 Show bar chart, and list names in desc order please.
CREATE TABLE Attribute_Definitions ( attribute_id INTEGER, attribute_name VARCHAR(30), attribute_data_type VARCHAR(10) ) CREATE TABLE Catalogs ( catalog_id INTEGER, catalog_name VARCHAR(50), catalog_publisher VARCHAR(80), date_of_publication DATETIME, date_of_latest_revision DATETIME ) ...
SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10 ORDER BY catalog_level_name DESC
Bar chart x axis product name y axis how many product name, rank by the the number of product name in ascending.
CREATE TABLE Events ( Event_ID INTEGER, Address_ID INTEGER, Channel_ID INTEGER, Event_Type_Code CHAR(15), Finance_ID INTEGER, Location_ID INTEGER ) CREATE TABLE Assets_in_Events ( Asset_ID INTEGER, Event_ID INTEGER ) CREATE TABLE Parties ( Party_ID INTEGER, Party_Details VARCHA...
SELECT Product_Name, COUNT(Product_Name) FROM Products GROUP BY Product_Name ORDER BY COUNT(Product_Name)
count the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and lab test abnormal status is delta?
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.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.flag = "delta"
what is discharge time and diagnoses short title of subject name cynthia robinson?
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 demographic.dischtime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Cynthia Robinson"
List the names of all the customers in alphabetical order.
CREATE TABLE policies ( policy_id number, customer_id number, policy_type_code text, start_date time, end_date time ) CREATE TABLE claims_processing_stages ( claim_stage_id number, next_claim_stage_id number, claim_status_name text, claim_status_description text ) CREATE TABLE staf...
SELECT customer_details FROM customers ORDER BY customer_details
Compare the total number of different job titles for all those jobs in department 80 using a bar chart, show Y from low to high order.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCAT...
SELECT JOB_TITLE, COUNT(JOB_TITLE) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID WHERE T1.DEPARTMENT_ID = 80 GROUP BY JOB_TITLE ORDER BY COUNT(JOB_TITLE)
give me the number of patients whose drug name is vitamin b complex?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "Vitamin B Complex"
calculate the number of patients with abnormal loss of weight who had a lab test for pleural fluid.
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Abnormal loss of weight" AND lab.fluid = "Pleural"
give the number of patients whose drug code is phen10i 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "PHEN10I" AND lab."CATEGORY" = "Blood Gas"
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 manager_id , and group by attribute job_id.
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 decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE countries ( COUNTRY...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
How many songs appear in studio albums?
CREATE TABLE albums ( aid number, title text, year number, label text, type text ) CREATE TABLE vocals ( songid number, bandmate number, type text ) CREATE TABLE tracklists ( albumid number, position number, songid number ) CREATE TABLE band ( id number, firstname ...
SELECT COUNT(DISTINCT T3.title) FROM albums AS T1 JOIN tracklists AS T2 ON T1.aid = T2.albumid JOIN songs AS T3 ON T2.songid = T3.songid WHERE t1.type = "Studio"
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of phone_number and department_id in a bar chart, and I want to sort from high to low by the Y-axis.
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 PHONE_NUMBER, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY DEPARTMENT_ID DESC
Find password and gender_mf , and visualize them by a bar chart.
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Course_Authors_and_Tutors ( author_id IN...
SELECT password, gender_mf FROM Course_Authors_and_Tutors ORDER BY personal_name
how many of the patients had urgent admission due to hyperacusis?
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.admission_type = "URGENT" AND diagnoses.short_title = "Hyperacusis"
For all employees who have the letters D or S in their first name, find hire_date and the sum of manager_id bin hire_date by weekday, and visualize them by a bar chart.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), ...
SELECT HIRE_DATE, SUM(MANAGER_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
what is the primary disease and diagnosis of the patient id 8440?
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 demographic.diagnosis, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "8440"
what is the gender and procedure long title of subject id 2560?
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, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "2560"
what is maximum days of hospital stay of patients whose primary disease is st elevated myocardial infarction\cardiac cath?
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 MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH"
Draw 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 stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE swimme...
SELECT Nationality, COUNT(Nationality) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
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, a scatter chart shows the correlation between salary and manager_id .
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 SALARY, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40
find the number of government health insurance patients who had other electric countershock of heart.
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.insurance = "Government" AND procedures.short_title = "Heart countershock NEC"
How many documents in different ending date? Return a line chart binning ending date by year interval, could you rank by the X-axis from low to high?
CREATE TABLE All_Documents ( Document_ID INTEGER, Date_Stored DATETIME, Document_Type_Code CHAR(15), Document_Name CHAR(255), Document_Description CHAR(255), Other_Details VARCHAR(255) ) CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Descri...
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations ORDER BY Date_in_Locaton_To
List the document type code for the document with the id 2.
CREATE TABLE document_drafts ( document_id number, draft_number number, draft_details text ) CREATE TABLE circulation_history ( document_id number, draft_number number, copy_number number, employee_id number ) CREATE TABLE ref_document_status ( document_status_code text, document_s...
SELECT document_type_code FROM documents WHERE document_id = 2
what is the number of patients whose admission type is elective and lab test fluid is urine?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.fluid = "Urine"
count the number of patients whose death status is 1 and admission location is emergency room admit?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "1" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
For those employees who was hired before 2002-06-21, find job_id and the average of employee_id , and group by attribute job_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 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), ...
SELECT JOB_ID, AVG(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
what number of patients were admitted in emergency under procedure icd9 code 403?
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.admission_type = "EMERGENCY" AND procedures.icd9_code = "403"
Show me about the correlation between author_id and author_tutor_ATB in a scatter chart.
CREATE TABLE Students ( student_id INTEGER, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR(40), password VARCHAR(10), personal_name VARCHAR(40), middle_name VARCHAR(40), family_name VARCHAR(40) ) CREATE TABLE Subjects ( subject_id INTEGER, subje...
SELECT author_id, author_tutor_ATB FROM Course_Authors_and_Tutors ORDER BY personal_name
how many patients are below 49 years of age and admitted under the year 2198?
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.age < "49" AND demographic.admityear < "2198"
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 salary , and group by attribute job_id, could you list in descending by the JOB_ID?
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 decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE job_history ( EMPLO...
SELECT JOB_ID, SUM(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' GROUP BY JOB_ID ORDER BY JOB_ID DESC
Find the sum of credits of courses that have more than one prerequisites for each department with a bar chart, I want to sort in ascending by the X-axis.
CREATE TABLE takes ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), grade varchar(2) ) CREATE TABLE section ( course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric(4,0), building varchar(15), room_numb...
SELECT dept_name, SUM(credits) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY dept_name ORDER BY dept_name
List all customer status codes and the number of customers having each status code in a bar chart, could you rank bar in descending order?
CREATE TABLE Addresses ( address_id INTEGER, line_1_number_building VARCHAR(80), city VARCHAR(50), zip_postcode VARCHAR(20), state_province_county VARCHAR(50), country VARCHAR(50) ) CREATE TABLE Vehicles ( vehicle_id INTEGER, vehicle_details VARCHAR(255) ) CREATE TABLE Lessons ( le...
SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code ORDER BY customer_status_code DESC
For those employees whose first name does not containing the letter M, display their average salary by binning the hire date into Month interval for visualizing a bar chart, and order in asc by the y axis.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varch...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT FIRST_NAME LIKE '%M%' ORDER BY AVG(SALARY)
How many patients are admitted from hosp/extram and before the year 2168?
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_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2168"
what is average age of patients whose marital status is widowed and admission location is emergency room admit?
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 AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "WIDOWED" AND demographic.admission_location = "EMERGENCY ROOM ADMIT"
Show the location code, the starting date and ending data in that location for all the documents.
CREATE TABLE employees ( employee_id number, role_code text, employee_name text, gender_mfu text, date_of_birth time, other_details text ) CREATE TABLE ref_calendar ( calendar_date time, day_number number ) CREATE TABLE documents_to_be_destroyed ( document_id number, destructio...
SELECT location_code, date_in_location_from, date_in_locaton_to FROM document_locations
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE employees ( EMPLO...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
what is procedure icd9 code and procedure short title of subject name alice nixon?
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 procedures.icd9_code, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Alice Nixon"
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check, and count them by a line chart, show X from low to high order.
CREATE TABLE Payments ( payment_id INTEGER, booking_id INTEGER, customer_id INTEGER, payment_type_code VARCHAR(15), amount_paid_in_full_yn VARCHAR(1), payment_date DATETIME, amount_due DECIMAL(19,4), amount_paid DECIMAL(19,4) ) CREATE TABLE View_Product_Availability ( product_id INT...
SELECT payment_date, COUNT(payment_date) FROM Payments WHERE amount_paid > 300 OR payment_type_code = 'Check' GROUP BY payment_date ORDER BY payment_date
For those employees who did not have any job in the past, a bar chart shows the distribution of job_id and the sum of employee_id , and group by attribute job_id, and display from low to high by the sum employee id.
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 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, 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)
What are the id and name of the stadium where the most injury accidents happened?
CREATE TABLE game ( stadium_id number, id number, season number, date text, home_team text, away_team text, score text, competition text ) CREATE TABLE injury_accident ( game_id number, id number, player text, injury text, number_of_matches text, source text ) C...
SELECT T1.id, T1.name FROM stadium AS T1 JOIN game AS T2 ON T1.id = T2.stadium_id JOIN injury_accident AS T3 ON T2.id = T3.game_id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 1
List the name of all products along with the number of complaints that they have received.
CREATE TABLE Products ( product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR(20), date_product_first_available DATETIME, date_product_discontinued DATETIME, product_name VARCHAR(80), product_description VARCHAR(255), product_price DECIMAL(19,4) ) CREATE TABLE Com...
SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name
How many courses for each course description? Show me a bar chart.
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 ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE STUDENT ( STU_NUM...
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION
Give me the number of patients born before the year 2092 whose lab test item id is 61358.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2092" AND lab.itemid = "51358"
what is drug name and drug code of subject name frank gregory?
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 prescriptions.drug, prescriptions.formulary_drug_cd FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Frank Gregory"
How many bookings for each apartment number? Plot a bar chart, I want to sort names in asc order.
CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) CREATE TABLE View_Unit_Status...
SELECT apt_number, COUNT(apt_number) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id GROUP BY apt_number ORDER BY apt_number
For those employees who was hired before 2002-06-21, return a bar chart about the distribution of hire_date and the average of department_id bin hire_date by time.
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, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLO...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21'
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 manager_id bin hire_date by weekday in a bar chart, and show by the the average of manager id from high to low.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCAT...
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(MANAGER_ID) DESC
How many documents are stored? Bin the store date by weekday in a bar chart, and order by the y-axis from low to high.
CREATE TABLE Roles ( Role_Code CHAR(15), Role_Name VARCHAR(255), Role_Description VARCHAR(255) ) CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Documents_to_be_Destroyed ( Document_ID INTEGER, Destructio...
SELECT Date_Stored, COUNT(Date_Stored) FROM All_Documents AS T1 JOIN Ref_Calendar AS T2 ON T1.Date_Stored = T2.Calendar_Date ORDER BY COUNT(Date_Stored)
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, visualize a bar chart about the distribution of hire_date and the sum of salary bin hire_date by weekday, and display sum salary in desc order.
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(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(...
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY SUM(SALARY) DESC
what is the days of hospital stay and admission location of patient id 65759?
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 demographic.days_stay, demographic.admission_location FROM demographic WHERE demographic.subject_id = "65759"
what is minimum age of patients whose days of hospital stay is 20 and year of death is less than 2164?
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 MIN(demographic.age) FROM demographic WHERE demographic.days_stay = "20" AND demographic.dod_year < "2164.0"
For those employees who did not have any job in the past, return a bar chart about the distribution of hire_date and the sum of department_id bin hire_date by time.
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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varcha...
SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NA...
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID)
For all employees who have the letters D or S in their first name, give me the comparison about the average of employee_id over the hire_date bin hire_date by weekday, I want to rank by the total number in desc.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), ...
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(EMPLOYEE_ID) DESC
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the average of employee_id , and group by attribute job_id, list by the names from high to low.
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 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 HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
how many patients discharged to home are diagnosed with anxiety state, unspecified?
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.discharge_location = "HOME" AND diagnoses.long_title = "Anxiety state, unspecified"
For those employees who did not have any job in the past, give me the comparison about the amount of hire_date over the hire_date bin hire_date by weekday, and show Y-axis in desc order.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE T...
SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY COUNT(HIRE_DATE) DESC
how many patients were newborn and born before the year 2200?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.dob_year < "2200"
what is the number of patients whose primary disease is st elevated myocardial infarction\cardiac cath and admission year is less than 2103?
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 WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND demographic.admityear < "2103"
count the number of patients whose diagnoses icd9 code is v489 and drug type is additive?
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "V489" AND prescriptions.drug_type = "ADDITIVE"
Compute the number of local authorities by local authorities and then split by services Show the result with a stacked bar graph, I want to order y axis from low to high order please.
CREATE TABLE train ( id int, train_number int, name text, origin text, destination text, time text, interval text ) CREATE TABLE route ( train_id int, station_id int ) CREATE TABLE station ( id int, network_name text, services text, local_authority text ) CREATE TA...
SELECT services, COUNT(services) FROM station GROUP BY local_authority, services ORDER BY COUNT(services)
count the number of patients whose year of death is less than or equal to 2133 and procedure long title is open and other replacement of mitral valve with tissue graft?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2133.0" AND procedures.long_title = "Open and other replacement of mitral valve with tissue graft"
what is drug type and drug dose of drug name sulfameth/trimethoprim ss?
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.drug_dose FROM prescriptions WHERE prescriptions.drug = "Sulfameth/Trimethoprim SS"
for patient id 52012, specify the admission type and icd9 code.
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 demographic.admission_type, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "52012"