table
stringlengths 33
7.14k
| question
stringlengths 4
1.06k
| output
stringlengths 2
4.44k
⌀ |
|---|---|---|
CREATE TABLE table_204_703 (
id number,
"rank" number,
"nation" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
|
which country won more total medals than tue french , but less than the germans in the 1994 winter olympic biathlon ?
|
SELECT "nation" FROM table_204_703 WHERE "total" > (SELECT "total" FROM table_204_703 WHERE "nation" = 'france') AND "total" < (SELECT "total" FROM table_204_703 WHERE "nation" = 'germany')
|
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,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures (
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,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
|
how many patients admitted before 2151 are divorced?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "DIVORCED" AND demographic.admityear < "2151"
|
CREATE TABLE table_45619 (
"Week #" text,
"Theme" text,
"Song choice" text,
"Original artist" text,
"Result" text
)
|
What was the result after the week # top 11?
|
SELECT "Result" FROM table_45619 WHERE "Week #" = 'top 11'
|
CREATE TABLE table_1213511_2 (
nationality VARCHAR,
nhl_team VARCHAR
)
|
What is the nationality of the player from Buffalo Sabres?
|
SELECT nationality FROM table_1213511_2 WHERE nhl_team = "Buffalo Sabres"
|
CREATE TABLE table_71730 (
"Hull No." real,
"Year" real,
"Project" text,
"Length overall in meters (without bowsprit)" real,
"Name" text,
"Destination" text
)
|
Name the project with length overall being 25 and name of levante
|
SELECT "Project" FROM table_71730 WHERE "Length overall in meters (without bowsprit)" = '25' AND "Name" = 'levante'
|
CREATE TABLE table_79282 (
"Year" real,
"Team" text,
"Manufacturer" text,
"Start" real,
"Finish" real
)
|
Which team had a start of 8 in years under 2008?
|
SELECT "Team" FROM table_79282 WHERE "Start" = '8' AND "Year" < '2008'
|
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 text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
find the number of patients admitted before the year 2146 whose admission type is elective.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_type = "ELECTIVE" AND demographic.admityear < "2146"
|
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
|
when was the first time that since 5 years ago patient 030-60126 received administration of electrolytes procedure?
|
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-60126')) AND treatment.treatmentname = 'administration of electrolytes' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-5 year') ORDER BY treatment.treatmenttime LIMIT 1
|
CREATE TABLE table_name_61 (
time VARCHAR,
team VARCHAR
)
|
What time did team kawasaki zx10 1000cc have?
|
SELECT time FROM table_name_61 WHERE team = "kawasaki zx10 1000cc"
|
CREATE TABLE table_11636213_7 (
partnering VARCHAR,
result VARCHAR
)
|
How many matches had the result of 6 3, 6 2?
|
SELECT COUNT(partnering) FROM table_11636213_7 WHERE result = "6–3, 6–2"
|
CREATE TABLE prescriptions (
subject_id text,
hadm_id text,
icustay_id text,
drug_type text,
drug text,
formulary_drug_cd text,
route text,
drug_dose text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
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,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
|
provide the number of patients whose discharge location is short term hospital and who were admitted to the hospital before year 2182.
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "SHORT TERM HOSPITAL" AND demographic.admityear < "2182"
|
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
|
has patient 003-42706 had an thrombolytics procedure performed in other hospitals since 5 years ago?
|
SELECT COUNT(*) > 0 FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.uniquepid = '003-42706' AND patient.hospitalid <> (SELECT DISTINCT patient.hospitalid FROM patient WHERE patient.uniquepid = '003-42706' AND patient.hospitaldischargetime IS NULL)) AND treatment.treatmentname = 'thrombolytics' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-5 year')
|
CREATE TABLE table_name_5 (
ground VARCHAR,
away VARCHAR
)
|
On what grounds did the away team of the Toronto Rebels play?
|
SELECT ground FROM table_name_5 WHERE away = "toronto rebels"
|
CREATE TABLE table_1341453_40 (
district VARCHAR,
incumbent VARCHAR
)
|
In what district was Tim Holden the incumbent?
|
SELECT district FROM table_1341453_40 WHERE incumbent = "Tim Holden"
|
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
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),
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(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 countries (
COUNTRY_ID varchar(2),
COUNTRY_NAME varchar(40),
REGION_ID decimal(10,0)
)
|
For those employees who did not have any job in the past, draw a bar chart about the distribution of job_id and the sum of manager_id , and group by attribute job_id, and order in descending by the y axis please.
|
SELECT JOB_ID, SUM(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY SUM(MANAGER_ID) DESC
|
CREATE TABLE table_name_88 (
opponent VARCHAR,
date VARCHAR
)
|
Who's the opponent for June 13?
|
SELECT opponent FROM table_name_88 WHERE date = "june 13"
|
CREATE TABLE table_name_23 (
time_retired VARCHAR,
grid VARCHAR
)
|
What is Time/Retired with a Grid of 12?
|
SELECT time_retired FROM table_name_23 WHERE grid = 12
|
CREATE TABLE table_name_68 (
position VARCHAR,
played INTEGER
)
|
What was the position has a played entry of more than 24?
|
SELECT COUNT(position) FROM table_name_68 WHERE played > 24
|
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,
route text,
drug_dose 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 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 text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
|
how many patients have stayed in the hospital for more than 8 days with a drug name magnesium oxide?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "8" AND prescriptions.drug = "Magnesium Oxide"
|
CREATE TABLE table_5082 (
"Rank" real,
"Player" text,
"Country" text,
"Earnings ( $ )" real,
"Events" real,
"Wins" real
)
|
Which events have a Rank of 1?
|
SELECT "Events" FROM table_5082 WHERE "Rank" = '1'
|
CREATE TABLE table_78053 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
)
|
How many spectators were at the game when the away team scored 15.8 (98)?
|
SELECT "Crowd" FROM table_78053 WHERE "Away team score" = '15.8 (98)'
|
CREATE TABLE Projects (
Project_ID INTEGER,
Project_Details VARCHAR(255)
)
CREATE TABLE Documents_with_Expenses (
Document_ID INTEGER,
Budget_Type_Code CHAR(15),
Document_Details VARCHAR(255)
)
CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15),
Document_Type_Name VARCHAR(255),
Document_Type_Description VARCHAR(255)
)
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 Accounts (
Account_ID INTEGER,
Statement_ID INTEGER,
Account_Details VARCHAR(255)
)
CREATE TABLE Ref_Budget_Codes (
Budget_Type_Code CHAR(15),
Budget_Type_Description VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHAR(255)
)
|
Show me a bar chart for what is the project id and detail for the project with at least two documents?, sort in ascending by the X-axis.
|
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
|
CREATE TABLE table_51065 (
"Model number" text,
"sSpec number" text,
"Frequency" text,
"GPU frequency" text,
"L2 cache" text,
"I/O bus" text,
"Memory" text,
"Socket" text,
"Release date" text,
"Part number(s)" text
)
|
What is L2 Cache, when Model Number is Atom Z625?
|
SELECT "L2 cache" FROM table_51065 WHERE "Model number" = 'atom z625'
|
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 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 text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
how many patients discharged to long term care hospital were born before 2058?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "LONG TERM CARE HOSPITAL" AND demographic.dob_year < "2058"
|
CREATE TABLE table_2380212_1 (
league VARCHAR,
year VARCHAR
)
|
What League was played in 2007?
|
SELECT league FROM table_2380212_1 WHERE year = 2007
|
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
|
what is the minimum cost of the hospital that regular insulin involves until 4 years ago?
|
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'regular insulin')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY cost.patienthealthsystemstayid) AS t1
|
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
)
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,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
|
what is average days of hospital stay of patients whose primary disease is posterior communicating aneurysm/sda?
|
SELECT AVG(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "POSTERIOR COMMUNICATING ANEURYSM/SDA"
|
CREATE TABLE postseason (
year INTEGER,
round TEXT,
team_id_winner TEXT,
league_id_winner TEXT,
team_id_loser TEXT,
league_id_loser TEXT,
wins INTEGER,
losses INTEGER,
ties INTEGER
)
CREATE TABLE player_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes TEXT
)
CREATE TABLE salary (
year INTEGER,
team_id TEXT,
league_id TEXT,
player_id TEXT,
salary INTEGER
)
CREATE TABLE appearances (
year INTEGER,
team_id TEXT,
league_id TEXT,
player_id TEXT,
g_all NUMERIC,
gs NUMERIC,
g_batting INTEGER,
g_defense NUMERIC,
g_p INTEGER,
g_c INTEGER,
g_1b INTEGER,
g_2b INTEGER,
g_3b INTEGER,
g_ss INTEGER,
g_lf INTEGER,
g_cf INTEGER,
g_rf INTEGER,
g_of INTEGER,
g_dh NUMERIC,
g_ph NUMERIC,
g_pr NUMERIC
)
CREATE TABLE fielding (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
pos TEXT,
g INTEGER,
gs NUMERIC,
inn_outs NUMERIC,
po NUMERIC,
a NUMERIC,
e NUMERIC,
dp NUMERIC,
pb NUMERIC,
wp NUMERIC,
sb NUMERIC,
cs NUMERIC,
zr NUMERIC
)
CREATE TABLE college (
college_id TEXT,
name_full TEXT,
city TEXT,
state TEXT,
country TEXT
)
CREATE TABLE batting (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
g INTEGER,
ab NUMERIC,
r NUMERIC,
h NUMERIC,
double NUMERIC,
triple NUMERIC,
hr NUMERIC,
rbi NUMERIC,
sb NUMERIC,
cs NUMERIC,
bb NUMERIC,
so NUMERIC,
ibb NUMERIC,
hbp NUMERIC,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
)
CREATE TABLE hall_of_fame (
player_id TEXT,
yearid INTEGER,
votedby TEXT,
ballots NUMERIC,
needed NUMERIC,
votes NUMERIC,
inducted TEXT,
category TEXT,
needed_note TEXT
)
CREATE TABLE player_award_vote (
award_id TEXT,
year INTEGER,
league_id TEXT,
player_id TEXT,
points_won NUMERIC,
points_max INTEGER,
votes_first NUMERIC
)
CREATE TABLE team (
year INTEGER,
league_id TEXT,
team_id TEXT,
franchise_id TEXT,
div_id TEXT,
rank INTEGER,
g INTEGER,
ghome NUMERIC,
w INTEGER,
l INTEGER,
div_win TEXT,
wc_win TEXT,
lg_win TEXT,
ws_win TEXT,
r INTEGER,
ab INTEGER,
h INTEGER,
double INTEGER,
triple INTEGER,
hr INTEGER,
bb INTEGER,
so NUMERIC,
sb NUMERIC,
cs NUMERIC,
hbp NUMERIC,
sf NUMERIC,
ra INTEGER,
er INTEGER,
era NUMERIC,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts INTEGER,
ha INTEGER,
hra INTEGER,
bba INTEGER,
soa INTEGER,
e INTEGER,
dp NUMERIC,
fp NUMERIC,
name TEXT,
park TEXT,
attendance NUMERIC,
bpf INTEGER,
ppf INTEGER,
team_id_br TEXT,
team_id_lahman45 TEXT,
team_id_retro TEXT
)
CREATE TABLE player_college (
player_id TEXT,
college_id TEXT,
year INTEGER
)
CREATE TABLE manager (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
inseason INTEGER,
g INTEGER,
w INTEGER,
l INTEGER,
rank NUMERIC,
plyr_mgr TEXT
)
CREATE TABLE fielding_postseason (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
round TEXT,
pos TEXT,
g INTEGER,
gs NUMERIC,
inn_outs NUMERIC,
po INTEGER,
a INTEGER,
e INTEGER,
dp INTEGER,
tp INTEGER,
pb NUMERIC,
sb NUMERIC,
cs NUMERIC
)
CREATE TABLE manager_award_vote (
award_id TEXT,
year INTEGER,
league_id TEXT,
player_id TEXT,
points_won INTEGER,
points_max INTEGER,
votes_first INTEGER
)
CREATE TABLE team_half (
year INTEGER,
league_id TEXT,
team_id TEXT,
half INTEGER,
div_id TEXT,
div_win TEXT,
rank INTEGER,
g INTEGER,
w INTEGER,
l INTEGER
)
CREATE TABLE park (
park_id TEXT,
park_name TEXT,
park_alias TEXT,
city TEXT,
state TEXT,
country TEXT
)
CREATE TABLE manager_award (
player_id TEXT,
award_id TEXT,
year INTEGER,
league_id TEXT,
tie TEXT,
notes NUMERIC
)
CREATE TABLE home_game (
year INTEGER,
league_id TEXT,
team_id TEXT,
park_id TEXT,
span_first TEXT,
span_last TEXT,
games INTEGER,
openings INTEGER,
attendance INTEGER
)
CREATE TABLE pitching (
player_id TEXT,
year INTEGER,
stint INTEGER,
team_id TEXT,
league_id TEXT,
w INTEGER,
l INTEGER,
g INTEGER,
gs INTEGER,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts NUMERIC,
h INTEGER,
er INTEGER,
hr INTEGER,
bb INTEGER,
so INTEGER,
baopp NUMERIC,
era NUMERIC,
ibb NUMERIC,
wp NUMERIC,
hbp NUMERIC,
bk INTEGER,
bfp NUMERIC,
gf NUMERIC,
r INTEGER,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
)
CREATE TABLE team_franchise (
franchise_id TEXT,
franchise_name TEXT,
active TEXT,
na_assoc TEXT
)
CREATE TABLE all_star (
player_id TEXT,
year INTEGER,
game_num INTEGER,
game_id TEXT,
team_id TEXT,
league_id TEXT,
gp NUMERIC,
starting_pos NUMERIC
)
CREATE TABLE batting_postseason (
year INTEGER,
round TEXT,
player_id TEXT,
team_id TEXT,
league_id TEXT,
g INTEGER,
ab INTEGER,
r INTEGER,
h INTEGER,
double INTEGER,
triple INTEGER,
hr INTEGER,
rbi INTEGER,
sb INTEGER,
cs NUMERIC,
bb INTEGER,
so INTEGER,
ibb NUMERIC,
hbp NUMERIC,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
)
CREATE TABLE player (
player_id TEXT,
birth_year NUMERIC,
birth_month NUMERIC,
birth_day NUMERIC,
birth_country TEXT,
birth_state TEXT,
birth_city TEXT,
death_year NUMERIC,
death_month NUMERIC,
death_day NUMERIC,
death_country TEXT,
death_state TEXT,
death_city TEXT,
name_first TEXT,
name_last TEXT,
name_given TEXT,
weight NUMERIC,
height NUMERIC,
bats TEXT,
throws TEXT,
debut TEXT,
final_game TEXT,
retro_id TEXT,
bbref_id TEXT
)
CREATE TABLE fielding_outfield (
player_id TEXT,
year INTEGER,
stint INTEGER,
glf NUMERIC,
gcf NUMERIC,
grf NUMERIC
)
CREATE TABLE manager_half (
player_id TEXT,
year INTEGER,
team_id TEXT,
league_id TEXT,
inseason INTEGER,
half INTEGER,
g INTEGER,
w INTEGER,
l INTEGER,
rank INTEGER
)
CREATE TABLE pitching_postseason (
player_id TEXT,
year INTEGER,
round TEXT,
team_id TEXT,
league_id TEXT,
w INTEGER,
l INTEGER,
g INTEGER,
gs INTEGER,
cg INTEGER,
sho INTEGER,
sv INTEGER,
ipouts INTEGER,
h INTEGER,
er INTEGER,
hr INTEGER,
bb INTEGER,
so INTEGER,
baopp TEXT,
era NUMERIC,
ibb NUMERIC,
wp NUMERIC,
hbp NUMERIC,
bk NUMERIC,
bfp NUMERIC,
gf INTEGER,
r INTEGER,
sh NUMERIC,
sf NUMERIC,
g_idp NUMERIC
)
|
Count the number of players who enter hall of fame for each year Plot them as line chart, show yearid in descending order please.
|
SELECT yearid, COUNT(*) FROM hall_of_fame GROUP BY yearid ORDER BY yearid DESC
|
CREATE TABLE table_203_270 (
id number,
"year" number,
"competition" text,
"venue" text,
"position" text,
"event" text,
"notes" text
)
|
which four competitions are the only competitions that occurred once ?
|
SELECT "competition" FROM table_203_270 GROUP BY "competition" HAVING COUNT(*) = 1
|
CREATE TABLE table_72962 (
"Rank" real,
"Railway Station" text,
"Annual entry/exit (millions) 2011\u201312" text,
"Annual interchanges (millions) 2011\u201312" text,
"Total Passengers (millions) 2011\u201312" text,
"Location" text,
"Main Services" text,
"Number of Platforms" real
)
|
What is the lowest rank of Gatwick Airport?
|
SELECT MIN("Rank") FROM table_72962 WHERE "Railway Station" = 'Gatwick Airport'
|
CREATE TABLE table_203_727 (
id number,
"year" number,
"miss northern ireland" text,
"hometown" text,
"placement at miss world" text,
"notes" text
)
|
who was miss uk 2005 and miss universe 2005 2nd runner up ?
|
SELECT "miss northern ireland" FROM table_203_727 WHERE "notes" = 'later miss united kingdom 2005 and miss universe united kingdom 2005 2nd runner-up'
|
CREATE TABLE table_24032 (
"Series Year" real,
"Series-Ending Tournament" text,
"Location" text,
"Surface" text,
"Champion" text,
"Runner-up" text,
"Score in Final" text
)
|
What was the final score when tracy austin was runner up?
|
SELECT "Score in Final" FROM table_24032 WHERE "Runner-up" = 'Tracy Austin'
|
CREATE TABLE table_name_2 (
weight_at_birth VARCHAR,
gender VARCHAR,
nickname VARCHAR
)
|
How much did the girl, nicknamed Chidi, weigh at birth?
|
SELECT weight_at_birth FROM table_name_2 WHERE gender = "girl" AND nickname = "chidi"
|
CREATE TABLE table_name_30 (
area__km²_ INTEGER,
name_of_community VARCHAR,
excised_from VARCHAR,
population VARCHAR
)
|
What is the average Area (km ) that shows Excised from shire of cook and a Population smaller than 463 for the community of wujal wujal (bloomfield river)?
|
SELECT AVG(area__km²_) FROM table_name_30 WHERE excised_from = "shire of cook" AND population < 463 AND name_of_community = "wujal wujal (bloomfield river)"
|
CREATE TABLE table_35649 (
"Season" real,
"Episodes" real,
"First air date" text,
"Last air date" text,
"Timeslot" text,
"DVD Release" text
)
|
When is the last episode air date for season 3?
|
SELECT "Last air date" FROM table_35649 WHERE "Season" = '3'
|
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_project varchar,
has_final_exam varchar,
textbook varchar,
class_address varchar,
allow_audit varchar
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_semesters int,
num_enrolled int,
has_discussion varchar,
has_lab varchar,
has_projects varchar,
has_exams varchar,
num_reviews int,
clarity_score int,
easiness_score int,
helpfulness_score int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varchar
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments int,
respected int,
participation int,
heavy_reading int,
tough_grader int,
hilarious int,
would_take_again int,
good_lecture int,
no_skip int
)
CREATE TABLE area (
course_id int,
area varchar
)
|
Are there courses I need to take before PHYSED 265 ?
|
SELECT DISTINCT COURSE_0.department, COURSE_0.name, COURSE_0.number FROM course AS COURSE_0, course AS COURSE_1, course_prerequisite WHERE COURSE_0.course_id = course_prerequisite.pre_course_id AND NOT COURSE_0.course_id IN (SELECT STUDENT_RECORDalias0.course_id FROM student_record AS STUDENT_RECORDalias0 WHERE STUDENT_RECORDalias0.student_id = 1) AND COURSE_1.course_id = course_prerequisite.course_id AND COURSE_1.department = 'PHYSED' AND COURSE_1.number = 265
|
CREATE TABLE table_name_16 (
date VARCHAR,
type VARCHAR
)
|
What was the date with a hilly stage?
|
SELECT date FROM table_name_16 WHERE type = "hilly stage"
|
CREATE TABLE table_name_67 (
bronze INTEGER,
gold VARCHAR,
silver VARCHAR
)
|
What is the total amount of bronze medals a team with 1 gold and more than 3 silver medals has?
|
SELECT SUM(bronze) FROM table_name_67 WHERE gold = 1 AND silver > 3
|
CREATE TABLE stock (
shop_id number,
device_id number,
quantity number
)
CREATE TABLE device (
device_id number,
device text,
carrier text,
package_version text,
applications text,
software_platform text
)
CREATE TABLE shop (
shop_id number,
shop_name text,
location text,
open_date text,
open_year number
)
|
Show the carriers of devices in stock at more than one shop.
|
SELECT T2.carrier FROM stock AS T1 JOIN device AS T2 ON T1.device_id = T2.device_id GROUP BY T1.device_id HAVING COUNT(*) > 1
|
CREATE TABLE table_7321 (
"Outcome" text,
"Date" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
|
What was the Outcome of the match played on Hard (i) Surface?
|
SELECT "Outcome" FROM table_7321 WHERE "Surface" = 'hard (i)'
|
CREATE TABLE table_name_97 (
circuit VARCHAR,
pole_position VARCHAR
)
|
Which Circuit has a Pole position of andr ribeiro?
|
SELECT circuit FROM table_name_97 WHERE pole_position = "andré ribeiro"
|
CREATE TABLE table_55199 (
"Outcome" text,
"Date" text,
"Tournament" text,
"Surface" text,
"Partner" text,
"Opponents" text,
"Score" text
)
|
What is the surface of the match when the opponent was iryna bremond valeria savinykh?
|
SELECT "Surface" FROM table_55199 WHERE "Opponents" = 'iryna bremond valeria savinykh'
|
CREATE TABLE table_52354 (
"Region" text,
"Date" text,
"Label" text,
"Format" text,
"Catalogue" text
)
|
Which date had a Japan region?
|
SELECT "Date" FROM table_52354 WHERE "Region" = 'japan'
|
CREATE TABLE table_name_32 (
Id VARCHAR
)
|
What is the 2007 that has a grand slam tournaments in 2006.
|
SELECT 2007 FROM table_name_32 WHERE 2006 = "grand slam tournaments"
|
CREATE TABLE table_55939 (
"Rank" real,
"Name" text,
"Nation" text,
"Placings" text,
"Total" real
)
|
Who has a rank great than 3 and a placing of 64?
|
SELECT "Name" FROM table_55939 WHERE "Rank" > '3' AND "Placings" = '64'
|
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
|
how many patient have died after they were diagnosed with acc poison-cns stimulant during the same month until 4 years ago?
|
SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT t1.subject_id, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'acc poison-cns stimulant')) AS t1 GROUP BY t1.subject_id HAVING MIN(t1.charttime) = t1.charttime AND DATETIME(t1.charttime) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t2 JOIN (SELECT patients.subject_id, admissions.hadm_id, patients.dod FROM admissions JOIN patients ON patients.subject_id = admissions.subject_id WHERE NOT patients.dod IS NULL AND DATETIME(patients.dod) <= DATETIME(CURRENT_TIME(), '-4 year')) AS t3 ON t2.subject_id = t3.subject_id WHERE DATETIME(t2.charttime, 'start of month') = DATETIME(t3.dod, 'start of month')
|
CREATE TABLE nomination (
Artwork_ID int,
Festival_ID int,
Result text
)
CREATE TABLE artwork (
Artwork_ID int,
Type text,
Name text
)
CREATE TABLE festival_detail (
Festival_ID int,
Festival_Name text,
Chair_Name text,
Location text,
Year int,
Num_of_Audience int
)
|
Show the ids and names of festivals that have at least two nominations for artworks by a bar chart, display names in asc order.
|
SELECT T3.Festival_Name, T1.Festival_ID FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID = T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID = T3.Festival_ID ORDER BY T3.Festival_Name
|
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
|
what were the three most frequently prescribed drugs to patients who previously received temporary colostomy within 2 months until 1 year ago?
|
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'temporary colostomy') AND DATETIME(procedures_icd.charttime) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE DATETIME(prescriptions.startdate) <= DATETIME(CURRENT_TIME(), '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND DATETIME(t2.startdate) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 month') GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 3
|
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
|
what was the first drug prescribed until 9 months ago to patient 017-101426?
|
SELECT medication.drugname FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-101426')) AND DATETIME(medication.drugstarttime) <= DATETIME(CURRENT_TIME(), '-9 month') ORDER BY medication.drugstarttime LIMIT 1
|
CREATE TABLE table_59446 (
"Party" text,
"% votes" real,
"% change" real,
"Seats" real,
"Change" real
)
|
What is the change number with fewer than 4.7% votes and more than 0 seats?
|
SELECT SUM("Change") FROM table_59446 WHERE "% votes" < '4.7' AND "Seats" > '0'
|
CREATE TABLE region (
Region_id int,
Region_code text,
Region_name text
)
CREATE TABLE affected_region (
Region_id int,
Storm_ID int,
Number_city_affected real
)
CREATE TABLE storm (
Storm_ID int,
Name text,
Dates_active text,
Max_speed int,
Damage_millions_USD real,
Number_Deaths int
)
|
List the name for storms and the number of affected regions for each storm with a pie chart.
|
SELECT Name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.Storm_ID = T2.Storm_ID GROUP BY T1.Storm_ID
|
CREATE TABLE Properties (
property_id INTEGER,
property_type_code CHAR(15),
property_address VARCHAR(255),
other_details VARCHAR(255)
)
CREATE TABLE Services (
service_id INTEGER,
organization_id INTEGER,
service_type_code CHAR(15),
service_details VARCHAR(255)
)
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 Customers (
customer_id INTEGER,
customer_details VARCHAR(255)
)
CREATE TABLE Timed_Status_of_Things (
thing_id INTEGER,
Date_and_Date DATETIME,
Status_of_Thing_Code CHAR(15)
)
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 Things (
thing_id INTEGER,
organization_id INTEGER,
Type_of_Thing_Code CHAR(15),
service_type_code CHAR(10),
service_details VARCHAR(255)
)
CREATE TABLE Residents (
resident_id INTEGER,
property_id INTEGER,
date_moved_in DATETIME,
date_moved_out DATETIME,
other_details VARCHAR(255)
)
CREATE TABLE Timed_Locations_of_Things (
thing_id INTEGER,
Date_and_Time DATETIME,
Location_Code CHAR(15)
)
CREATE TABLE Organizations (
organization_id INTEGER,
parent_organization_id INTEGER,
organization_details VARCHAR(255)
)
CREATE TABLE Residents_Services (
resident_id INTEGER,
service_id INTEGER,
date_moved_in DATETIME,
property_id INTEGER,
date_requested DATETIME,
date_provided DATETIME,
other_details VARCHAR(255)
)
|
What is the proportion of each customer's move in date? You can show me a bar chart that bins move in date into Year interval, and sort by the y axis in ascending.
|
SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id ORDER BY COUNT(date_moved_in)
|
CREATE TABLE table_68720 (
"Name" text,
"Years" text,
"League" text,
"FA Cup" text,
"League Cup" text,
"Europe" text,
"Other [C ]" text,
"Total" text
)
|
The League Cup of 0 40 0 (6) also has what listed in the Europe column?
|
SELECT "Europe" FROM table_68720 WHERE "League Cup" = '0 40 0 (6)'
|
CREATE TABLE table_203_54 (
id number,
"selected\nlatin american\ncountries" text,
"internl.\ntourism\narrivals\n2010\n(x 1000)" number,
"internl.\ntourism\nreceipts.\n2010\n(usd\n(x1000)" number,
"average\nreceipt\nper visitor\n2009\n(usd/turista)" number,
"tourist\narrivals\nper\n1000 inhab\n(estimated)\n2007" number,
"receipts\nper\ncapita\n2005\nusd" number,
"revenues\nas %\nexports of\ngoods and\nservices\n2003" number,
"tourism\nincome\n%\ngdp\n2003" number,
"% direct and\nindirect\nemployment\nin tourism\n2005" number,
"world\nranking\ntourism\ncompetitiv.\nttci\n2011" number,
"2011\nttci\nindex" number
)
|
which latin american country had the largest number of tourism arrivals in 2010 ?
|
SELECT "selected\nlatin american\ncountries" FROM table_203_54 ORDER BY "internl.\ntourism\narrivals\n2010\n(x 1000)" DESC LIMIT 1
|
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
|
count the number of patients who received a laxatives - doss (colace) treatment within 2 months after they were diagnosed with spinal cord injury - thoracic since 3 years ago.
|
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'spinal cord injury - thoracic' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'laxatives - doss (colace)' AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 WHERE t1.diagnosistime < t2.treatmenttime AND DATETIME(t2.treatmenttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month')
|
CREATE TABLE table_name_75 (
crowd INTEGER,
venue VARCHAR
)
|
What was the largest crowd at the Brunswick Street Oval?
|
SELECT MAX(crowd) FROM table_name_75 WHERE venue = "brunswick street oval"
|
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 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 text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
how many patients whose procedure icd9 code is 3897 and drug route is buccal?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3897" AND prescriptions.route = "BUCCAL"
|
CREATE TABLE table_37944 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
)
|
Which Attendance has a Record of 34 51?
|
SELECT MIN("Attendance") FROM table_37944 WHERE "Record" = '34–51'
|
CREATE TABLE table_204_435 (
id number,
"sport" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
)
|
what sport has the second most number of gold medals won ?
|
SELECT "sport" FROM table_204_435 WHERE "gold" < (SELECT MAX("gold") FROM table_204_435) ORDER BY "gold" DESC LIMIT 1
|
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 (
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
)
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 text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
|
give me the number of patients whose age is less than 50 and diagnoses long title is acute vascular insufficiency of intestine?
|
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 = "Acute vascular insufficiency of intestine"
|
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,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear 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
)
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
)
|
how many patients whose drug route is pr?
|
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "PR"
|
CREATE TABLE table_name_1 (
record VARCHAR,
date VARCHAR
)
|
What was the record on April 22?
|
SELECT record FROM table_name_1 WHERE date = "april 22"
|
CREATE TABLE table_name_18 (
event VARCHAR,
record VARCHAR
)
|
Which event had the record of 18 5 (1)?
|
SELECT event FROM table_name_18 WHERE record = "18–5 (1)"
|
CREATE TABLE table_45417 (
"Race Title" text,
"Circuit" text,
"City / State" text,
"Date" text,
"Winner" text,
"Team" text
)
|
what is the circuit when the date is 4 june?
|
SELECT "Circuit" FROM table_45417 WHERE "Date" = '4 june'
|
CREATE TABLE table_27523 (
"June 10-11" text,
"March 27-29" text,
"January 15-16" text,
"November 3" text,
"August 21-22" text
)
|
What January 15-16 is is that corresponds to November 3, 2013?
|
SELECT "January 15-16" FROM table_27523 WHERE "November 3" = 'November 3, 2013'
|
CREATE TABLE party (
Party_ID VARCHAR,
Party VARCHAR
)
CREATE TABLE election (
Committee VARCHAR,
Party VARCHAR
)
|
Which committees have delegates from both democratic party and liberal party?
|
SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Liberal"
|
CREATE TABLE Subjects (
subject_id INTEGER,
subject_name VARCHAR(120)
)
CREATE TABLE Courses (
course_id INTEGER,
author_id INTEGER,
subject_id INTEGER,
course_name VARCHAR(120),
course_description VARCHAR(255)
)
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_Course_Enrolment (
registration_id INTEGER,
student_id INTEGER,
course_id INTEGER,
date_of_enrolment DATETIME,
date_of_completion DATETIME
)
CREATE TABLE Course_Authors_and_Tutors (
author_id INTEGER,
author_tutor_ATB VARCHAR(3),
login_name VARCHAR(40),
password VARCHAR(40),
personal_name VARCHAR(80),
middle_name VARCHAR(80),
family_name VARCHAR(80),
gender_mf VARCHAR(1),
address_line_1 VARCHAR(80)
)
CREATE TABLE Student_Tests_Taken (
registration_id INTEGER,
date_test_taken DATETIME,
test_result VARCHAR(255)
)
|
Return the number of the completion date for all the tests that have 'Fail' result, and rank total number from high to low order please.
|
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" ORDER BY COUNT(date_of_completion) DESC
|
CREATE TABLE table_1932 (
"Country" text,
"Contestant" text,
"Age" real,
"Height (cm)" real,
"Height (ft)" text,
"Hometown" text
)
|
When bahamas is the country what is the height in centimeters?
|
SELECT "Height (cm)" FROM table_1932 WHERE "Country" = 'Bahamas'
|
CREATE TABLE list (
lastname text,
firstname text,
grade number,
classroom number
)
CREATE TABLE teachers (
lastname text,
firstname text,
classroom number
)
|
Which teachers teach in classroom 110? Give me their first names.
|
SELECT firstname FROM teachers WHERE classroom = 110
|
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 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 text,
gender text,
language text,
religion text,
admission_type text,
days_stay text,
insurance text,
ethnicity text,
expire_flag text,
admission_location text,
discharge_location text,
diagnosis text,
dod text,
dob_year text,
dod_year text,
admittime text,
dischtime text,
admityear text
)
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
|
what is maximum days of hospital stay of patients whose admission year is greater than or equal to 2177?
|
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.admityear >= "2177"
|
CREATE TABLE people (
People_ID int,
Sex text,
Name text,
Date_of_Birth text,
Height real,
Weight real
)
CREATE TABLE candidate (
Candidate_ID int,
People_ID int,
Poll_Source text,
Date text,
Support_rate real,
Consider_rate real,
Oppose_rate real,
Unsure_rate real
)
|
Give me a bar chart for sum weight of each sex, and rank Y-axis from low to high order.
|
SELECT Sex, SUM(Weight) FROM people GROUP BY Sex ORDER BY SUM(Weight)
|
CREATE TABLE table_5814 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"Location Attendance" text,
"Record" text
)
|
What team has a high score with tracy mcgrady (24)?
|
SELECT "Team" FROM table_5814 WHERE "High points" = 'tracy mcgrady (24)'
|
CREATE TABLE table_204_637 (
id number,
"type" text,
"gauge" text,
"railway" text,
"works no." text,
"year" text,
"builder" text
)
|
what is the total number of garratts produced in 1911 ?
|
SELECT COUNT(*) FROM table_204_637 WHERE "year" = 1911
|
CREATE TABLE table_21313327_1 (
written_by VARCHAR,
no_in_season VARCHAR
)
|
In season number 3, who were the writers?
|
SELECT written_by FROM table_21313327_1 WHERE no_in_season = 3
|
CREATE TABLE table_name_15 (
score VARCHAR,
game VARCHAR,
time VARCHAR
)
|
Game larger than 4, and a Time of 2:26 resulted in what score?
|
SELECT score FROM table_name_15 WHERE game > 4 AND time = "2:26"
|
CREATE TABLE table_1342149_43 (
result VARCHAR,
district VARCHAR
)
|
What was the result of the election in the Texas 4 district?
|
SELECT result FROM table_1342149_43 WHERE district = "Texas 4"
|
CREATE TABLE flight (
aircraft_code_sequence text,
airline_code varchar,
airline_flight text,
arrival_time int,
connections int,
departure_time int,
dual_carrier text,
flight_days text,
flight_id int,
flight_number int,
from_airport varchar,
meal_code text,
stops int,
time_elapsed int,
to_airport varchar
)
CREATE TABLE state (
state_code text,
state_name text,
country_name text
)
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE fare_basis (
fare_basis_code text,
booking_class text,
class_type text,
premium text,
economy text,
discounted text,
night text,
season text,
basis_days text
)
CREATE TABLE restriction (
restriction_code text,
advance_purchase int,
stopovers text,
saturday_stay_required text,
minimum_stay int,
maximum_stay int,
application text,
no_discounts text
)
CREATE TABLE dual_carrier (
main_airline varchar,
low_flight_number int,
high_flight_number int,
dual_airline varchar,
service_name text
)
CREATE TABLE month (
month_number int,
month_name text
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE code_description (
code varchar,
description text
)
CREATE TABLE food_service (
meal_code text,
meal_number int,
compartment text,
meal_description varchar
)
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
CREATE TABLE class_of_service (
booking_class varchar,
rank int,
class_description text
)
CREATE TABLE airport (
airport_code varchar,
airport_name text,
airport_location text,
state_code varchar,
country_name varchar,
time_zone_code varchar,
minimum_connect_time int
)
CREATE TABLE fare (
fare_id int,
from_airport varchar,
to_airport varchar,
fare_basis_code text,
fare_airline text,
restriction_code text,
one_direction_cost int,
round_trip_cost int,
round_trip_required varchar
)
CREATE TABLE compartment_class (
compartment varchar,
class_type varchar
)
CREATE TABLE ground_service (
city_code text,
airport_code text,
transport_type text,
ground_fare int
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE aircraft (
aircraft_code varchar,
aircraft_description varchar,
manufacturer varchar,
basic_type varchar,
engines int,
propulsion varchar,
wide_body varchar,
wing_span int,
length int,
weight int,
capacity int,
pay_load int,
cruising_speed int,
range_miles int,
pressurized varchar
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_airport text,
arrival_time int,
arrival_airline text,
arrival_flight_number int,
departure_time int,
departure_airline text,
departure_flight_number int,
stop_time int
)
CREATE TABLE equipment_sequence (
aircraft_code_sequence varchar,
aircraft_code varchar
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
|
show me the flights from ST. PETERSBURG to TORONTO that arrive before 1200
|
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'TORONTO' AND flight.arrival_time <= 1200 AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'ST. PETERSBURG' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
|
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
)
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
|
For those records from the products and each product's manufacturer, visualize a bar chart about the distribution of name and code , and group by attribute headquarter.
|
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter, T1.Name
|
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
start_time time,
end_time time,
monday varchar,
tuesday varchar,
wednesday varchar,
thursday varchar,
friday varchar,
saturday varchar,
sunday varchar,
has_final_project varchar,
has_final_exam varchar,
textbook varchar,
class_address varchar,
allow_audit varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
description varchar,
num_semesters int,
num_enrolled int,
has_discussion varchar,
has_lab varchar,
has_projects varchar,
has_exams varchar,
num_reviews int,
clarity_score int,
easiness_score int,
helpfulness_score int
)
CREATE TABLE course_tags_count (
course_id int,
clear_grading int,
pop_quiz int,
group_projects int,
inspirational int,
long_lectures int,
extra_credit int,
few_tests int,
good_feedback int,
tough_tests int,
heavy_papers int,
cares_for_students int,
heavy_assignments int,
respected int,
participation int,
heavy_reading int,
tough_grader int,
hilarious int,
would_take_again int,
good_lecture int,
no_skip int
)
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE program (
program_id int,
name varchar,
college varchar,
introduction varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varchar
)
CREATE TABLE instructor (
instructor_id int,
name varchar,
uniqname varchar
)
CREATE TABLE program_course (
program_id int,
course_id int,
workload int,
category varchar
)
CREATE TABLE student_record (
student_id int,
course_id int,
semester int,
grade varchar,
how varchar,
transfer_source varchar,
earn_credit varchar,
repeat_term varchar,
test_id varchar
)
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE semester (
semester_id int,
semester varchar,
year int
)
CREATE TABLE gsi (
course_offering_id int,
student_id int
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE offering_instructor (
offering_instructor_id int,
offering_id int,
instructor_id int
)
|
Will ACABS 470 be offered next semester ?
|
SELECT COUNT(*) > 0 FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'ACABS' AND course.number = 470 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
|
CREATE TABLE table_name_10 (
score VARCHAR,
set_2 VARCHAR,
total VARCHAR
)
|
Which score has a Set 2 of 17 25, and a Total of 48 75?
|
SELECT score FROM table_name_10 WHERE set_2 = "17–25" AND total = "48–75"
|
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
drugstarttime time,
drugstoptime time
)
CREATE TABLE patient (
uniquepid text,
patienthealthsystemstayid number,
patientunitstayid number,
gender text,
age text,
ethnicity text,
hospitalid number,
wardid number,
admissionheight number,
admissionweight number,
dischargeweight number,
hospitaladmittime time,
hospitaladmitsource text,
unitadmittime time,
unitdischargetime time,
hospitaldischargetime time,
hospitaldischargestatus text
)
CREATE TABLE intakeoutput (
intakeoutputid number,
patientunitstayid number,
cellpath text,
celllabel text,
cellvaluenumeric number,
intakeoutputtime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE lab (
labid number,
patientunitstayid number,
labname text,
labresult number,
labresulttime time
)
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
systemicsystolic number,
systemicdiastolic number,
systemicmean number,
observationtime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
|
what are the minimum monthly number of patients diagnosed with increased intracranial pressure - from cerebral edema the last year?
|
SELECT MIN(t1.c1) FROM (SELECT COUNT(DISTINCT diagnosis.patientunitstayid) AS c1 FROM diagnosis WHERE diagnosis.diagnosisname = 'increased intracranial pressure - from cerebral edema' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY STRFTIME('%y-%m', diagnosis.diagnosistime)) AS t1
|
CREATE TABLE university (
School_ID int,
School text,
Location text,
Founded real,
Affiliation text,
Enrollment real,
Nickname text,
Primary_conference text
)
CREATE TABLE basketball_match (
Team_ID int,
School_ID int,
Team_Name text,
ACC_Regular_Season text,
ACC_Percent text,
ACC_Home text,
ACC_Road text,
All_Games text,
All_Games_Percent int,
All_Home text,
All_Road text,
All_Neutral text
)
|
Stack bar chart of school_id vs ACC_Home based on all home, list by the names in ascending.
|
SELECT All_Home, School_ID FROM basketball_match GROUP BY ACC_Home, All_Home ORDER BY All_Home
|
CREATE TABLE table_14248 (
"Elector" text,
"Place of birth" text,
"Cardinalatial title" text,
"Elevated" text,
"Elevator" text
)
|
What is listed for the Elector that also has the Cardinalatial title of Priest of S. Marco?
|
SELECT "Elector" FROM table_14248 WHERE "Cardinalatial title" = 'priest of s. marco'
|
CREATE TABLE university (
school VARCHAR,
nickname VARCHAR,
founded VARCHAR
)
|
List all schools and their nicknames in the order of founded year.
|
SELECT school, nickname FROM university ORDER BY founded
|
CREATE TABLE table_66070 (
"Game" text,
"Date" text,
"Opponent" text,
"Result" text,
"Record" text
)
|
What is the record for the opponent St. Louis Cardinals?
|
SELECT "Record" FROM table_66070 WHERE "Opponent" = 'st. louis cardinals'
|
CREATE TABLE table_46329 (
"Game" real,
"Date" text,
"Team" text,
"Score" text,
"High points" text,
"High rebounds" text,
"High assists" text,
"Location Attendance" text,
"Record" text
)
|
What is the score when the record was 40 36?
|
SELECT "Score" FROM table_46329 WHERE "Record" = '40–36'
|
CREATE TABLE table_36526 (
"Date" text,
"Opponent" text,
"Score" text,
"Loss" text,
"Attendance" real,
"Record" text
)
|
Record of 11 12 involved what average attendance figures?
|
SELECT AVG("Attendance") FROM table_36526 WHERE "Record" = '11–12'
|
CREATE TABLE table_59255 (
"Player" text,
"Seasons" text,
"Games" text,
"Goals" text,
"Assists" text,
"Points" text
)
|
How many points were scored by the player who played 363 games?
|
SELECT "Points" FROM table_59255 WHERE "Games" = '363'
|
CREATE TABLE table_name_45 (
Id VARCHAR
)
|
What 2009 has 39th as the 2011?
|
SELECT 2009 FROM table_name_45 WHERE 2011 = "39th"
|
CREATE TABLE table_35763 (
"Date" text,
"Venue" text,
"Opponents" text,
"Score" text,
"Competition" text
)
|
Opponents of police, and a Venue of selayang municipal council stadium had what date?
|
SELECT "Date" FROM table_35763 WHERE "Opponents" = 'police' AND "Venue" = 'selayang municipal council stadium'
|
CREATE TABLE CLASS (
class_code VARCHAR,
class_room VARCHAR
)
|
List the codes of all courses that take place in room KLR209.
|
SELECT class_code FROM CLASS WHERE class_room = 'KLR209'
|
CREATE TABLE table_204_958 (
id number,
"episode" number,
"original broadcast date" text,
"average" number,
"rank" number,
"remarks" text
)
|
how many aired in may ?
|
SELECT COUNT(*) FROM table_204_958 WHERE "original broadcast date" = 5
|
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE diagnoses_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE chartevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE patients (
row_id number,
subject_id number,
gender text,
dob time,
dod time
)
CREATE TABLE icustays (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
first_careunit text,
last_careunit text,
first_wardid number,
last_wardid number,
intime time,
outtime time
)
CREATE TABLE d_labitems (
row_id number,
itemid number,
label text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE microbiologyevents (
row_id number,
subject_id number,
hadm_id number,
charttime time,
spec_type_desc text,
org_name text
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_type text,
admission_location text,
discharge_location text,
insurance text,
language text,
marital_status text,
ethnicity text,
age number
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
dose_val_rx text,
dose_unit_rx text,
route text
)
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE labevents (
row_id number,
subject_id number,
hadm_id number,
itemid number,
charttime time,
valuenum number,
valueuom text
)
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
|
did patient 61527 get a prescription for docusate sodium, potassium chloride, or spironolactone in a year before?
|
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 61527) AND prescriptions.drug IN ('docusate sodium', 'potassium chloride', 'spironolactone') AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
|
CREATE TABLE jobs (
JOB_ID varchar(10),
JOB_TITLE varchar(35),
MIN_SALARY decimal(6,0),
MAX_SALARY decimal(6,0)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE countries (
COUNTRY_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 locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40),
POSTAL_CODE varchar(12),
CITY varchar(30),
STATE_PROVINCE varchar(25),
COUNTRY_ID varchar(2)
)
CREATE TABLE job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
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),
HIRE_DATE date,
JOB_ID varchar(10),
SALARY decimal(8,2),
COMMISSION_PCT decimal(2,2),
MANAGER_ID decimal(6,0),
DEPARTMENT_ID decimal(4,0)
)
|
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a scatter chart about the correlation between commission_pct and department_id .
|
SELECT COMMISSION_PCT, DEPARTMENT_ID FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
|
CREATE TABLE table_name_22 (
driver VARCHAR,
laps VARCHAR,
grid VARCHAR
)
|
What driver raced for more than 9 laps on grid 7?
|
SELECT driver FROM table_name_22 WHERE laps > 9 AND grid = 7
|
CREATE TABLE table_name_99 (
league_cup INTEGER,
fa_cup VARCHAR,
championship VARCHAR,
total VARCHAR
)
|
What is the highest league up with less than 3 championships, a total less than 2, and a FA cup larger than 0?
|
SELECT MAX(league_cup) FROM table_name_99 WHERE championship < 3 AND total < 2 AND fa_cup > 0
|
CREATE TABLE table_name_22 (
power VARCHAR,
model VARCHAR,
displacement VARCHAR
)
|
How much power does the 1500 model have with a displacement of 1490cc?
|
SELECT power FROM table_name_22 WHERE model = "1500" AND displacement = "1490cc"
|
CREATE TABLE table_203_208 (
id number,
"team" text,
"location" text,
"venue" text,
"capacity" number,
"position in 1993-94" number
)
|
the spartak , bobruisk venue is has a larger capacity than which other venues ?
|
SELECT "venue" FROM table_203_208 WHERE "capacity" < (SELECT "capacity" FROM table_203_208 WHERE "venue" = 'spartak, bobruisk')
|
CREATE TABLE table_38179 (
"Round" text,
"Venue" text,
"Discipline" text,
"Date" text,
"Winner" text,
"Second" text,
"Third" text
)
|
Who was the winner on 28 December 2007?
|
SELECT "Winner" FROM table_38179 WHERE "Date" = '28 december 2007'
|
CREATE TABLE table_name_24 (
engine VARCHAR,
chassis VARCHAR
)
|
Which engine has a Chassis of lotus 44 f2?
|
SELECT engine FROM table_name_24 WHERE chassis = "lotus 44 f2"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.