instruction stringlengths 11 446 | input stringlengths 195 2.3k | response stringlengths 26 460 |
|---|---|---|
List the name and count of each product in all orders. | CREATE TABLE Shipment_Items (
shipment_id INTEGER,
order_item_id INTEGER
)
CREATE TABLE Shipments (
shipment_id INTEGER,
order_id INTEGER,
invoice_number INTEGER,
shipment_tracking_number VARCHAR(80),
shipment_date DATETIME,
other_shipment_details VARCHAR(255)
)
CREATE TABLE Invoices (... | SELECT T3.product_name, SUM(COUNT(*)) FROM Orders AS T1 JOIN Order_Items AS T2 JOIN Products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_name |
Bar chart x axis position y axis how many position, and I want to list total number in desc order. | CREATE TABLE club (
Club_ID int,
name text,
Region text,
Start_year text
)
CREATE TABLE club_rank (
Rank real,
Club_ID int,
Gold real,
Silver real,
Bronze real,
Total real
)
CREATE TABLE competition_result (
Competition_ID int,
Club_ID_1 int,
Club_ID_2 int,
Scor... | SELECT Position, COUNT(Position) FROM player GROUP BY Position HAVING AVG(Points) >= 20 ORDER BY COUNT(Position) DESC |
what is the number of patients born before 2090 and with lab test name vitamin b12? | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dob_year < "2090" AND lab.label = "Vitamin B12" |
how many patients are primarily diagnosed for rash under 43 years of age? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob te... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "RASH" AND demographic.age < "43" |
provide the average age of female patients who stayed in the hospital for 23 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 prescriptions... | SELECT AVG(demographic.age) FROM demographic WHERE demographic.gender = "F" AND demographic.days_stay = "23" |
give me the number of patients whose year of death is less than or equal to 2168 and procedure icd9 code is 3142? | 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.dod_year <= "2168.0" AND procedures.icd9_code = "3142" |
give me the number of patients whose admission location is transfer from hosp/extram and procedure icd9 code is 5781? | 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 procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.icd9_code = "5781" |
Bar chart of the number of course name from each course name, and I want to show y axis from low to high order. | CREATE TABLE Student_Course_Attendance (
student_id INTEGER,
course_id INTEGER,
date_of_attendance DATETIME
)
CREATE TABLE Candidates (
candidate_id INTEGER,
candidate_details VARCHAR(255)
)
CREATE TABLE Students (
student_id INTEGER,
student_details VARCHAR(255)
)
CREATE TABLE Courses (
... | SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name ORDER BY COUNT(course_name) |
how many patients were admitted before the year 2165 with the diagnosis icd9 code v1083? | 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 diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2165" AND diagnoses.icd9_code = "V1083" |
Sum the amount for all the payments processed with Visa by each year using a bar chart, and rank by the y-axis in asc. | CREATE TABLE Payments (
Payment_ID INTEGER,
Settlement_ID INTEGER,
Payment_Method_Code VARCHAR(255),
Date_Payment_Made DATE,
Amount_Payment INTEGER
)
CREATE TABLE Customers (
Customer_ID INTEGER,
Customer_Details VARCHAR(255)
)
CREATE TABLE Claims (
Claim_ID INTEGER,
Policy_ID INTE... | SELECT Date_Payment_Made, SUM(Amount_Payment) FROM Payments WHERE Payment_Method_Code = 'Visa' ORDER BY SUM(Amount_Payment) |
provide the number of patients whose ethnicity is hispanic or latino and item id is 51132? | 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.ethnicity = "HISPANIC OR LATINO" AND lab.itemid = "51132" |
Find the number of rooms with more than 50 capacity for each building. Show bar chart. | CREATE TABLE section (
course_id varchar(8),
sec_id varchar(8),
semester varchar(6),
year numeric(4,0),
building varchar(15),
room_number varchar(7),
time_slot_id varchar(4)
)
CREATE TABLE student (
ID varchar(5),
name varchar(20),
dept_name varchar(20),
tot_cred numeric(3,0... | SELECT building, COUNT(*) FROM classroom WHERE capacity > 50 GROUP BY building |
count the number of patients whose year of death is less than or equal to 2126? | 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.dod_year <= "2126.0" |
what is subject name and discharge time of subject id 2560? | 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 demographic.name, demographic.dischtime FROM demographic WHERE demographic.subject_id = "2560" |
For those dates that have the 5 highest cloud cover rates, please bin the date into the day of week interval and count their frequency. | CREATE TABLE station (
id INTEGER,
name TEXT,
lat NUMERIC,
long NUMERIC,
dock_count INTEGER,
city TEXT,
installation_date TEXT
)
CREATE TABLE trip (
id INTEGER,
duration INTEGER,
start_date TEXT,
start_station_name TEXT,
start_station_id INTEGER,
end_date TEXT,
e... | SELECT date, COUNT(date) FROM weather |
give me the number of patients whose age is less than 50 and diagnoses long title is coronary atherosclerosis of native coronary artery? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "50" AND diagnoses.long_title = "Coronary atherosclerosis of native coronary artery" |
Provide me the number of patients diagnosed with hypoxemia who had a blood test done. | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Hypoxemia" AND lab.fluid = "Blood" |
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the sum of salary , and group by attribute job_id, and sort by the Y from high to low. | CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE regions (
REGION_ID... | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(SALARY) DESC |
Among patients whose birth year is before 2107, how many of them belonged to black/african american ethnic origin? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND demographic.dob_year < "2107" |
Find the name of songs that does not have a back vocal. | CREATE TABLE performance (
songid number,
bandmate number,
stageposition text
)
CREATE TABLE instruments (
songid number,
bandmateid number,
instrument text
)
CREATE TABLE tracklists (
albumid number,
position number,
songid number
)
CREATE TABLE band (
id number,
firstnam... | SELECT DISTINCT title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid EXCEPT SELECT t2.title FROM vocals AS t1 JOIN songs AS t2 ON t1.songid = t2.songid WHERE type = "back" |
what is maximum age of patients whose marital status is single and primary disease is gangrene? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | SELECT MAX(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.diagnosis = "GANGRENE" |
provide the number of patients who had other body fluid lab test and were hospitalized for more than 2 days. | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.days_stay > "2" AND lab.fluid = "Other Body Fluid" |
how many patients whose days of hospital stay is greater than 26 and drug name is lorazepam? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "26" AND prescriptions.drug = "Lorazepam" |
what is the number of patients whose diagnosis is ca in situ oral cav/phar and im drug route? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Ca in situ oral cav/phar" AND prescriptions.route = "IM" |
return me the paper after 2000 in PVLDB with more than 200 citations . | CREATE TABLE domain_conference (
cid int,
did int
)
CREATE TABLE publication (
abstract varchar,
cid int,
citation_num int,
jid int,
pid int,
reference_num int,
title varchar,
year int
)
CREATE TABLE domain (
did int,
name varchar
)
CREATE TABLE publication_keyword (
... | SELECT publication.title FROM journal, publication WHERE journal.name = 'PVLDB' AND publication.citation_num > 200 AND publication.jid = journal.jid AND publication.year > 2000 |
what is average age of patients whose ethnicity is white and days of hospital stay is 3? | 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 AVG(demographic.age) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.days_stay = "3" |
what is the number of patients whose insurance is medicaid and procedure long title is (aorto)coronary bypass of three coronary arteries? | 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.insurance = "Medicaid" AND procedures.long_title = "(Aorto)coronary bypass of three coronary arteries" |
For those employees who did not have any job in the past, find hire_date and the average of employee_id bin hire_date by time, and visualize them by a bar chart. | CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE 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 HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
What is the sum of the Performance/Return on Capital (Score) when the Score (Iran) is less than 3, and the Score (Global) is 266? | CREATE TABLE table_43662 (
"Bank" text,
"Score (Iran)" real,
"Score (Global)" real,
"Banking Power/Capital Base ($ Million)" real,
"Banking Power/Capital Base (% Change)" text,
"Total Assets ($ Million)" real,
"Total Assets (Score)" real,
"Total Assets (% Change)" text,
"Credibility/... | SELECT COUNT("Performance/Return on Capital (Score)") FROM table_43662 WHERE "Score (Iran)" < '3' AND "Score (Global)" = '266' |
how many patients under the age of 58 had hemodialysis? | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.age < "58" AND procedures.long_title = "Hemodialysis" |
tell me the time of admission and gender of patient with patient 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.gender, demographic.admittime FROM demographic WHERE demographic.subject_id = "26285" |
calculate the total number of patients aged below 86 who had wheelchair dependence | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "86" AND diagnoses.long_title = "Wheelchair dependence" |
Find the id and local authority of the station whose maximum precipitation is higher than 50 Visualize by bar chart, and display by the id in asc. | CREATE TABLE train (
id int,
train_number int,
name text,
origin text,
destination text,
time text,
interval text
)
CREATE TABLE station (
id int,
network_name text,
services text,
local_authority text
)
CREATE TABLE route (
train_id int,
station_id int
)
CREATE TA... | SELECT local_authority, id FROM weekly_weather AS t1 JOIN station AS t2 ON t1.station_id = t2.id ORDER BY id |
what is the number of patients whose admission location is emergency room admit and admission year is less than 2151? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND demographic.admityear < "2151" |
For all employees in the same department as Clara excluding Clara, bin their hire date into the day of week interval, and count how many employees in each month for a bar chart, and I want to sort Y-axis from high to low order. | CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varcha... | SELECT HIRE_DATE, COUNT(HIRE_DATE) FROM employees WHERE DEPARTMENT_ID = (SELECT DEPARTMENT_ID FROM employees WHERE FIRST_NAME = "Clara") AND FIRST_NAME <> "Clara" ORDER BY COUNT(HIRE_DATE) DESC |
Among patients to whom drug was administered in both eyes, how many of them were born before the year 2170. | 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.dob_year < "2170" AND prescriptions.route = "BOTH EYES" |
what is the number of patients whose gender is f and admission location is clinic referral/premature? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.admission_location = "CLINIC REFERRAL/PREMATURE" |
What countries are the female artists who sung in the language Bangla from, and count them by a bar chart, list in desc by the X-axis. | CREATE TABLE genre (
g_name varchar2(20),
rating varchar2(10),
most_popular_in varchar2(50)
)
CREATE TABLE files (
f_id number(10),
artist_name varchar2(50),
file_size varchar2(20),
duration varchar2(20),
formats varchar2(20)
)
CREATE TABLE artist (
artist_name varchar2(50),
co... | SELECT T1.country, T1.country FROM artist AS T1 JOIN song AS T2 ON T1.artist_name = T2.artist_name WHERE T1.gender = "Female" AND T2.languages = "bangla" GROUP BY T1.country ORDER BY T1.country DESC |
What is the number of patients admitted before 2154 who were diagnosed with removal of other organ causing abnormal patient reaction, or later complication, without mention of misadventure at time of operation? | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE prescription... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2154" AND diagnoses.short_title = "Abn reac-organ rem NEC" |
what is the number of patients whose marital status is single and item id is 50891? | 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.marital_status = "SINGLE" AND lab.itemid = "50891" |
give me the number of patients whose death status is 1 and procedure short title is endosc remove bile stone? | 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.expire_flag = "1" AND procedures.short_title = "Endosc remove bile stone" |
A bar chart for returning the number of the claim start date for the claims whose claimed amount is no more than the average, and rank from high to low by the y axis. | CREATE TABLE Claims (
Claim_ID INTEGER,
Policy_ID INTEGER,
Date_Claim_Made DATE,
Date_Claim_Settled DATE,
Amount_Claimed INTEGER,
Amount_Settled INTEGER
)
CREATE TABLE Customer_Policies (
Policy_ID INTEGER,
Customer_ID INTEGER,
Policy_Type_Code CHAR(15),
Start_Date DATE,
End... | SELECT Date_Claim_Made, COUNT(Date_Claim_Made) FROM Claims WHERE Amount_Settled <= (SELECT AVG(Amount_Settled) FROM Claims) ORDER BY COUNT(Date_Claim_Made) DESC |
Find the average age of patients that survived and had a pimary disease of ventricular tachycardia. | 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 AVG(demographic.age) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.diagnosis = "VENTRICULAR TACHYCARDIA" |
Which customers use 'Cash' for payment method? Return the customer names. | CREATE TABLE customer_orders (
order_id number,
customer_id number,
order_status text,
order_date time,
order_details text
)
CREATE TABLE order_items (
order_id number,
product_id number,
order_quantity text
)
CREATE TABLE customer_addresses (
customer_id number,
address_id num... | SELECT customer_name FROM customers WHERE payment_method = "Cash" |
For all employees who have the letters D or S in their first name, a line chart shows the trend of commission_pct over hire_date , and could you rank from low to high by the x-axis? | CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE employees (
EMPLOYEE_ID decimal(6,0),
FIRST_NAME varchar(20),
LAST_NAME varchar(25),
EMAIL varchar(25),
PHONE_NUMBER varchar(20),
HIRE_DATE date,
JOB_ID varchar(10),
... | SELECT HIRE_DATE, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE |
find the number of patients who died in or before the year 2154 and their primary disease was acidosis. | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "ACIDOSIS" AND demographic.dod_year <= "2154.0" |
what is the number of patients whose religion is jehovah's witness and lab test name is lactate? | 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.religion = "JEHOVAH'S WITNESS" AND lab.label = "Lactate" |
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties, and count them by a bar chart | CREATE TABLE county (
County_Id int,
County_name text,
Population real,
Zip_code text
)
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 (
... | 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 |
provide the number of patients whose admission location is trsf within this facility and lab test name is cholesterol, ldl, calculated? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND lab.label = "Cholesterol, LDL, Calculated" |
Show id and location of railways that are associated with more than one train Visualize by bar chart, and could you display by the x-axis in ascending? | CREATE TABLE railway_manage (
Railway_ID int,
Manager_ID int,
From_Year text
)
CREATE TABLE train (
Train_ID int,
Train_Num text,
Name text,
From text,
Arrival text,
Railway_ID int
)
CREATE TABLE manager (
Manager_ID int,
Name text,
Country text,
Working_year_starts... | SELECT T1.Location, T1.Railway_ID FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID ORDER BY T1.Location |
provide me the number of black/haitian patients diagnosed with lower extremity embolism. | 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.ethnicity = "BLACK/HAITIAN" AND diagnoses.short_title = "Lower extremity embolism" |
what is subject name and discharge location 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 prescriptions (
subject_id text,
hadm_id... | SELECT demographic.name, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "2560" |
Show the names of all the activities Mark Giuliano participates in. | CREATE TABLE faculty_participates_in (
facid number,
actid number
)
CREATE TABLE activity (
actid number,
activity_name text
)
CREATE TABLE student (
stuid number,
lname text,
fname text,
age number,
sex text,
major number,
advisor number,
city_code text
)
CREATE TABLE... | SELECT T3.activity_name FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano" |
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a scatter chart shows the correlation between commission_pct and manager_id . | CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date... | SELECT COMMISSION_PCT, MANAGER_ID FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 |
What is the last name of the student who received an A in the class with the code 10018? | CREATE TABLE department (
dept_code text,
dept_name text,
school_code text,
emp_num number,
dept_address text,
dept_extension text
)
CREATE TABLE professor (
emp_num number,
dept_code text,
prof_office text,
prof_extension text,
prof_high_degree text
)
CREATE TABLE employee... | SELECT T1.stu_lname FROM student AS T1 JOIN enroll AS T2 ON T1.stu_num = T2.stu_num WHERE T2.enroll_grade = 'A' AND T2.class_code = 10018 |
What are the best NLP conferences ? | CREATE TABLE writes (
paperid int,
authorid int
)
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE field (
fieldid int
)
CREATE TABLE venue (
venueid int,
venuename varchar
)
CREATE TAB... | SELECT DISTINCT COUNT(DISTINCT cite.citingpaperid), paper.venueid FROM cite, keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'NLP' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = cite.citedpaperid AND paper.paperid = paperkeyphrase.paperid GROUP BY paper.venueid ORDER BY COUN... |
What are the first names and department numbers for employees with last name McEwen? | CREATE TABLE employees (
employee_id number,
first_name text,
last_name text,
email text,
phone_number text,
hire_date time,
job_id text,
salary number,
commission_pct number,
manager_id number,
department_id number
)
CREATE TABLE jobs (
job_id text,
job_title text,
... | SELECT first_name, department_id FROM employees WHERE last_name = 'McEwen' |
how many patients are admitted under emergency and suggested with drug route via both eyes? | 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 = "BOTH EYES" |
What is the average rating of reviews written in year 2014 ? | CREATE TABLE review (
rid int,
business_id varchar,
user_id varchar,
rating float,
text longtext,
year int,
month varchar
)
CREATE TABLE user (
uid int,
user_id varchar,
name varchar
)
CREATE TABLE tip (
tip_id int,
business_id varchar,
text longtext,
user_id va... | SELECT AVG(rating) FROM review WHERE year = 2014 |
Show the number of documents in different ending date and group by ending date with a line chart. | CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME,
Day_Number INTEGER
)
CREATE TABLE Roles (
Role_Code CHAR(15),
Role_Name VARCHAR(255),
Role_Description VARCHAR(255)
)
CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15),
Document_Type_Name VARCHAR(255),
Document_Type_Descri... | SELECT Date_in_Locaton_To, COUNT(Date_in_Locaton_To) FROM Document_Locations GROUP BY Date_in_Locaton_To |
provide the number of patients whose days of hospital stay is greater than 15 and lab test name is creatinine? | 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.days_stay > "15" AND lab.label = "Creatinine" |
from total number of patients who had spinal tap, how many of them were discharge-transfer to psych hosp | 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.discharge_location = "DISCH-TRAN TO PSYCH HOSP" AND procedures.short_title = "Spinal tap" |
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, rank CRS_DESCRIPTION in asc order. | CREATE TABLE ENROLL (
CLASS_CODE varchar(5),
STU_NUM int,
ENROLL_GRADE varchar(50)
)
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 EMPLOYEE (
EMP_NUM int,
... | 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 CRS_DESCRIPTION |
Give the number of patients aged below 83 years who had the drug code fent100t? | 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 prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.age < "83" AND prescriptions.formulary_drug_cd = "FENT100T" |
what is the number of patients whose admission location is phys referral/normal deli and item id is 51221? | 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_location = "PHYS REFERRAL/NORMAL DELI" AND lab.itemid = "51221" |
what is marital status and primary disease of subject name james cepeda? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (... | SELECT demographic.marital_status, demographic.diagnosis FROM demographic WHERE demographic.name = "James Cepeda" |
Find the first names of the faculty members who participate in Canoeing and Kayaking. | 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 activity (
actid number,
activity_name text
)
CREATE TABLE faculty... | SELECT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM faculty AS T1 JOIN faculty_participates_in AS T2 ON T1.facid = T2.facid JOIN activity AS T3 ON T2.actid = T2.actid WH... |
List the popular publications on Object discrimination | CREATE TABLE keyphrase (
keyphraseid int,
keyphrasename varchar
)
CREATE TABLE paperkeyphrase (
paperid int,
keyphraseid int
)
CREATE TABLE paper (
paperid int,
title varchar,
venueid int,
year int,
numciting int,
numcitedby int,
journalid int
)
CREATE TABLE paperfield (
... | SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Object discrimination' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid |
how many patients are admitted before the year 2198 and tested for gamma glutamyltransferase in lab? | 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 lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2198" AND lab.label = "Gamma Glutamyltransferase" |
How many students that has a GPA lower than average? Show me a bar chart grouping by student's first name, order by the y axis in descending. | CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
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... | SELECT STU_FNAME, COUNT(STU_FNAME) FROM STUDENT WHERE STU_GPA < (SELECT AVG(STU_GPA) FROM STUDENT) GROUP BY STU_FNAME ORDER BY COUNT(STU_FNAME) DESC |
what is age and diagnoses icd9 code of subject name estrella carroll? | 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.age, diagnoses.icd9_code FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.name = "Estrella Carroll" |
how many patients whose ethnicity is white and drug route is id? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE" AND prescriptions.route = "ID" |
For each denomination, return the denomination and the count of schools with that denomination Visualize by bar chart, and could you list Denomination in asc order? | CREATE TABLE school_details (
School_ID int,
Nickname text,
Colors text,
League text,
Class text,
Division text
)
CREATE TABLE school (
School_ID int,
School text,
Location text,
Enrollment real,
Founded real,
Denomination text,
Boys_or_Girls text,
Day_or_Boardin... | SELECT Denomination, COUNT(*) FROM school GROUP BY Denomination ORDER BY Denomination |
What is the number of booking start dates of the apartments with more than 2 bedrooms for each year? Return a bar chart, I want to sort in descending by the y-axis. | CREATE TABLE Apartments (
apt_id INTEGER,
building_id INTEGER,
apt_type_code CHAR(15),
apt_number CHAR(10),
bathroom_count INTEGER,
bedroom_count INTEGER,
room_count CHAR(5)
)
CREATE TABLE Apartment_Facilities (
apt_id INTEGER,
facility_code CHAR(15)
)
CREATE TABLE Apartment_Buildi... | SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Apartments AS T2 ON T1.apt_id = T2.apt_id WHERE T2.bedroom_count > 2 ORDER BY COUNT(booking_start_date) DESC |
what is minimum age of patients whose marital status is single and admission year is greater than or equal to 2158? | 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 MIN(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.admityear >= "2158" |
count the number of patients whose admission year is less than 2174 and diagnoses long title is below knee amputation status? | 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.admityear < "2174" AND diagnoses.long_title = "Below knee amputation status" |
what is admission location and primary disease of subject id 18480? | 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.admission_location, demographic.diagnosis FROM demographic WHERE demographic.subject_id = "18480" |
what is minimum age of patients whose admission type is emergency and primary disease is st elevated myocardial infarction\cardiac cath? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE 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 = "EMERGENCY" AND demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" |
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a line chart about the change of salary over hire_date , and I want to order by the X in ascending. | CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TI... | SELECT HIRE_DATE, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY HIRE_DATE |
Show the number of stations installed change over the installation date of in station table using a line chart, order in ascending by the installation_date. | CREATE TABLE weather (
date TEXT,
max_temperature_f INTEGER,
mean_temperature_f INTEGER,
min_temperature_f INTEGER,
max_dew_point_f INTEGER,
mean_dew_point_f INTEGER,
min_dew_point_f INTEGER,
max_humidity INTEGER,
mean_humidity INTEGER,
min_humidity INTEGER,
max_sea_level_pre... | SELECT installation_date, COUNT(installation_date) FROM station GROUP BY installation_date ORDER BY installation_date |
count the number of patients whose age is less than 89 and item id is 50889? | CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "89" AND lab.itemid = "50889" |
provide the number of patients whose days of hospital stay is greater than 0 and diagnoses long title is pulmonary collapse? | 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.days_stay > "0" AND diagnoses.long_title = "Pulmonary collapse" |
Please use a bar chart to compare the number of customers of each customer's move in date. | CREATE TABLE Customer_Event_Notes (
Customer_Event_Note_ID INTEGER,
Customer_Event_ID INTEGER,
service_type_code CHAR(15),
resident_id INTEGER,
property_id INTEGER,
date_moved_in DATETIME
)
CREATE TABLE Properties (
property_id INTEGER,
property_type_code CHAR(15),
property_address ... | SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY date_moved_in |
List all user ids with name Michelle | CREATE TABLE checkin (
cid int,
business_id varchar,
count int,
day varchar
)
CREATE TABLE user (
uid int,
user_id varchar,
name varchar
)
CREATE TABLE review (
rid int,
business_id varchar,
user_id varchar,
rating float,
text longtext,
year int,
month varchar
)... | SELECT user_id FROM user WHERE name = 'Michelle' |
what is maximum age of patients whose admission type is urgent and insurance is government? | 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 = "URGENT" AND demographic.insurance = "Government" |
how many patients whose primary disease is hypoxia and year of death is less than or equal to 2164? | CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
C... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPOXIA" AND demographic.dod_year <= "2164.0" |
how many patients whose religion is greek orthodox and year of birth is less than 2085? | CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.religion = "GREEK ORTHODOX" AND demographic.dob_year < "2085" |
For each record in schedule, show average of the price for each day in a bar chart, and show in desc by the X. | CREATE TABLE schedule (
Cinema_ID int,
Film_ID int,
Date text,
Show_times_per_day int,
Price float
)
CREATE TABLE cinema (
Cinema_ID int,
Name text,
Openning_year int,
Capacity int,
Location text
)
CREATE TABLE film (
Film_ID int,
Rank_in_series int,
Number_in_seaso... | SELECT Date, AVG(Price) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID JOIN cinema AS T3 ON T1.Cinema_ID = T3.Cinema_ID GROUP BY Date ORDER BY Date DESC |
what is the number of patients whose discharge location is short term hospital and diagnoses long title is malignant neoplasm of descending colon? | 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.discharge_location = "SHORT TERM HOSPITAL" AND diagnoses.long_title = "Malignant neoplasm of descending colon" |
count the number of patients whose marital status is single and lab test category is blood gas? | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE 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.marital_status = "SINGLE" AND lab."CATEGORY" = "Blood Gas" |
what is the number of patients whose admission year is less than 2187 and procedure long title is arterial 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.admityear < "2187" AND procedures.long_title = "Arterial catheterization" |
What are the dates of transactions with at least 100 share count or amount bigger than 100, and count them by a bar chart, and I want to display Y-axis in ascending order. | CREATE TABLE Transactions (
transaction_id INTEGER,
investor_id INTEGER,
transaction_type_code VARCHAR(10),
date_of_transaction DATETIME,
amount_of_transaction DECIMAL(19,4),
share_count VARCHAR(40),
other_details VARCHAR(255)
)
CREATE TABLE Sales (
sales_transaction_id INTEGER,
sal... | SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE share_count >= 100 OR amount_of_transaction >= 100 ORDER BY COUNT(date_of_transaction) |
how many patients are admitted under urgent type and procedured with endoscopic insertion of stent (tube) into bile duct? | 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.admission_type = "URGENT" AND procedures.long_title = "Endoscopic insertion of stent (tube) into bile duct" |
How many of the patients with guillain barre syndrome as their primary disease died in or before 2164? | CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GUILLAIN BARRE SYNDROME" AND demographic.dod_year <= "2164.0" |
What campuses are located in Northridge, Los Angeles or in San Francisco, San Francisco? | CREATE TABLE csu_fees (
campus number,
year number,
campusfee number
)
CREATE TABLE enrollments (
campus number,
year number,
totalenrollment_ay number,
fte_ay number
)
CREATE TABLE campuses (
id number,
campus text,
location text,
county text,
year number
)
CREATE TAB... | SELECT campus FROM campuses WHERE location = "Northridge" AND county = "Los Angeles" UNION SELECT campus FROM campuses WHERE location = "San Francisco" AND county = "San Francisco" |
what is days of hospital stay and drug name of subject name dona cole? | 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 demographic.days_stay, prescriptions.drug FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.name = "Dona Cole" |
what is admission type and drug code of subject id 2560? | 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 demographic.admission_type, prescriptions.formulary_drug_cd FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.subject_id = "2560" |
For those employees who do not work in departments with managers that have ids between 100 and 200, draw a bar chart about the distribution of hire_date and the average of employee_id bin hire_date by weekday, and rank by the y axis in ascending. | CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE job_history (
EMPLO... | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) |
provide the number of patients whose diagnoses short title is anxiety state nos and drug route is oral? | CREATE TABLE demographic (
subject_id text,
hadm_id text,
name text,
marital_status text,
age text,
dob text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location t... | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Anxiety state NOS" AND prescriptions.route = "ORAL" |
Show the average of account details for different statement details in a bar chart, and display the average of account details in descending order. | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15),
Document_Type_Name VARCHAR(255),
Document_Type_Description VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHAR(255)
)
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15),
Budget_Type_D... | SELECT Statement_Details, AVG(Account_Details) FROM Accounts AS T1 JOIN Statements AS T2 ON T1.Statement_ID = T2.Statement_ID GROUP BY Statement_Details ORDER BY AVG(Account_Details) DESC |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.