instruction stringlengths 11 446 | input stringlengths 195 2.3k | response stringlengths 26 460 |
|---|---|---|
what is minimum age of patients whose marital status is divorced and primary disease is angioedema? | 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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.diagnosis = "ANGIOEDEMA" |
For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of hire_date and the sum of department_id bin hire_date by time in a bar chart. | CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLO... | SELECT HIRE_DATE, SUM(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) |
find out the short title of diagnoses and long title of diagnoses for patient with patient id 11221. | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT diagnoses.short_title, procedures.long_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "11221" |
For those employees who did not have any job in the past, draw a scatter chart about the correlation between commission_pct and department_id . | 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 COMMISSION_PCT, DEPARTMENT_ID FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
what is the number of patients whose language is span and year of birth is less than 2052? | 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.language = "SPAN" AND demographic.dob_year < "2052" |
what datasets do papers at ACL use most ? | CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE paperfield (
fieldid int,
paperid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrasename varchar
)
CREATE TABLE venue (
venueid int,
venuename var... | SELECT DISTINCT dataset.datasetid FROM dataset, paper, paperdataset, venue WHERE paperdataset.datasetid = dataset.datasetid AND paper.paperid = paperdataset.paperid AND venue.venueid = paper.venueid AND venue.venuename = 'ACL' |
what is the number of patients whose year of birth is less than 2104 and drug route is td? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "2104" AND prescriptions.route = "TD" |
For those employees who was hired before 2002-06-21, show me about the distribution of job_id and the average of salary , and group by attribute job_id in a bar chart, order by the Y-axis from low to high please. | 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 countries (
COUNT... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) |
A bar chart about what are the student IDs and middle names of the students enrolled in at most two courses?, and I want to sort by the bars in descending. | 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 Subject... | SELECT T2.middle_name, T1.student_id FROM Student_Course_Enrolment AS T1 JOIN Students AS T2 ON T1.student_id = T2.student_id ORDER BY T2.middle_name DESC |
provide the number of patients whose days of hospital stay is greater than 34 and drug code is adva250ih? | 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 > "34" AND prescriptions.formulary_drug_cd = "ADVA250IH" |
how many black/cape verdean newborn patients were in the hospital? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "NEWBORN" AND demographic.ethnicity = "BLACK/CAPE VERDEAN" |
what is primary disease and procedure short title of subject name lue white? | 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, procedures.short_title FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.name = "Lue White" |
Return a bar chart on what is the number of professors for different school? | CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4)
)
CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50)
)
CREATE TABLE STUDENT (
STU_NUM... | SELECT SCHOOL_CODE, COUNT(*) FROM DEPARTMENT AS T1 JOIN PROFESSOR AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.SCHOOL_CODE |
what is average age of patients whose age is greater than or equal to 74 and admission year is greater than or equal to 2105? | 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 AVG(demographic.age) FROM demographic WHERE demographic.age >= "74" AND demographic.admityear >= "2105" |
how many patients whose admission type is emergency and diagnoses long title is morbid obesity? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND diagnoses.long_title = "Morbid obesity" |
what is maximum age of patients whose admission type is elective and insurance is medicaid? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.insurance = "Medicaid" |
count the number of patients whose year of death is less than or equal to 2168 and procedure icd9 code is 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 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.dod_year <= "2168.0" AND procedures.icd9_code = "14" |
Return the number of the completion date for all the tests that have 'Fail' result, and sort in desc by the X-axis. | CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Student_Tests_Taken (
registration_id IN... | SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment AS T1 JOIN Student_Tests_Taken AS T2 ON T1.registration_id = T2.registration_id WHERE T2.test_result = "Fail" GROUP BY date_of_completion ORDER BY date_of_completion DESC |
What is the number of start date of each apartment booking for each year? Return a bar chart, and order in asc by the how many booking start date. | CREATE TABLE Apartment_Buildings (
building_id INTEGER,
building_short_name CHAR(15),
building_full_name VARCHAR(80),
building_description VARCHAR(255),
building_address VARCHAR(255),
building_manager VARCHAR(50),
building_phone VARCHAR(80)
)
CREATE TABLE Apartment_Facilities (
apt_id I... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id ORDER BY COUNT(booking_start_date) |
For those employees who was hired before 2002-06-21, find job_id and the sum of employee_id , and group by attribute job_id, and visualize them by a bar chart, and sort y-axis from high to low order please. | CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal... | SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY SUM(EMPLOYEE_ID) DESC |
what is the number of patients whose marital status is single and diagnoses long title is malignant neoplasm of middle third of esophagus? | 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.marital_status = "SINGLE" AND diagnoses.long_title = "Malignant neoplasm of middle third of esophagus" |
how many patients whose admission location is emergency room admit and year of birth is less than 1850? | 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.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.dob_year < "1850" |
what is minimum age of patients whose admission type is urgent and year of birth is greater than 2175? | 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 MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.dob_year > "2175" |
which type of admission did patient with patient id 6983 have? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT demographic.admission_type FROM demographic WHERE demographic.subject_id = "6983" |
Show me about the distribution of family_name and author_id in a bar chart. | CREATE TABLE Students (
student_id INTEGER,
date_of_registration DATETIME,
date_of_latest_logon DATETIME,
login_name VARCHAR(40),
password VARCHAR(10),
personal_name VARCHAR(40),
middle_name VARCHAR(40),
family_name VARCHAR(40)
)
CREATE TABLE Subjects (
subject_id INTEGER,
subje... | SELECT family_name, author_id FROM Course_Authors_and_Tutors ORDER BY personal_name |
Scatter chart. what are the different account ids that have made financial transactions, as well as how many transactions correspond to each? | CREATE TABLE Financial_Transactions (
transaction_id INTEGER,
previous_transaction_id INTEGER,
account_id INTEGER,
card_id INTEGER,
transaction_type VARCHAR(15),
transaction_date DATETIME,
transaction_amount DOUBLE,
transaction_comment VARCHAR(255),
other_transaction_details VARCHAR(... | SELECT account_id, COUNT(*) FROM Financial_Transactions GROUP BY account_id |
provide the number of patients whose insurance is private and procedure icd9 code is 8847? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescription... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.icd9_code = "8847" |
calculate the number of dead patients who are less than 70 years of age. | 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.expire_flag = "1" AND demographic.age < "70" |
what is minimum age of patients whose admission location is trsf within this facility and primary disease is atrial fibrillation\thoracoscopic maze procedure bilateral/sda? | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT MIN(demographic.age) FROM demographic WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "ATRIAL FIBRILLATION\THORACOSCOPIC MAZE PROCEDURE BILATERAL/SDA" |
Calculate the minimum age of patients admitted to emergency on the same day | 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 MIN(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.days_stay = "0" |
give the number of patients whose item id is 51464 and lab test abnormal status is delta. | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51464" AND lab.flag = "delta" |
what is discharge location of subject name kelly gallardo? | 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.discharge_location FROM demographic WHERE demographic.name = "Kelly Gallardo" |
Bar chart of the frequency from each receipt date, and bin the date in weekday interval, and then show y axis in asc order. | CREATE TABLE Circulation_History (
document_id INTEGER,
draft_number INTEGER,
copy_number INTEGER,
employee_id INTEGER
)
CREATE TABLE Documents_Mailed (
document_id INTEGER,
mailed_to_address_id INTEGER,
mailing_date DATETIME
)
CREATE TABLE Documents (
document_id INTEGER,
document... | SELECT receipt_date, COUNT(receipt_date) FROM Documents ORDER BY COUNT(receipt_date) |
count the number of patients whose age is less than 67 and procedure short title is sm bowel exteriorization? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "67" AND procedures.short_title = "Sm bowel exteriorization" |
give the number of patients whose admission type is urgent and primary disease is pneumonia. | 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.admission_type = "URGENT" AND demographic.diagnosis = "PNEUMONIA" |
count the number of patients who were admitted in urgent care and stayed in the hospital for 6 days. | 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 AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.days_stay = "6" |
what is date of birth and diagnoses short title of subject id 66411? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT demographic.dob, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "66411" |
Show the ids of all employees who have authorized destruction. | CREATE TABLE all_documents (
document_id number,
date_stored time,
document_type_code text,
document_name text,
document_description text,
other_details text
)
CREATE TABLE ref_calendar (
calendar_date time,
day_number number
)
CREATE TABLE employees (
employee_id number,
role_... | SELECT DISTINCT destruction_authorised_by_employee_id FROM documents_to_be_destroyed |
Which start station had the most trips starting from August? Give me the name and id of the station. | CREATE TABLE status (
station_id number,
bikes_available number,
docks_available number,
time text
)
CREATE TABLE station (
id number,
name text,
lat number,
long number,
dock_count number,
city text,
installation_date text
)
CREATE TABLE trip (
id number,
duration ... | SELECT start_station_name, start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1 |
provide the number of patients diagnosed with mv collision nos-driver. | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Mv collision NOS-driver" |
On which day has it neither been foggy nor rained in the zip code of 94107, and count them by a bar chart, and I want to order in descending by the Y-axis. | CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
end_station_name TEXT,
end_station_id INTEGER,
bike_id INTEGER,
subscription_type TEXT,
zip_code INTEGER
)
CREATE TABLE status (
station_i... | SELECT date, COUNT(date) FROM weather WHERE zip_code = 94107 AND events <> "Fog" AND events <> "Rain" ORDER BY COUNT(date) DESC |
what is lab test fluid of subject name kelly gallardo? | 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 lab.fluid FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.name = "Kelly Gallardo" |
Draw a bar chart of date moved in versus how many date moved in, and order in desc by the Y please. | CREATE TABLE Customer_Events (
Customer_Event_ID INTEGER,
customer_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
resident_id INTEGER,
thing_id INTEGER
)
CREATE TABLE Organizations (
organization_id INTEGER,
parent_organization_id INTEGER,
organization_details VARCHAR(255)... | SELECT date_moved_in, COUNT(date_moved_in) FROM Customer_Events GROUP BY date_moved_in ORDER BY COUNT(date_moved_in) DESC |
what is maximum age of patients whose marital status is single and ethnicity is unknown/not specified? | 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.marital_status = "SINGLE" AND demographic.ethnicity = "UNKNOWN/NOT SPECIFIED" |
What are the names of all aircrafts that have won a match at least twice? | CREATE TABLE match (
round number,
location text,
country text,
date text,
fastest_qualifying text,
winning_pilot text,
winning_aircraft text
)
CREATE TABLE airport_aircraft (
id number,
airport_id number,
aircraft_id number
)
CREATE TABLE pilot (
pilot_id number,
name ... | SELECT T1.aircraft FROM aircraft AS T1 JOIN match AS T2 ON T1.aircraft_id = T2.winning_aircraft GROUP BY T2.winning_aircraft HAVING COUNT(*) >= 2 |
provide the number of patients whose admission type is elective and year of birth is less than 2043? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.dob_year < "2043" |
Find all the policy type codes associated with the customer 'Dayana Robel | CREATE TABLE policies (
policy_id number,
customer_id number,
policy_type_code text,
start_date time,
end_date time
)
CREATE TABLE claims_processing (
claim_processing_id number,
claim_id number,
claim_outcome_code text,
claim_stage_id number,
staff_id number
)
CREATE TABLE cla... | SELECT policy_type_code FROM policies AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_details = "Dayana Robel" |
Just show the employee's last name and their employee id using a bar chart, display in asc by the bars. | CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALA... | SELECT LAST_NAME, EMPLOYEE_ID FROM employees ORDER BY LAST_NAME |
A bar chart for finding the number of the parties associated with the delegates from district 1 or 2 Who served as comptrollers of the parties?, I want to list by the total number from high to low. | 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 Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller ORDER BY COUNT(Comptroller) DESC |
How many courses with more than one prerequisite for each title? Return a bar chart. | CREATE TABLE time_slot (
time_slot_id varchar(4),
day varchar(1),
start_hr numeric(2),
start_min numeric(2),
end_hr numeric(2),
end_min numeric(2)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
salary numeric(8,2)
)
CREATE TABLE course (
... | SELECT title, COUNT(title) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title |
what is the discharge location of Jerry Deberry? | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
... | SELECT demographic.discharge_location FROM demographic WHERE demographic.name = "Jerry Deberry" |
tell me the number of inpatient hospital admission patients who have hyperglycemia; hyponatremia primary disease. | 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.admission_location = "TRSF WITHIN THIS FACILITY" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
Give me a bar chart to compare the number of state provinces located in different cities, show from low to high by the bar. | CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0... | SELECT STATE_PROVINCE, COUNT(STATE_PROVINCE) FROM locations GROUP BY STATE_PROVINCE ORDER BY STATE_PROVINCE |
How is Phenylephrine administered? | 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 prescriptions.route FROM prescriptions WHERE prescriptions.drug = "PHENYLEPHrine" |
how many patients with hx traumatic fracture had a lab test for joint fluid? | 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.short_title = "Hx traumatic fracture" AND lab.fluid = "Joint Fluid" |
return me the number of organizations in Databases area . | CREATE TABLE publication_keyword (
kid int,
pid int
)
CREATE TABLE organization (
continent varchar,
homepage varchar,
name varchar,
oid int
)
CREATE TABLE domain (
did int,
name varchar
)
CREATE TABLE cite (
cited int,
citing int
)
CREATE TABLE journal (
homepage varchar... | SELECT COUNT(DISTINCT (organization.name)) FROM author, domain, domain_author, organization WHERE domain_author.aid = author.aid AND domain.did = domain_author.did AND domain.name = 'Databases' AND organization.oid = author.oid |
what is the number of patients whose admission type is elective and item id is 51466? | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "ELECTIVE" AND lab.itemid = "51466" |
What are the ids for courses that were offered in both Fall of 2009 and Spring of 2010? | CREATE TABLE teaches (
id text,
course_id text,
sec_id text,
semester text,
year number
)
CREATE TABLE time_slot (
time_slot_id text,
day text,
start_hr number,
start_min number,
end_hr number,
end_min number
)
CREATE TABLE classroom (
building text,
room_number tex... | SELECT course_id FROM section WHERE semester = 'Fall' AND year = 2009 INTERSECT SELECT course_id FROM section WHERE semester = 'Spring' AND year = 2010 |
Show me a bar chart for what are the different ids and names of the stations that have had more than 12 bikes available?, show by the x-axis from low to high. | CREATE TABLE status (
station_id INTEGER,
bikes_available INTEGER,
docks_available INTEGER,
time TEXT
)
CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
end_station_name TEXT,
end_station... | SELECT name, id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12 ORDER BY name |
what is average age of patients whose death status is 0 and primary disease is pneumonia;human immunodefiency virus;rule out tuberculosis? | 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 AVG(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "PNEUMONIA;HUMAN IMMUNODEFIENCY VIRUS;RULE OUT TUBERCULOSIS" |
give me the number of patients whose age is less than 62 and days of hospital stay is greater than 7? | 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 < "62" AND demographic.days_stay > "7" |
What is the project id and detail for the project with at least two documents Plot them as bar chart, and list x-axis in descending order. | CREATE TABLE Documents (
Document_ID INTEGER,
Document_Type_Code CHAR(15),
Project_ID INTEGER,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHA... | SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_Details DESC |
Show the number of courses for each course description in a stacked bar chart The x-axis is course description and group by instructor's name, I want to rank y axis in desc order. | 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 STUDENT (
STU_NUM int,
STU_LNAME varchar(15),
STU_FNAME varchar(15),
STU_INIT varchar(1),
STU_DOB datetime,
... | 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 GROUP BY EMP_FNAME, CRS_DESCRIPTION ORDER BY COUNT(CRS_DESCRIPTION) DESC |
provide the number of patients whose admission type is urgent and lab test name is bilirubin, direct? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Bilirubin, Direct" |
give me the number of urgent type hospital admission patients who were ordered aspartate aminotransferase (ast) lab test. | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "URGENT" AND lab.label = "Asparate Aminotransferase (AST)" |
How many departments are in each school Show bar chart, display by the bars in ascending. | 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 COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE... | SELECT SCHOOL_CODE, COUNT(DISTINCT DEPT_NAME) FROM DEPARTMENT ORDER BY SCHOOL_CODE |
What are the different role codes for users, and how many users have each Show bar chart, show from low to high by the X-axis please. | CREATE TABLE Roles (
role_code VARCHAR(15),
role_description VARCHAR(80)
)
CREATE TABLE Functional_Areas (
functional_area_code VARCHAR(15),
parent_functional_area_code VARCHAR(15),
functional_area_description VARCHAR(80)
)
CREATE TABLE Users (
user_id INTEGER,
role_code VARCHAR(15),
u... | SELECT role_code, COUNT(*) FROM Users GROUP BY role_code ORDER BY role_code |
what is the number of patients whose marital status is single and ethnicity is american indian/alaska native? | 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.marital_status = "SINGLE" AND demographic.ethnicity = "AMERICAN INDIAN/ALASKA NATIVE" |
For those employees who was hired before 2002-06-21, visualize a bar chart about the distribution of job_id and the average of salary , and group by attribute job_id, I want to show from low to high by the y axis. | CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE T... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE HIRE_DATE < '2002-06-21' GROUP BY JOB_ID ORDER BY AVG(SALARY) |
Show the number of customer address history in each day and group by date to with a line chart, and I want to sort by the x axis in descending. | CREATE TABLE Products (
product_id INTEGER,
product_type_code VARCHAR(15),
product_name VARCHAR(80),
product_price DOUBLE
)
CREATE TABLE Customer_Orders (
order_id INTEGER,
customer_id INTEGER,
order_date DATETIME,
order_status_code VARCHAR(15)
)
CREATE TABLE Addresses (
address_id... | SELECT date_to, COUNT(date_to) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id GROUP BY date_to ORDER BY date_to DESC |
What are the dates of the latest logon of the students with family name 'Jaskolski' or 'Langosh', and count them by a bar chart, list in descending by the y-axis. | CREATE TABLE Student_Tests_Taken (
registration_id INTEGER,
date_test_taken DATETIME,
test_result VARCHAR(255)
)
CREATE TABLE Student_Course_Enrolment (
registration_id INTEGER,
student_id INTEGER,
course_id INTEGER,
date_of_enrolment DATETIME,
date_of_completion DATETIME
)
CREATE TABL... | SELECT date_of_latest_logon, COUNT(date_of_latest_logon) FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh" ORDER BY COUNT(date_of_latest_logon) DESC |
how many married patients had done the lab test thyroxine (t4)? | 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.marital_status = "MARRIED" AND lab.label = "Thyroxine (T4)" |
Find the names and average salaries of all departments whose average salary is greater than 42000, and rank by the dept_name in ascending. | CREATE TABLE teaches (
ID varchar(5),
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0)
)
CREATE TABLE classroom (
building varchar(15),
room_number varchar(7),
capacity numeric(4,0)
)
CREATE TABLE instructor (
ID varchar(5),
name varchar(20),
... | SELECT dept_name, AVG(salary) FROM instructor GROUP BY dept_name ORDER BY dept_name |
find the number of emergency hospital admitted patients who had neb route of drug administration. | 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.admission_type = "EMERGENCY" AND prescriptions.route = "NEB" |
how many patients with death status 0 had procedure icd9 code as 5011? | 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.icd9_code = "5011" |
On what day was the order with invoice number 10 placed? | CREATE TABLE order_items (
order_item_id number,
product_id number,
order_id number,
order_item_status text,
order_item_details text
)
CREATE TABLE shipments (
shipment_id number,
order_id number,
invoice_number number,
shipment_tracking_number text,
shipment_date time,
othe... | SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10 |
What years did alvin cheung publish papers in ? | CREATE TABLE author (
authorid int,
authorname varchar
)
CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE cite (
citingpaperid int,
citedpaperid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrase... | SELECT DISTINCT paper.year FROM author, paper, writes WHERE author.authorname = 'alvin cheung' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY paper.year |
how many patients whose primary disease is ruq pain? | 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 = "RUQ PAIN" |
what is subject name and death status of subject id 2560? | 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.name, demographic.expire_flag FROM demographic WHERE demographic.subject_id = "2560" |
find the number of female patients who were discharged to short term hospital. | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.discharge_location = "SHORT TERM HOSPITAL" |
What conferences does Yejin Kim submit to ? | CREATE TABLE field (
fieldid int
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE paperdataset (
paperid int,
datasetid int
)
CREATE TABLE cite (
citingpaperid int,
citedpaperid int
)
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
... | SELECT DISTINCT paper.venueid FROM author, paper, writes WHERE author.authorname = 'Yejin Kim' AND writes.authorid = author.authorid AND writes.paperid = paper.paperid |
find the duration of hospital stay and discharge time of kurt buczek. | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT demographic.days_stay, demographic.dischtime FROM demographic WHERE demographic.name = "Kurt Buczek" |
Plot the total number by grouped by competition type as a bar graph, and order X in ascending order. | CREATE TABLE player (
Player_ID int,
name text,
Position text,
Club_ID int,
Apps real,
Tries real,
Goals text,
Points real
)
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Score text
)
CREATE TABLE club (
Club_ID int,
name te... | SELECT Competition_type, COUNT(*) FROM competition GROUP BY Competition_type ORDER BY Competition_type |
When do all the researcher role staff stop working? Bin the time into weekday interval and count them with a bar chart, order by the the number of date to in asc. | CREATE TABLE Documents (
document_id INTEGER,
document_type_code VARCHAR(10),
grant_id INTEGER,
sent_date DATETIME,
response_received_date DATETIME,
other_details VARCHAR(255)
)
CREATE TABLE Projects (
project_id INTEGER,
organisation_id INTEGER,
project_details VARCHAR(255)
)
CREA... | SELECT date_to, COUNT(date_to) FROM Project_Staff ORDER BY COUNT(date_to) |
For those employees who did not have any job in the past, a bar chart shows the distribution of job_id and the average of salary , and group by attribute job_id, and sort by the y axis in descending. | CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,... | SELECT JOB_ID, AVG(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(SALARY) DESC |
For those employees who was hired before 2002-06-21, show me the trend about commission_pct over hire_date with a line chart, and order from high to low by the x axis. | CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,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... | SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY HIRE_DATE DESC |
For those employees who did not have any job in the past, give me the comparison about the average of manager_id over the job_id , and group by attribute job_id by a bar chart, and display by the the average of manager id in asc please. | CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
DEPARTMENT_ID decimal(4,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
... | SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY AVG(MANAGER_ID) |
what are the different role codes for users, and how many users have each?, and sort from high to low by the Y. | CREATE TABLE Document_Sections_Images (
section_id INTEGER,
image_id INTEGER
)
CREATE TABLE Documents (
document_code VARCHAR(15),
document_structure_code VARCHAR(15),
document_type_code VARCHAR(15),
access_count INTEGER,
document_name VARCHAR(80)
)
CREATE TABLE Images (
image_id INTEG... | SELECT role_code, COUNT(*) FROM Users GROUP BY role_code ORDER BY COUNT(*) DESC |
how many christian scientist patients were aged below 54 years? | 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 WHERE demographic.religion = "CHRISTIAN SCIENTIST" AND demographic.age < "54" |
calculate the average age of self pay insurance patients who had urgent hospital admission. | 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 AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "URGENT" AND demographic.insurance = "Self Pay" |
Return a bar chart about the distribution of Time and ID , could you show by the X-axis from high to low please? | CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
CREATE TABLE stadium (
ID int,
name text,
Capacity int,
City text,
Coun... | SELECT Time, ID FROM swimmer ORDER BY Time DESC |
what is minimum age of patients whose gender is m and year of death is less than 2164? | 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.gender = "M" AND demographic.dod_year < "2164.0" |
what is diagnoses short title and diagnoses long title of subject name gonzalo wasson? | 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 diagnoses.short_title, diagnoses.long_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Gonzalo Wasson" |
report the number of patients who had ureteral catheterization and have been hospitalized for more than 11 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 INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "11" AND procedures.long_title = "Ureteral catheterization" |
count the number of patients whose primary disease is rash and age is less than 43? | 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 = "RASH" AND demographic.age < "43" |
what is discharge time and procedure icd9 code of subject id 91588? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT demographic.dischtime, procedures.icd9_code FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.subject_id = "91588" |
For those employees who do not work in departments with managers that have ids between 100 and 200, return a bar chart about the distribution of hire_date and the average of department_id bin hire_date by time, rank by the the average of department id from high to low. | 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 employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
... | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID) DESC |
what is the number of patients with chemistry lab test category who had thoracentesis procedure? | 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 INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE procedures.long_title = "Thoracentesis" AND lab."CATEGORY" = "Chemistry" |
What is the average salary for each job title. Show 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 departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
... | 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 |
What apartment type codes and apartment numbers do the buildings managed by 'Kyle' have? | CREATE TABLE apartment_buildings (
building_id number,
building_short_name text,
building_full_name text,
building_description text,
building_address text,
building_manager text,
building_phone text
)
CREATE TABLE apartment_facilities (
apt_id number,
facility_code text
)
CREATE TA... | SELECT T2.apt_type_code, T2.apt_number FROM apartment_buildings AS T1 JOIN apartments AS T2 ON T1.building_id = T2.building_id WHERE T1.building_manager = "Kyle" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.