instruction
stringlengths
11
446
input
stringlengths
195
2.3k
response
stringlengths
26
460
how many patients were diagnosed with an unspecified disorder of kidney and ureter and treated with a main drug type?
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 = "Unspecified disorder of kidney and ureter" AND prescriptions.drug_type = "MAIN"
which type of drug is iso-osmotic sodium chloride?
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 prescriptions.drug_type FROM prescriptions WHERE prescriptions.drug = "Iso-Osmotic Sodium Chloride"
List each test result and its count in descending order of count by a bar chart.
CREATE TABLE Subjects ( subject_id INTEGER, subject_name VARCHAR(120) ) 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), fam...
SELECT test_result, COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
what is the total number of patients tested for hematology who had open reduction of fracture with internal fixation, femur?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Open reduction of fracture with internal fixation, femur" AND lab."CATEGORY" = "Hematology"
Return the characteristic names of the 'sesame' product.
CREATE TABLE ref_product_categories ( product_category_code text, product_category_description text, unit_of_measure text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic_value text ) CREATE TABLE ref_colors ( color_code text, ...
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN characteristics AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
provide the number of patients with diagnoses icd9 code 317 who were admitted for more than 34 days.
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "34" AND diagnoses.icd9_code = "317"
tell me the number of patients admitted before the year 2172 who had other phototherapy procedure.
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2172" AND procedures.long_title = "Other phototherapy"
How many employees do we have?
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_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE roles ( r...
SELECT COUNT(*) FROM employees
Plot calendar date by how many calendar date as a line chart
CREATE TABLE Ref_Calendar ( Calendar_Date DATETIME, Day_Number INTEGER ) 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, Destruction_Authorised_by_Employee_ID ...
SELECT Calendar_Date, COUNT(Calendar_Date) FROM Ref_Calendar
List all the distinct product names ordered by product id?
CREATE TABLE problem_category_codes ( problem_category_code text, problem_category_description text ) CREATE TABLE problem_status_codes ( problem_status_code text, problem_status_description text ) CREATE TABLE problems ( problem_id number, product_id number, closure_authorised_by_staff_id...
SELECT DISTINCT product_name FROM product ORDER BY product_id
how many patients whose diagnoses long title is diverticulosis of colon with hemorrhage and lab test fluid is blood?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Diverticulosis of colon with hemorrhage" AND lab.fluid = "Blood"
Give the average age of patients who have private insurance and have discharge location as rehab/disticnt part hosp.
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 AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "REHAB/DISTINCT PART HOSP"
How many courses for each course description? Show me a stacked bar chart. The x-axis is course description and group by office name.
CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), ...
SELECT 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 PROF_OFFICE, CRS_DESCRIPTION
Which patients with infected right thigh graft as their primary disease have long term care as their hospital discharge?
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.discharge_location = "LONG TERM CARE HOSPITAL" AND demographic.diagnosis = "INFECTED RIGHT THIGH GRAFT"
how many patients whose admission year is less than 2150 and drug route is iv bolus?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2150" AND prescriptions.route = "IV BOLUS"
provide the number of patients whose language is port and days of hospital stay is greater than 6?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.language = "PORT" AND demographic.days_stay > "6"
provide the number of patients whose primary disease is bladder cancer/sda and admission year is less than 2138?
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.diagnosis = "BLADDER CANCER/SDA" AND demographic.admityear < "2138"
what is the maximum age of patients primarily diagnosed with posterior communicating aneurysm/sda before the admission year 2203?
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.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA" AND demographic.admityear >= "2203"
what is the number of patients whose admission location is transfer from hosp/extram and admission year is less than 2168?
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 WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2168"
how many of the female patients had icd9 code 2809?
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.icd9_code = "2809"
give me the number of patients whose primary disease is coronary artery 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.diagnosis = "CORONARY ARTERY DISEASE"
how many patients whose death status is 1 and diagnoses icd9 code is 5733?
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.expire_flag = "1" AND diagnoses.icd9_code = "5733"
How many patients stayed in the hospital for more than 2 days and have diagnosis long title as tricuspid valve disorders specified as nonrheumatic?
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.days_stay > "2" AND diagnoses.long_title = "Tricuspid valve disorders, specified as nonrheumatic"
give me the number of patients whose primary disease is neoplasm of uncertain behavior of other lymphatic and hematopoietic tissues\bone marrow transplant and year of death is less than or equal to 2112?
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 WHERE demographic.diagnosis = "NEOPLASM OF UNCERTAIN BEHAVIOR OF OTHER LYMPHATIC AND HEMATOPOIETIC TISSUES\BONE MARROW TRANSPLANT" AND demographic.dod_year <= "2112.0"
What is the id of the instructor who advises of all students from History department?
CREATE TABLE takes ( id text, course_id text, sec_id text, semester text, year number, grade text ) CREATE TABLE teaches ( id text, course_id text, sec_id text, semester text, year number ) CREATE TABLE course ( course_id text, title text, dept_name text, cr...
SELECT i_id FROM advisor AS T1 JOIN student AS T2 ON T1.s_id = T2.id WHERE T2.dept_name = 'History'
When did the staff member named Janessa Sawayn join the company?
CREATE TABLE vehicles ( vehicle_id number, vehicle_details text ) CREATE TABLE lessons ( lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number ) CREATE TABLE staff ( staff_id numbe...
SELECT date_joined_staff FROM staff WHERE first_name = "Janessa" AND last_name = "Sawayn"
provide the number of patients whose diagnosis short title is atriovent block complete and drug type is base.
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Atriovent block complete" AND prescriptions.drug_type = "BASE"
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, and order Y-axis in desc order 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 regions ( REGION_ID decimal(5,0), ...
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
Which document type is described with the prefix 'Initial'?
CREATE TABLE tasks ( task_id number, project_id number, task_details text, eg agree objectives text ) CREATE TABLE organisations ( organisation_id number, organisation_type text, organisation_details text ) CREATE TABLE documents ( document_id number, document_type_code text, g...
SELECT document_type_code FROM document_types WHERE document_description LIKE 'Initial%'
Show the location codes with at least 3 documents.
CREATE TABLE ref_locations ( location_code text, location_name text, location_description text ) CREATE TABLE employees ( employee_id number, role_code text, employee_name text, gender_mfu text, date_of_birth time, other_details text ) CREATE TABLE documents_to_be_destroyed ( d...
SELECT location_code FROM document_locations GROUP BY location_code HAVING COUNT(*) >= 3
What are the ids of the candidates that have an outcome code of Pass?
CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from time, date_to time ) CREATE TABLE student_course_attendance ( student_id number, course_id number, date_of_attendance time ) CREATE TABLE candidate_assessments ( candidate_id nu...
SELECT candidate_id FROM candidate_assessments WHERE asessment_outcome_code = "Pass"
count the number of patients whose procedure long title is thoracentesis and lab test category is blood gas?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Blood Gas"
count the number of patients who were admitted before 2166 and who have also undergone arterial catheterization.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2166" AND procedures.long_title = "Arterial catheterization"
Bar chart of sum crs credit from each dept code
CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS varchar(20), DEPT_EXTENSION varchar(4) ) CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ...
SELECT DEPT_CODE, SUM(CRS_CREDIT) FROM COURSE GROUP BY DEPT_CODE
how many patients whose age is less than 50 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 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.age < "50" AND demographic.days_stay > "14"
how many patients whose primary disease is sepsis and lab test fluid is urine?
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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "SEPSIS" AND lab.fluid = "Urine"
how many patients had atrial septal defect / mitral valve replacement;repair atrial-septal defect/sda as their primary disease?
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.diagnosis = "ATRIAL SEPTAL DEFECT\MITRAL VALVE REPLACEMENT;REPAIR ATRIAL-SEPTAL DEFECT/SDA"
A bar chart for what are the number of the dates when customers with ids between 10 and 20 became customers?
CREATE TABLE Products ( product_id INTEGER, product_details VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, payment_method VARCHAR(15), customer_name VARCHAR(80), date_became_customer DATETIME, other_customer_details VARCHAR(255) ) CREATE TABLE Addresses ( address_id INTEG...
SELECT date_became_customer, COUNT(date_became_customer) FROM Customers WHERE customer_id BETWEEN 10 AND 20
Visualize a bar chart for what is the average salary for each job title?, and sort by the Y from high to low.
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_TITLE, AVG(SALARY) FROM employees AS T1 JOIN jobs AS T2 ON T1.JOB_ID = T2.JOB_ID GROUP BY T2.JOB_TITLE ORDER BY AVG(SALARY) DESC
tell me the long title of diagnoses for diagnoses icd9 code v5883.
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "V5883"
what is maximum age of patients whose admission type is urgent and admission year is greater than or equal to 2177?
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 MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.admityear >= "2177"
give me the number of patients whose admission type is emergency and lab test name is creatine kinase, mb isoenzyme?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab.label = "Creatine Kinase, MB Isoenzyme"
how many patients whose discharge location is home and procedure long title is percutaneous aspiration of liver?
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.discharge_location = "HOME" AND procedures.long_title = "Percutaneous aspiration of liver"
give me the number of patients whose days of hospital stay is greater than 13 and drug name is tizanidine?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "13" AND prescriptions.drug = "Tizanidine"
what is maximum age of patients whose admission location is emergency room admit and primary disease is copd exacerbation?
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.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "COPD EXACERBATION"
provide the number of patients with lab test item id 51067 who were younger than 44 years.
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "44" AND lab.itemid = "51067"
what is the number of patients whose primary disease is copd exacerbation and year of birth is less than 1837?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "COPD EXACERBATION" AND demographic.dob_year < "1837"
What are the total number of Domestic Passengers of airports that contain the word 'London'.
CREATE TABLE pilot ( pilot_id number, name text, age number ) CREATE TABLE airport ( airport_id number, airport_name text, total_passengers number, %_change_2007 text, international_passengers number, domestic_passengers number, transit_passengers number, aircraft_movements ...
SELECT SUM(domestic_passengers) FROM airport WHERE airport_name LIKE "%London%"
what is id of students who registered some courses but the least number of courses in these students?
CREATE TABLE candidates ( candidate_id number, candidate_details text ) CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from time, date_to time ) CREATE TABLE candidate_assessments ( candidate_id number, qualification text, as...
SELECT student_id FROM student_course_registrations GROUP BY student_id ORDER BY COUNT(*) LIMIT 1
how many patients whose admission type is urgent and diagnoses short title is hemochromatos-rbc trans?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "URGENT" AND diagnoses.short_title = "Hemochromatos-rbc trans"
Find the id of the courses that do not have any prerequisite?
CREATE TABLE classroom ( building text, room_number text, capacity number ) CREATE TABLE prereq ( course_id text, prereq_id text ) CREATE TABLE takes ( id text, course_id text, sec_id text, semester text, year number, grade text ) CREATE TABLE section ( course_id text,...
SELECT course_id FROM course EXCEPT SELECT course_id FROM prereq
provide the number of patients whose diagnoses short title is hx-rectal & anal malign and lab test abnormal status is abnormal?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Hx-rectal & anal malign" AND lab.flag = "abnormal"
count the number of patients whose year of birth is less than 1846 and drug route is po?
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 INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "1846" AND prescriptions.route = "PO"
provide the number of patients whose days of hospital stay is greater than 16 and drug name is sw?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "16" AND prescriptions.drug = "SW"
What is the relationship between Credits and Instructor ?
CREATE TABLE Member_of ( FacID INTEGER, DNO INTEGER, Appt_Type VARCHAR(15) ) CREATE TABLE Course ( CID VARCHAR(7), CName VARCHAR(40), Credits INTEGER, Instructor INTEGER, Days VARCHAR(5), Hours VARCHAR(11), DNO INTEGER ) CREATE TABLE Faculty ( FacID INTEGER, Lname VARCH...
SELECT Credits, Instructor FROM Course ORDER BY Credits
Return the order ids and details for orderes with two or more invoices.
CREATE TABLE products ( product_id number, parent_product_id number, production_type_code text, unit_price number, product_name text, product_color text, product_size text ) CREATE TABLE customers ( customer_id number, customer_first_name text, customer_middle_initial text, ...
SELECT T2.order_id, T2.order_details FROM invoices AS T1 JOIN orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING COUNT(*) > 2
Find the average number of bedrooms of all the apartments.
CREATE TABLE view_unit_status ( apt_id number, apt_booking_id number, status_date time, available_yn others ) CREATE TABLE apartment_facilities ( apt_id number, facility_code text ) CREATE TABLE apartments ( apt_id number, building_id number, apt_type_code text, apt_number text...
SELECT AVG(bedroom_count) FROM apartments
count the number of patients whose primary disease is hypertension;rule out coronary artery disease/cardiac cath and drug route is sc.
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" AND prescriptions.route = "SC"
get me the number of patients suffering from celo-vessicle fistula primary disease.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CELO-VESSICLE FISTULA"
are there any monte carlo simulation papers since 2011 ?
CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE T...
SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'monte carlo simulation' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND paper.year > 2011
How many patients diagnosed with paroxysmal ventricular tachycardia have a hematology lab test category?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Paroxysmal ventricular tachycardia" AND lab."CATEGORY" = "Hematology"
how many patients hospital stay is more than 4 days with drug code cita20?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) C...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "4" AND prescriptions.formulary_drug_cd = "CITA20"
A bar chart for finding the number of the parties associated with the delegates from district 1 Who served as governors of the parties?, show in desc by the y-axis.
CREATE TABLE party ( Party_ID int, Year real, Party text, Governor text, Lieutenant_Governor text, Comptroller text, Attorney_General text, US_Senate text ) CREATE TABLE election ( Election_ID int, Counties_Represented text, District int, Delegate text, Party int, ...
SELECT Governor, COUNT(Governor) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 GROUP BY Governor ORDER BY COUNT(Governor) DESC
what is maximum age of patients whose discharge location is short term hospital and days of hospital stay is 15?
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 MAX(demographic.age) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.days_stay = "15"
what is religion of subject name paul edwards?
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.religion FROM demographic WHERE demographic.name = "Paul Edwards"
For those employees who was hired before 2002-06-21, give me the comparison about the sum of department_id over the job_id , and group by attribute job_id by a bar chart.
CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT JOB_ID, SUM(DEPARTMENT_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
How many sections does each course has Visualize by bar chart, and rank y axis in descending order.
CREATE TABLE ENROLL ( CLASS_CODE varchar(5), STU_NUM int, ENROLL_GRADE varchar(50) ) CREATE TABLE PROFESSOR ( EMP_NUM int, DEPT_CODE varchar(10), PROF_OFFICE varchar(50), PROF_EXTENSION varchar(4), PROF_HIGH_DEGREE varchar(5) ) CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varc...
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE ORDER BY COUNT(*) DESC
provide the number of patients whose primary disease is ruq pain and year of birth is less than 2112?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "RUQ PAIN" AND demographic.dob_year < "2112"
how many patients whose discharge location is rehab/distinct part hosp and primary disease is syncope;telemetry?
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.discharge_location = "REHAB/DISTINCT PART HOSP" AND demographic.diagnosis = "SYNCOPE;TELEMETRY"
what is the number of patients whose marital status is widowed and procedure icd9 code is 4105?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.marital_status = "WIDOWED" AND procedures.icd9_code = "4105"
Find the name of the instructors who taught C Programming course before.
CREATE TABLE student ( id text, name text, dept_name text, tot_cred number ) CREATE TABLE teaches ( id text, course_id text, sec_id text, semester text, year number ) CREATE TABLE classroom ( building text, room_number text, capacity number ) CREATE TABLE instructor ( ...
SELECT T1.name FROM instructor AS T1 JOIN teaches AS T2 ON T1.id = T2.id JOIN course AS T3 ON T2.course_id = T3.course_id WHERE T3.title = 'C Programming'
How many patients admitted before the year 2151 had clinical chemistry tests by lab?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE 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.admityear < "2151" AND lab."CATEGORY" = "Chemistry"
What is the first name of all employees who do not give any lessons?
CREATE TABLE lessons ( lesson_id number, customer_id number, lesson_status_code text, staff_id number, vehicle_id number, lesson_date time, lesson_time text, price number ) CREATE TABLE addresses ( address_id number, line_1_number_building text, city text, zip_postcode t...
SELECT first_name FROM staff EXCEPT SELECT T2.first_name FROM lessons AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id
For those employees who did not have any job in the past, visualize the relationship between salary and commission_pct .
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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID ...
SELECT SALARY, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
What are the types of competition and number of competitions for that type Show bar chart, and display names in ascending order.
CREATE TABLE competition ( Competition_ID int, Year real, Competition_type text, Country text ) CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text ) CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Trie...
SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type
give me the number of patients whose age is less than 71 and procedure long title is central venous catheter placement with guidance?
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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "71" AND procedures.long_title = "Central venous catheter placement with guidance"
how many patients whose drug code is dapt500i and lab test fluid is ascites?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.formulary_drug_cd = "DAPT500I" AND lab.fluid = "Ascites"
List all customer status codes and the number of customers having each status code, order from high to low by the y-axis.
CREATE TABLE Vehicles ( vehicle_id INTEGER, vehicle_details VARCHAR(255) ) CREATE TABLE Customers ( customer_id INTEGER, customer_address_id INTEGER, customer_status_code VARCHAR(15), date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR(80), last_name VARCHAR(80...
SELECT customer_status_code, COUNT(*) FROM Customers GROUP BY customer_status_code ORDER BY COUNT(*) DESC
what is minimum age of patients whose marital status is married and discharge location is disch-tran to psych hosp?
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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.discharge_location = "DISCH-TRAN TO PSYCH HOSP"
What journals has james landay published in ?
CREATE TABLE field ( fieldid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ...
SELECT DISTINCT paper.journalid FROM author, paper, writes WHERE author.authorname = 'james landay' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.journalid
how many patients whose drug type is main and lab test name is lipase?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "MAIN" AND lab.label = "Lipase"
What is the green rating for the vehicle with L/100km urban (cold) over 10.9, mpg in the US (urban) over 14.1, manufacturer of Volkswagen, and engine capacity under 3189?
CREATE TABLE table_14146 ( "Manufacturer" text, "Transmission" text, "Engine Capacity" real, "Fuel Type" text, "L/100km Urban (Cold)" real, "L/100km Extra-Urban" real, "L/100km Combined" real, "mpg-UK Urban (Cold)" real, "mpg-UK Extra-Urban" real, "mpg-UK Combined" real, "mpg...
SELECT "Green Rating" FROM table_14146 WHERE "L/100km Urban (Cold)" > '10.9' AND "mpg-US Urban" > '14.1' AND "Manufacturer" = 'volkswagen' AND "Engine Capacity" < '3189'
For those employees who do not work in departments with managers that have ids between 100 and 200, find first_name and department_id , and visualize them by a bar chart, I want to list from low to high by the DEPARTMENT_ID.
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 varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JO...
SELECT FIRST_NAME, 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
Return a histogram on what are the names and budgets of departments with budgets greater than the average?, order by the budget from high to low.
CREATE TABLE advisor ( s_ID varchar(5), i_ID varchar(5) ) CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE teaches ( ID varchar(5), course_id varchar(8), sec_id varchar(8), semester varchar(6), year numeric...
SELECT dept_name, budget FROM department WHERE budget > (SELECT AVG(budget) FROM department) ORDER BY budget DESC
What are the employee ids of employees who report to Payam, and what are their salaries?
CREATE TABLE countries ( country_id text, country_name text, region_id number ) CREATE TABLE jobs ( job_id text, job_title text, min_salary number, max_salary number ) CREATE TABLE job_history ( employee_id number, start_date time, end_date time, job_id text, department...
SELECT employee_id, salary FROM employees WHERE manager_id = (SELECT employee_id FROM employees WHERE first_name = 'Payam')
For those employees who did not have any job in the past, visualize a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, and rank by the y-axis in asc.
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 JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID)
For those employees who was hired before 2002-06-21, a bar chart shows the distribution of job_id and the sum of manager_id , and group by attribute job_id.
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 JOB_ID, SUM(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
what is the number of patients whose marital status is divorced and ethnicity is unknown/not specified?
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 WHERE demographic.marital_status = "DIVORCED" AND demographic.ethnicity = "UNKNOWN/NOT SPECIFIED"
What is the maximum total amount paid by a customer? List the customer id and amount.
CREATE TABLE discount_coupons ( coupon_id number, date_issued time, coupon_amount number ) CREATE TABLE products_booked ( booking_id number, product_id number, returned_yn text, returned_late_yn text, booked_count number, booked_amount number ) CREATE TABLE view_product_availabilit...
SELECT customer_id, SUM(amount_paid) FROM payments GROUP BY customer_id ORDER BY SUM(amount_paid) DESC LIMIT 1
What was the first paper on LSTM written ?
CREATE TABLE cite ( citingpaperid int, citedpaperid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperfield ( fieldid int, paper...
SELECT DISTINCT paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'LSTM' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.year ORDER BY paper.year
Find the number of students who took some course and got A or C and group by last name in a pie chart.
CREATE TABLE CLASS ( CLASS_CODE varchar(5), CRS_CODE varchar(10), CLASS_SECTION varchar(2), CLASS_TIME varchar(20), CLASS_ROOM varchar(8), PROF_NUM int ) CREATE TABLE DEPARTMENT ( DEPT_CODE varchar(10), DEPT_NAME varchar(30), SCHOOL_CODE varchar(8), EMP_NUM int, DEPT_ADDRESS...
SELECT STU_LNAME, COUNT(STU_LNAME) FROM STUDENT AS T1 JOIN ENROLL AS T2 ON T1.STU_NUM = T2.STU_NUM WHERE T2.ENROLL_GRADE = 'C' OR T2.ENROLL_GRADE = 'A' GROUP BY STU_LNAME
What are the employee ids, full names, and job ids for employees who make more than the highest earning employee with title PU_MAN?
CREATE TABLE departments ( department_id number, department_name text, manager_id number, location_id number ) CREATE TABLE employees ( employee_id number, first_name text, last_name text, email text, phone_number text, hire_date time, job_id text, salary number, com...
SELECT employee_id, first_name, last_name, job_id FROM employees WHERE salary > (SELECT MAX(salary) FROM employees WHERE job_id = 'PU_MAN')
Show me a bar chart for how many students are advised by each rank of faculty? List the rank and the number of students.
CREATE TABLE Participates_in ( stuid INTEGER, actid INTEGER ) 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 IN...
SELECT Rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.Advisor GROUP BY T1.Rank
count the number of patients whose diagnoses icd9 code is v1000 and lab test fluid is ascites?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "V1000" AND lab.fluid = "Ascites"
first deep learning paper
CREATE TABLE author ( authorid int, authorname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TAB...
SELECT DISTINCT paper.year FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'deep learning' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.year ORDER BY paper.year
how many patients whose diagnoses long title is ulcer of other part of foot and drug type is base?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Ulcer of other part of foot" AND prescriptions.drug_type = "BASE"
give me the number of patients whose primary disease is hypertension;rule out coronary artery disease\cardiac cath and year of birth is less than 2110?
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 WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" AND demographic.dob_year < "2110"
For all employees who have the letters D or S in their first name, give me the trend about commission_pct over hire_date , and I want to rank x axis from low to high order.
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, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
What has ras bodik published ?
CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE field ( fieldid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TAB...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'ras bodik' AND writes.authorid = author.authorid
how many male patients had the diagnoses titled pseudomonas infect nos?
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.gender = "M" AND diagnoses.short_title = "Pseudomonas infect NOS"