instruction
stringlengths
11
446
input
stringlengths
195
2.3k
response
stringlengths
26
460
provide the number of patients whose year of birth is less than 2089 and lab test fluid is joint fluid?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2089" AND lab.fluid = "Joint Fluid"
How many patients aged below 43 years old are diagnosed with prob-head/neck/trunk nos?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE 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.age < "43" AND diagnoses.short_title = "Prob-head/neck/trunk NOS"
find the number of patients with blood gas lab test category who were hospitalized for more than 7 days.
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.days_stay > "7" AND lab."CATEGORY" = "Blood Gas"
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, draw a bar chart about the distribution of job_id and the average of department_id , and group by attribute job_id, and I want to show from low to high by the names.
CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varc...
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
count the number of patients whose 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 lab ON demographic.hadm_id = lab.hadm_id WHERE lab.fluid = "Blood"
Show all role codes with at least 3 employees.
CREATE TABLE ref_calendar ( calendar_date time, day_number number ) CREATE TABLE roles ( role_code text, role_name text, role_description text ) CREATE TABLE ref_document_types ( document_type_code text, document_type_name text, document_type_description text ) CREATE TABLE documents_...
SELECT role_code FROM employees GROUP BY role_code HAVING COUNT(*) >= 3
how many patients whose year of birth is less than 2200 and item id is 50882?
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.dob_year < "2200" AND lab.itemid = "50882"
what is the number of patients whose admission type is urgent and with procedure prophylactic administration of vaccine against other diseases?
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.admission_type = "URGENT" AND procedures.long_title = "Prophylactic administration of vaccine against other diseases"
what is date of birth and diagnoses icd9 code of subject name jerry deberry?
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 demographic.dob, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Jerry Deberry"
how many patients whose procedure long title is non-invasive mechanical ventilation?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic (...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.long_title = "Non-invasive mechanical ventilation"
Return the average price of products that have each category code.
CREATE TABLE Complaints ( complaint_id INTEGER, product_id INTEGER, customer_id INTEGER, complaint_outcome_code VARCHAR(20), complaint_status_code VARCHAR(20), complaint_type_code VARCHAR(20), date_complaint_raised DATETIME, date_complaint_closed DATETIME, staff_id INTEGER ) CREATE ...
SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code
how many patients whose diagnoses icd9 code is 6824 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 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.icd9_code = "6824" AND lab."CATEGORY" = "Blood Gas"
what is maximum age of patients whose insurance is private and discharge location is home?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT MAX(demographic.age) FROM demographic WHERE demographic.insurance = "Private" AND demographic.discharge_location = "HOME"
how many patients posses private insurance and followed the procedure continous intra-arterial blood gas monitoring?
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.insurance = "Private" AND procedures.long_title = "Continuous intra-arterial blood gas monitoring"
Count the number of patients admitted before 2124 categorized under chemistry lab tests.
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2124" AND lab."CATEGORY" = "Chemistry"
How many courses do the student whose id is 171 attend?
CREATE TABLE candidates ( candidate_id number, candidate_details text ) CREATE TABLE student_course_registrations ( student_id number, course_id number, registration_date time ) CREATE TABLE people_addresses ( person_address_id number, person_id number, address_id number, date_from...
SELECT COUNT(*) FROM courses AS T1 JOIN student_course_attendance AS T2 ON T1.course_id = T2.course_id WHERE T2.student_id = 171
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 bar chart shows the distribution of hire_date and the average of department_id bin hire_date by weekday, and order in desc by the the average of department 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 employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 ORDER BY AVG(DEPARTMENT_ID) DESC
what is language of subject name charles deshay?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT demographic.language FROM demographic WHERE demographic.name = "Charles Deshay"
Show all card type codes and the number of cards in each type by a bar chart, and I want to rank names in ascending order.
CREATE TABLE Accounts ( account_id INTEGER, customer_id INTEGER, account_name VARCHAR(50), other_account_details VARCHAR(255) ) CREATE TABLE Financial_Transactions ( transaction_id INTEGER, previous_transaction_id INTEGER, account_id INTEGER, card_id INTEGER, transaction_type VARCHA...
SELECT card_type_code, COUNT(*) FROM Customers_Cards GROUP BY card_type_code ORDER BY card_type_code
find the number of hispanic/latino-puerto rican ethnic background patients who were born before 2071.
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.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.dob_year < "2071"
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of hire_date and the amount of hire_date bin hire_date by weekday, and rank in asc 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 HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY COUNT(HIRE_DATE)
what is maximum age of patients whose primary disease is overdose and days of hospital stay is 69?
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.diagnosis = "OVERDOSE" AND demographic.days_stay = "69"
count the number of living patients who underwent endoscopic sphincterotomy and papillotomy.
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Endoscopic sphincterotomy and papillotomy"
count the number of patients whose year of death is less than or equal to 2138 and procedure long title is other diagnostic procedures on nasal sinuses?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2138.0" AND procedures.long_title = "Other diagnostic procedures on nasal sinuses"
how many patients whose age is less than 27 and drug route is left eye?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "27" AND prescriptions.route = "LEFT EYE"
What is the sum of credit value of courses with more than one prerequisite for each department? Return a bar chart, and show in descending by the dept_name.
CREATE TABLE instructor ( ID varchar(5), name varchar(20), dept_name varchar(20), salary numeric(8,2) ) CREATE TABLE prereq ( course_id varchar(8), prereq_id varchar(8) ) CREATE TABLE time_slot ( time_slot_id varchar(4), day varchar(1), start_hr numeric(2), start_min numeric(2)...
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 DESC
Tell me the number of orders with 'Second time' as order detail.
CREATE TABLE order_items ( order_id number, product_id number, order_quantity text ) CREATE TABLE addresses ( address_id number, address_content text, city text, zip_postcode text, state_province_county text, country text, other_address_details text ) CREATE TABLE products ( ...
SELECT COUNT(*) FROM customer_orders WHERE order_details = "Second time"
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the amount of job_id , and group by attribute job_id in a bar chart.
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), ...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID
Find the claim that has the largest total settlement amount. Return the effective date of the claim.
CREATE TABLE services ( service_id number, service_name text ) CREATE TABLE first_notification_of_loss ( fnol_id number, customer_id number, policy_id number, service_id number ) CREATE TABLE customers ( customer_id number, customer_name text ) CREATE TABLE claims ( claim_id numbe...
SELECT t1.effective_date FROM claims AS t1 JOIN settlements AS t2 ON t1.claim_id = t2.claim_id GROUP BY t1.claim_id ORDER BY SUM(t2.settlement_amount) DESC LIMIT 1
Display a bar chart for what is the average salary for each job title?
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
For each building, show the name of the building and the number of institutions in it Plot them as bar chart, and display X from low to high order.
CREATE TABLE Institution ( Institution_id text, Institution text, Location text, Founded real, Type text, Enrollment int, Team text, Primary_Conference text, building_id text ) CREATE TABLE protein ( common_name text, protein_name text, divergence_from_human_lineage real...
SELECT Name, COUNT(*) FROM building AS T1 JOIN Institution AS T2 ON T1.building_id = T2.building_id GROUP BY T1.building_id ORDER BY Name
how many patients had the drug code acet650r?
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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "ACET650R"
Visualize the general trend of sum share count over the date of transaction, sort in descending by the X-axis.
CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Ref_Transaction_Types ( transaction_type_code VARCHAR(10), transaction_type_description VARCHAR(80) ) CREATE TABLE Sales ( sales_transaction_id INTEGER, sales_details VARCHAR(255) ) CREATE TABLE Transac...
SELECT date_of_transaction, SUM(share_count) FROM Transactions ORDER BY date_of_transaction DESC
what is death status and procedure long title of subject name bruce harris?
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 demographic.expire_flag, procedures.long_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Bruce Harris"
Bar chart x axis lot details y axis the number of lot details, rank in ascending by the total number.
CREATE TABLE Transactions_Lots ( transaction_id INTEGER, lot_id INTEGER ) CREATE TABLE Lots ( lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR(255) ) CREATE TABLE Investors ( investor_id INTEGER, Investor_details VARCHAR(255) ) CREATE TABLE Ref_Transaction_Types ( transaction_...
SELECT lot_details, COUNT(lot_details) FROM Lots GROUP BY lot_details ORDER BY COUNT(lot_details)
What are the different product colors?
CREATE TABLE financial_transactions ( transaction_id number, account_id number, invoice_number number, transaction_type text, transaction_date time, transaction_amount number, transaction_comment text, other_transaction_details text ) CREATE TABLE products ( product_id number, p...
SELECT DISTINCT product_color FROM products
what is the number of patients with gastrointestinal bleed primary disease who stayed in hospital for more than 14 days?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GASTROINTESTINAL BLEED" AND demographic.days_stay > "14"
For all employees who have the letters D or S in their first name, for salary, hire_date, visualize the trend, and order in asc by the x axis.
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, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE
how many patients are admitted in emergency room and diagnosed primarily for transient ischemic attack?
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.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.diagnosis = "TRANSIENT ISCHEMIC ATTACK"
how many living patients had globulin lab test done?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "Globulin"
count the number of patients whose marital status is widowed and lab test fluid is cerebrospinal fluid (csf)?
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.marital_status = "WIDOWED" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
what is the primary disease and diagnosis short title of subject id 17772?
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 demographic.diagnosis, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "17772"
What is the total number of names of products?, rank by the y-axis in ascending.
CREATE TABLE Products_in_Events ( Product_in_Event_ID INTEGER, Event_ID INTEGER, Product_ID INTEGER ) 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 Locations ( Loc...
SELECT Product_Name, COUNT(Product_Name) FROM Products GROUP BY Product_Name ORDER BY COUNT(Product_Name)
what is the number of patients whose diagnoses long title is abdominal pain, other specified site and drug type is main?
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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Abdominal pain, other specified site" AND prescriptions.drug_type = "MAIN"
count the number of patients whose death status is 0 and procedure long title is allogeneic hematopoietic stem cell transpant without purging?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.long_title = "Allogeneic hematopoietic stem cell transpant without purging"
papers by oren etzioni
CREATE TABLE keyphrase ( keyphraseid int, keyphrasename varchar ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE field ( fieldid int ) CREATE TABLE paperdataset ( paperid int, datasetid int ) ...
SELECT DISTINCT writes.paperid FROM author, writes WHERE author.authorname = 'oren etzioni' AND writes.authorid = author.authorid
Line chart, the X is the hire date of employees and the Y-axis is the corresponding salary, and I want to list X-axis from high to low order.
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 employees ( EMPLOYE...
SELECT HIRE_DATE, SALARY FROM employees ORDER BY HIRE_DATE DESC
how many patients whose admission type is newborn and diagnoses long title is esophageal reflux?
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 = "NEWBORN" AND diagnoses.long_title = "Esophageal reflux"
give me the number of patients whose ethnicity is white - russian and drug route is id?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.route = "ID"
what number of patients with diagnoses icd9 code 99592 passed away in or before the year 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 COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dod_year <= "2164.0" AND diagnoses.icd9_code = "99592"
what is primary disease and discharge time of subject id 26285?
CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location t...
SELECT demographic.diagnosis, demographic.dischtime FROM demographic WHERE demographic.subject_id = "26285"
how many patients are admitted before the year 2162 and diagnosed with icd9 code v1009?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE prescriptions...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2162" AND diagnoses.icd9_code = "V1009"
Who has published more papers in NSDI ?
CREATE TABLE paperfield ( fieldid int, paperid int ) CREATE TABLE writes ( paperid int, authorid int ) CREATE TABLE paperkeyphrase ( paperid int, keyphraseid int ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE dataset ( datasetid int, datasetname va...
SELECT DISTINCT COUNT(DISTINCT paper.paperid), writes.authorid FROM paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'NSDI' AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(DISTINCT paper.paperid) DESC
Find the number of hispanic or latino-puerto rican patients who were born before 2200.
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND demographic.dob_year < "2200"
What is the highest student GPA for every department? Return a bar chart, and list X in asc order.
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE EM...
SELECT DEPT_CODE, MAX(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE
What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?
CREATE TABLE orders ( order_id number, customer_id number, order_status text, date_order_placed time, order_details text ) CREATE TABLE shipment_items ( shipment_id number, order_item_id number ) CREATE TABLE products ( product_id number, product_name text, product_details text...
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
what is minimum age of patients whose marital status is married and age is greater than or equal to 36?
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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.age >= "36"
For those employees who did not have any job in the past, draw a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, order from low to high by the Y.
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 HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(SALARY)
what is the number of medicare patients who have procedure icd9 code 9703?
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.insurance = "Medicare" AND procedures.icd9_code = "9703"
what is subject name and marital status of subject id 2560?
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 lab ( subject_id text, hadm_id text, ...
SELECT demographic.name, demographic.marital_status FROM demographic WHERE demographic.subject_id = "2560"
List the number of completion students in each day and bin date of completion by weekday with a bar chart.
CREATE TABLE Course_Authors_and_Tutors ( author_id INTEGER, author_tutor_ATB VARCHAR(3), login_name VARCHAR(40), password VARCHAR(40), personal_name VARCHAR(80), middle_name VARCHAR(80), family_name VARCHAR(80), gender_mf VARCHAR(1), address_line_1 VARCHAR(80) ) CREATE TABLE Student...
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment
what is the average age of patients who have stayed in the hospital for 4 days with a government insurance policy?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( ...
SELECT AVG(demographic.age) FROM demographic WHERE demographic.insurance = "Government" AND demographic.days_stay = "4"
A bar chart about how many classes are held in each department?
CREATE TABLE COURSE ( CRS_CODE varchar(10), DEPT_CODE varchar(10), CRS_DESCRIPTION varchar(35), CRS_CREDIT float(8) ) 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 EMPLOYEE...
SELECT DEPT_CODE, COUNT(*) FROM CLASS AS T1 JOIN COURSE AS T2 ON T1.CRS_CODE = T2.CRS_CODE GROUP BY DEPT_CODE
how many patients staying in the hospital for more than 20 days had the procedure under icd9 code 9907?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob te...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "20" AND procedures.icd9_code = "9907"
give me the number of patients whose death status is 0 and procedure short title is int insert lead in vent?
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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.short_title = "Int insert lead in vent"
For all employees who have the letters D or S in their first name, draw a bar chart about the distribution of hire_date and the average of salary bin hire_date by time, I want to sort in asc by the Y-axis.
CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY AVG(SALARY)
Bar chart of the number of course name from each course name
CREATE TABLE Candidates ( candidate_id INTEGER, candidate_details VARCHAR(255) ) CREATE TABLE Student_Course_Attendance ( student_id INTEGER, course_id INTEGER, date_of_attendance DATETIME ) CREATE TABLE People_Addresses ( person_address_id INTEGER, person_id INTEGER, address_id INTEGE...
SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name
count the number of patients whose primary disease is bowel obstruction and age is less than 56?
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.diagnosis = "BOWEL OBSTRUCTION" AND demographic.age < "56"
how many patients whose diagnoses long title is perforation of intestine and lab test category is blood gas?
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 lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Perforation of intestine" AND lab."CATEGORY" = "Blood Gas"
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of hire_date and the average of salary bin hire_date by weekday, could you order the average of salary in ascending order?
CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL v...
SELECT HIRE_DATE, AVG(SALARY) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(SALARY)
How many papers does james fogarty have in uist ?
CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numcitedby int, journalid int ) CREATE TABLE venue ( venueid int, venuename varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE writes ( paperid int, ...
SELECT DISTINCT COUNT(paper.paperid) FROM author, paper, venue, writes WHERE author.authorname = 'james fogarty' AND venue.venueid = paper.venueid AND venue.venuename = 'uist' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
count the number of patients less than 41 years for whom urine lab test was ordered.
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "41" AND lab.fluid = "Urine"
give me the number of patients whose death status is 0 and diagnoses icd9 code is 78052?
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.expire_flag = "0" AND diagnoses.icd9_code = "78052"
give me the number of patients whose lab test name is glucose, csf?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.label = "Glucose, CSF"
For those employees who was hired before 2002-06-21, draw a bar chart about the distribution of job_id and the amount of job_id , and group by attribute job_id, order bars from high to low order please.
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40)...
SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY JOB_ID DESC
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of first_name and commission_pct .
CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(4...
SELECT FIRST_NAME, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
how many patients are diagnosed with the history of tobacco use and tested under the lab category 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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text,...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "History of tobacco use" AND lab."CATEGORY" = "Blood Gas"
Return a scatter on what is the average salary of employees who have a commission percentage that is not null?
CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), ...
SELECT DEPARTMENT_ID, AVG(SALARY) FROM employees WHERE COMMISSION_PCT <> "null" GROUP BY DEPARTMENT_ID
how many female patients had the item id 51351?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.gender = "F" AND lab.itemid = "51351"
count the number of patients whose admission type is elective and admission location is phys referral/normal deli?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admission_location = "PHYS REFERRAL/NORMAL DELI"
Pie. how many departments are in each school?
CREATE TABLE STUDENT ( STU_NUM int, STU_LNAME varchar(15), STU_FNAME varchar(15), STU_INIT varchar(1), STU_DOB datetime, STU_HRS int, STU_CLASS varchar(2), STU_GPA float(8), STU_TRANSFER numeric, DEPT_CODE varchar(18), STU_PHONE varchar(4), PROF_NUM int ) CREATE TABLE EM...
SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT
how many patients on inhalation route of drug administration have other psoriasis diagnoses?
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Other psoriasis" AND prescriptions.route = "INHALATION"
provide the number of patients whose primary disease is stemi and who have died before or in year 2183.
CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id t...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "STEMI" AND demographic.dod_year <= "2183.0"
What details are there on the research staff? List the result in ascending alphabetical order, and count them by a bar chart
CREATE TABLE Research_Outcomes ( outcome_code VARCHAR(10), outcome_description VARCHAR(255) ) CREATE TABLE Organisation_Types ( organisation_type VARCHAR(10), organisation_type_description VARCHAR(255) ) CREATE TABLE Tasks ( task_id INTEGER, project_id INTEGER, task_details VARCHAR(255), ...
SELECT staff_details, COUNT(staff_details) FROM Research_Staff GROUP BY staff_details ORDER BY staff_details
provide the number of patients whose admission year is less than 2174 and diagnoses short title is thrush?
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.admityear < "2174" AND diagnoses.short_title = "Thrush"
how many patients are primarily diagnosed for s/p hanging and died in or before 2126?
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 = "S/P HANGING" AND demographic.dod_year <= "2126.0"
what is the primary disease for the patient id 92796?
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) C...
SELECT demographic.diagnosis FROM demographic WHERE demographic.subject_id = "92796"
how many government health insurance patients were diagnosed with retained foreign body of plastic fragments?
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.insurance = "Government" AND diagnoses.short_title = "Retain plastic fragments"
List the all the distinct names of the products with the characteristic name 'warm'.
CREATE TABLE characteristics ( characteristic_id number, characteristic_type_code text, characteristic_data_type text, characteristic_name text, other_characteristic_details text ) CREATE TABLE product_characteristics ( product_id number, characteristic_id number, product_characteristic...
SELECT DISTINCT t1.product_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 t3.characteristic_name = "warm"
What are the birth places of players won on hall of fame since 1871?
CREATE TABLE hall_of_fame ( player_id text, yearid number, votedby text, ballots text, needed text, votes text, inducted text, category text, needed_note text ) CREATE TABLE player_award ( player_id text, award_id text, year number, league_id text, tie text, ...
SELECT T1.birth_country FROM hall_of_fame AS T2 JOIN player AS T1 ON T1.player_id = T2.player_id WHERE T2.inducted = "Y" AND T2.yearid >= 1871
which patients underwent atrial cardioversion and are still alive?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.short_title = "Atrial cardioversion"
Give me a group line chart showing the number of documents in different ending date. The x-axis is ending date and group by location code.
CREATE TABLE Ref_Locations ( Location_Code CHAR(15), Location_Name VARCHAR(255), Location_Description VARCHAR(255) ) CREATE TABLE Ref_Document_Types ( Document_Type_Code CHAR(15), Document_Type_Name VARCHAR(255), Document_Type_Description VARCHAR(255) ) CREATE TABLE All_Documents ( Documen...
SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Location_Code, Date_in_Locaton_To
For those employees who did not have any job in the past, return a scatter chart about the correlation between employee_id and commission_pct .
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 jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decima...
SELECT EMPLOYEE_ID, COMMISSION_PCT FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
provide the number of patients whose admission type is elective and procedure long title is umbilical vein catheterization?
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.admission_type = "ELECTIVE" AND procedures.long_title = "Umbilical vein catheterization"
how many patients marital status is married and are below 31 years of age?
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.marital_status = "MARRIED" AND demographic.age < "31"
What conferences does Noah A. Smith publish in ?
CREATE TABLE dataset ( datasetid int, datasetname varchar ) CREATE TABLE journal ( journalid int, journalname varchar ) CREATE TABLE paperdataset ( paperid int, datasetid int ) CREATE TABLE paper ( paperid int, title varchar, venueid int, year int, numciting int, numci...
SELECT DISTINCT paper.venueid FROM author, paper, writes WHERE author.authorname = 'Noah A. Smith' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
Find the number of patients whose ethnicity is white - russian and drug route is ivpca?
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.ethnicity = "WHITE - RUSSIAN" AND prescriptions.route = "IVPCA"
Show me about the distribution of meter_200 and the average of meter_100 , and group by attribute meter_200 in a bar chart, and could you show mean meter 100 from low to high order?
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 meter_200, AVG(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY AVG(meter_100)
Find the name of the activity that has the largest number of student participants.
CREATE TABLE participates_in ( stuid number, actid number ) CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text ) CREATE TABLE faculty_participates_in ( facid number, actid number ) CREATE TABL...
SELECT T1.activity_name FROM activity AS T1 JOIN participates_in AS T2 ON T1.actid = T2.actid GROUP BY T1.actid ORDER BY COUNT(*) DESC LIMIT 1
how many patients admitted to emergency were treated with abacavir sulfate?
CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, ...
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND prescriptions.drug = "Abacavir Sulfate"