table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE invoice_line_items (
order_item_id number,
invoice_number number,
product_id number,
product_title text,
product_quantity text,
product_price number,
derived_product_cost number,
derived_vat_payable number,
derived_total_cost number
)
CREATE TABLE orders (
order_id ... | Show the number of customers for each gender. | SELECT gender, COUNT(*) FROM customers GROUP BY gender |
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE labevents (
row... | when did patient 51977 last year for the first time leave the hospital? | SELECT admissions.dischtime FROM admissions WHERE admissions.subject_id = 51977 AND DATETIME(admissions.dischtime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') ORDER BY admissions.dischtime LIMIT 1 |
CREATE TABLE table_name_21 (
nationality VARCHAR,
pick VARCHAR
) | Which nationality's pick was 415? | SELECT nationality FROM table_name_21 WHERE pick = "415" |
CREATE TABLE table_name_17 (
opposition VARCHAR,
city VARCHAR
) | Which Opposition has a City of taunton? | SELECT opposition FROM table_name_17 WHERE city = "taunton" |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
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... | what are the three most commonly prescribed medications for patients who have previously been diagnosed with opioid/other dep-unspec within 2 months, since 4 years ago? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 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 ... |
CREATE TABLE table_2794180_11 (
radio_commentator VARCHAR,
television_commentator VARCHAR
) | Who made the comments for radio broadcast when Jan Gabrielsson made them for television broadcast? | SELECT radio_commentator FROM table_2794180_11 WHERE television_commentator = "Jan Gabrielsson" |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE PostHistoryTypes (
Id number,
Name te... | Short WHYT comments, Id only. | SELECT Id AS "comment_link" FROM Comments WHERE LOWER(Text) LIKE 'what have you tried%' AND LENGTH(Text) < 75 ORDER BY LENGTH(Text), Id |
CREATE TABLE table_31288 (
"Season" text,
"Level" text,
"Division" text,
"Section" text,
"Position" text,
"Movements" text
) | what is the name of the movement in the 7th position | SELECT "Movements" FROM table_31288 WHERE "Position" = '7th' |
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,
... | How many patients admitted before the year 2164 had a test for PTT? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2146" AND lab.label = "PTT" |
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... | what is admission time and discharge time of subject name tracy farmer? | SELECT demographic.admittime, demographic.dischtime FROM demographic WHERE demographic.name = "Tracy Farmer" |
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 cost (
costid number,
uniquepi... | had patient 017-59454 excreted any output (ml)-urethral catheter latex;temperature probe 14 fr. since 89 months ago? | SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '017-59454')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutpu... |
CREATE TABLE table_74945 (
"Club" text,
"Played" text,
"Drawn" text,
"Lost" text,
"Points for" text,
"Points against" text,
"Tries for" text,
"Tries against" text,
"Try bonus" text,
"Losing bonus" text,
"Points" text
) | If played is 22 and the tries against are 43, what are the points? | SELECT "Points for" FROM table_74945 WHERE "Played" = '22' AND "Tries against" = '43' |
CREATE TABLE table_25604014_9 (
production_code VARCHAR,
written_by VARCHAR
) | Name the production code for theresa rebeck | SELECT production_code FROM table_25604014_9 WHERE written_by = "Theresa Rebeck" |
CREATE TABLE table_name_68 (
fleet_numbers VARCHAR,
diagram VARCHAR,
built VARCHAR
) | What fleet numbers have a diagram less than 99 and built in 1960? | SELECT fleet_numbers FROM table_name_68 WHERE diagram < 99 AND built = "1960" |
CREATE TABLE table_48183 (
"Year" real,
"Entrant" text,
"Chassis" text,
"Engine" text,
"Points" text
) | What engine has the Mercedes AMG Petronas f1 team, and 93 points? | SELECT "Engine" FROM table_48183 WHERE "Entrant" = 'mercedes amg petronas f1 team' AND "Points" = '93' |
CREATE TABLE table_44347 (
"Rank" text,
"Time" text,
"Athlete" text,
"Nation" text,
"Date" text,
"Race" text
) | What is the name of the athlete with a time of 30:48? | SELECT "Athlete" FROM table_44347 WHERE "Time" = '30:48' |
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 patients (
row_... | when was the last time when patient 65582 had the maximum value of calculated total co2 since 08/2104? | SELECT labevents.charttime FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 65582) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'calculated total co2') AND STRFTIME('%y-%m', labevents.charttime) >= '2104-08' ... |
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, draw a bar chart about the distribution of headquarter and the average of manufacturer , and group by attribute headquarter, I want to sort by the x-axis in descending. | SELECT Headquarter, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC |
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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END_DATE date,
JOB_ID varchar(10),
... | For all employees who have the letters D or S in their first name, show me the trend about salary over hire_date with a line chart, I want to show x axis in desc order. | SELECT HIRE_DATE, SALARY FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%' ORDER BY HIRE_DATE DESC |
CREATE TABLE table_71569 (
"Rank" real,
"Name" text,
"Nationality" text,
"Score" text,
"Perfection" text
) | What was the rank of Svetlana Fedorenko? | SELECT "Rank" FROM table_71569 WHERE "Name" = 'svetlana fedorenko' |
CREATE TABLE Manufacturers (
Code INTEGER,
Name VARCHAR(255),
Headquarter VARCHAR(255),
Founder VARCHAR(255),
Revenue REAL
)
CREATE TABLE Products (
Code INTEGER,
Name VARCHAR(255),
Price DECIMAL,
Manufacturer INTEGER
) | For those records from the products and each product's manufacturer, visualize a scatter chart about the correlation between code and price , and group by attribute headquarter. | SELECT T1.Code, T1.Price FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter |
CREATE TABLE table_78872 (
"Team" text,
"City" text,
"Venue" text,
"Capacity" real,
"Head Coach" text,
"Team Captain" text,
"Past Season" text
) | What is the Capacity of the Venue of Head Coach Farhad Kazemi? | SELECT SUM("Capacity") FROM table_78872 WHERE "Head Coach" = 'farhad kazemi' |
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... | count the number of patients whose diagnosis short title is pyelonephritis nos and lab test abnormal status is delta. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Pyelonephritis NOS" AND lab.flag = "delta" |
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,
... | what is the number of patients whose age is less than 31 and diagnoses icd9 code is 2809? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "31" AND diagnoses.icd9_code = "2809" |
CREATE TABLE table_name_29 (
Vice VARCHAR,
president VARCHAR,
treasurer VARCHAR
) | Which Vice President has a President of daniel masny, and a Treasurer of rebecca t. altmann? | SELECT Vice AS president FROM table_name_29 WHERE president = "daniel masny" AND treasurer = "rebecca t. altmann" |
CREATE TABLE table_name_78 (
score VARCHAR,
home VARCHAR,
date VARCHAR
) | What score has detroit as the home, and December 9 as the date? | SELECT score FROM table_name_78 WHERE home = "detroit" AND date = "december 9" |
CREATE TABLE table_name_22 (
place VARCHAR,
score VARCHAR
) | What was the place when the score was 71-69-71=211? | SELECT place FROM table_name_22 WHERE score = 71 - 69 - 71 = 211 |
CREATE TABLE table_55963 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the Home team score when the crowd was larger than 12,240 and Carlton was the away team? | SELECT "Home team score" FROM table_55963 WHERE "Crowd" > '12,240' AND "Away team" = 'carlton' |
CREATE TABLE table_69120 (
"Name" text,
"Years" text,
"Gender" text,
"Area" text,
"Authority" text,
"Decile" real,
"Roll" real
) | What is the highest roll number of the school with a state authority and a decile smaller than 8? | SELECT MAX("Roll") FROM table_69120 WHERE "Authority" = 'state' AND "Decile" < '8' |
CREATE TABLE table_name_40 (
score VARCHAR,
high_assists VARCHAR
) | Which Score has a High assists of whalen (5)? | SELECT score FROM table_name_40 WHERE high_assists = "whalen (5)" |
CREATE TABLE table_74400 (
"Date" text,
"Time" text,
"ACC Team" text,
"Big Ten Team" text,
"Location" text,
"Television" text,
"Attendance" real,
"Winner" text,
"Challenge Leader" text
) | Who were the challenge leaders of the games won by boston college (88-76)? | SELECT "Challenge Leader" FROM table_74400 WHERE "Winner" = 'Boston College (88-76)' |
CREATE TABLE program_requirement (
program_id int,
category varchar,
min_credit int,
additional_req varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requirement varchar,
... | 542 is what size ? | SELECT DISTINCT num_enrolled FROM course WHERE department = 'EECS' AND number = 542 |
CREATE TABLE table_26178 (
"Neighbourhood" text,
"% 0-19" text,
"% 20-39" text,
"% 40-59" text,
"% 60-74" text,
"% 75 +" text
) | What is every value for % 75 + if % 0-19 is 19,75%? | SELECT "% 75 +" FROM table_26178 WHERE "% 0-19" = '19,75%' |
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,
... | Find the number of patients who had biopsy of bone marrow that stayed in the hospital for more than 6 days. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.days_stay > "6" AND procedures.long_title = "Biopsy of bone marrow" |
CREATE TABLE table_50916 (
"Governor" text,
"State" text,
"Past" text,
"Party" text,
"Elected/assumed office" real,
"Seat up" real
) | What state had an elected/assumed office in 2013? | SELECT "State" FROM table_50916 WHERE "Elected/assumed office" = '2013' |
CREATE TABLE table_name_27 (
goals_for INTEGER,
team VARCHAR,
lost VARCHAR
) | Which Goals For has a Team of congleton town, and a Lost larger than 11? | SELECT MAX(goals_for) FROM table_name_27 WHERE team = "congleton town" AND lost > 11 |
CREATE TABLE table_5565 (
"Series Ep." text,
"Episode" real,
"Netflix" text,
"Segment A" text,
"Segment B" text,
"Segment C" text,
"Segment D" text
) | Name the series ep for darts | SELECT "Series Ep." FROM table_5565 WHERE "Segment D" = 'darts' |
CREATE TABLE table_name_19 (
hometown VARCHAR,
player VARCHAR
) | Which hometown has a player of Ray Drew? | SELECT hometown FROM table_name_19 WHERE player = "ray drew" |
CREATE TABLE table_name_42 (
year INTEGER,
venue VARCHAR
) | What is the lowest Year, when Venue is Rio De Janeiro, Brazil? | SELECT MIN(year) FROM table_name_42 WHERE venue = "rio de janeiro, brazil" |
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 inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
... | has there been any blood culture microbiology test done for patient 56490 in 09/last year? | SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 56490) AND microbiologyevents.spec_type_desc = 'blood culture' AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', ... |
CREATE TABLE table_47775 (
"Game" real,
"Date" text,
"Opponent" text,
"Score" text,
"Record" text
) | What was the Maple Leafs' record on game 52? | SELECT "Record" FROM table_47775 WHERE "Game" = '52' |
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE ReviewTaskStates (
Id number,
Name text,
Description text
)
CREATE TABLE FlagTypes (
Id number,
Name text,
Des... | Top tags related to JavaScript. | SELECT p.Tags FROM Posts AS p, PostTags AS pt, Tags AS t WHERE pt.PostId = p.Id AND pt.TagId = t.Id AND t.TagName = 'scan' GROUP BY p.Tags |
CREATE TABLE gsi (
course_offering_id int,
student_id 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,
... | On the LACS 400 -level , what 6 -credit courses are there ? | SELECT DISTINCT department, name, number FROM course WHERE credits = 6 AND department = 'LACS' AND number < 400 + 100 AND number >= 400 |
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),
... | For those employees who do not work in departments with managers that have ids between 100 and 200, give me the comparison about the average of department_id over the hire_date bin hire_date by weekday, and could you list in descending by the y-axis please? | SELECT HIRE_DATE, AVG(DEPARTMENT_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(DEPARTMENT_ID) DESC |
CREATE TABLE table_24380 (
"No." real,
"Date" text,
"Tournament" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Runner(s)-up" text
) | Name the to par for 20 feb 2005 | SELECT "To par" FROM table_24380 WHERE "Date" = '20 Feb 2005' |
CREATE TABLE table_30457 (
"Series #" real,
"Title" text,
"Written by" text,
"Directed by" text,
"Original air date" text,
"Production code" text,
"U.S. viewers (millions)" text
) | How many million u.s. viewers watched the episode with a production code of 2t7004? | SELECT "U.S. viewers (millions)" FROM table_30457 WHERE "Production code" = '2T7004' |
CREATE TABLE table_52735 (
"Number" real,
"Name" text,
"Builder" text,
"Type" text,
"Date" real
) | What is the name of the train numbered less than 6 before 1993? | SELECT "Name" FROM table_52735 WHERE "Number" < '6' AND "Date" < '1993' |
CREATE TABLE table_45223 (
"Official Name" text,
"Status" text,
"Area km 2" real,
"Population" real,
"Census Ranking" text
) | What is the Official Name of the Community with an Area km 2 of 16.13? | SELECT "Official Name" FROM table_45223 WHERE "Area km 2" = '16.13' |
CREATE TABLE days (
days_code varchar,
day_name varchar
)
CREATE TABLE airline (
airline_code varchar,
airline_name text,
note text
)
CREATE TABLE time_zone (
time_zone_code text,
time_zone_name text,
hours_from_gmt int
)
CREATE TABLE time_interval (
period text,
begin_time in... | what airline is AC | SELECT DISTINCT airline_code FROM airline WHERE airline_code = 'AC' |
CREATE TABLE table_73927 (
"Episode" text,
"Theme" text,
"Song choice" text,
"Original artist" text,
"Order #" text,
"Result" text
) | The theme Auditioner's Choice has what song choice? | SELECT "Song choice" FROM table_73927 WHERE "Theme" = 'Auditioner''s Choice' |
CREATE TABLE table_name_4 (
date VARCHAR,
score_in_the_final VARCHAR
) | What Date has a Score in the final of 3 6, 2 6, 4 6? | SELECT date FROM table_name_4 WHERE score_in_the_final = "3–6, 2–6, 4–6" |
CREATE TABLE table_19993 (
"Condition/Parameter" text,
"Coordinate velocity v dx/dt in units of c" text,
"Velocity angle \u03b7 in i-radians" text,
"Proper velocity w dx/d\u03c4 in units of c" text,
"Lorentz factor \u03b3 dt/d\u03c4 = E/mc 2" text
) | If the condition/parameter is rapidity of 1 hyperbolic radian, what is the proper velocity w dx/d in units of c? | SELECT "Proper velocity w dx/d\u03c4 in units of c" FROM table_19993 WHERE "Condition/Parameter" = 'Rapidity of 1 hyperbolic radian' |
CREATE TABLE table_name_98 (
high_assists VARCHAR,
high_points VARCHAR
) | What was the high assists from a high points of dorell wright (20)? | SELECT high_assists FROM table_name_98 WHERE high_points = "dorell wright (20)" |
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 employees (
EMPLOYEE_I... | Show the average salary by each hire date of employees, and please bin the hire date into the day of week interval for showing a bar chart, could you order by the Y from high to low? | SELECT HIRE_DATE, AVG(SALARY) FROM employees ORDER BY AVG(SALARY) DESC |
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... | count the number of black/cape verdean patients who have base type drug prescription. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "BLACK/CAPE VERDEAN" AND prescriptions.drug_type = "BASE" |
CREATE TABLE procedures_icd (
row_id number,
subject_id number,
hadm_id number,
icd9_code text,
charttime time
)
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABL... | when was the first time patient 14990 respiratory rate was measured less than 25.0 on the first icu visit. | SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14990) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime LIMIT 1) AND chartevents.itemid IN (... |
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE medication (
medicationid number,
patientunitstayid number,
drugname text,
dosage text,
routeadmin text,
d... | when was the last time patient 030-52327 was having less than 80.0 sao2 yesterday? | SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-52327')) AND vitalperiodic.sao2 < 80.0 AND NOT ... |
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... | how many black/african american patients had the item id 51363? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "BLACK/AFRICAN AMERICAN" AND lab.itemid = "51363" |
CREATE TABLE table_name_61 (
format VARCHAR,
catalog VARCHAR
) | What shows as the format for catalog 11 135? | SELECT format FROM table_name_61 WHERE catalog = "11 135" |
CREATE TABLE table_30071 (
"Week" real,
"Date" text,
"Kickoff" text,
"Opponent" text,
"Final score" text,
"Team record" text,
"Game site" text,
"Attendance" real
) | what was the opposition where the field is waldstadion during time 6 | SELECT "Opponent" FROM table_30071 WHERE "Game site" = 'Waldstadion' AND "Week" = '6' |
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 medication (
medicatio... | what is five year survival rate of patients diagnosed with upper gi bleeding? | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 5 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOI... |
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... | provide the number of patients with a diagnoses of personal history of other malignant neoplasm of rectum, rectosigmoid junction and anus and are still alive. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Hx-rectal & anal malign" |
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(... | For those employees who did not have any job in the past, a bar chart shows the distribution of hire_date and the average of employee_id bin hire_date by weekday. | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
CREATE TABLE table_79795 (
"Rank" real,
"Nation" text,
"Gold" real,
"Silver" real,
"Bronze" real,
"Total" real
) | What is the maximum number of silvers for a country with fewer than 12 golds and a total less than 8? | SELECT MAX("Silver") FROM table_79795 WHERE "Gold" < '12' AND "Total" < '8' |
CREATE TABLE microlab (
microlabid number,
patientunitstayid number,
culturesite text,
organism text,
culturetakentime time
)
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid num... | on the first icu visit what was the minimum value of sao2 of patient 009-15? | SELECT MIN(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-15') AND NOT patient.unitdischargetime IS NULL ORDER ... |
CREATE TABLE table_20246201_9 (
office VARCHAR,
candidate VARCHAR
) | What office is Jon Huntsman a candidate for? | SELECT office FROM table_20246201_9 WHERE candidate = "Jon Huntsman" |
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 d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE diagn... | how many hours have passed since patient 40059 was admitted to the hospital. | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', admissions.admittime)) FROM admissions WHERE admissions.subject_id = 40059 AND admissions.dischtime IS NULL |
CREATE TABLE basketball_match (
team_id number,
school_id number,
team_name text,
acc_regular_season text,
acc_percent text,
acc_home text,
acc_road text,
all_games text,
all_games_percent number,
all_home text,
all_road text,
all_neutral text
)
CREATE TABLE university (... | What are the schools that were either founded before 1850 or are public? | SELECT school FROM university WHERE founded > 1850 OR affiliation = 'Public' |
CREATE TABLE TagSynonyms (
Id number,
SourceTagName text,
TargetTagName text,
CreationDate time,
OwnerUserId number,
AutoRenameCount number,
LastAutoRename time,
Score number,
ApprovedByUserId number,
ApprovalDate time
)
CREATE TABLE PostHistoryTypes (
Id number,
Name te... | Top Comments of a user. | SELECT PostId AS "post_link", Score, Text FROM Comments WHERE UserId = '##UserId##' ORDER BY Score DESC LIMIT 250 |
CREATE TABLE Documents (
Document_ID INTEGER,
Document_Type_Code CHAR(15),
Project_ID INTEGER,
Document_Date DATETIME,
Document_Name VARCHAR(255),
Document_Description VARCHAR(255),
Other_Details VARCHAR(255)
)
CREATE TABLE Statements (
Statement_ID INTEGER,
Statement_Details VARCHA... | What is the project id and detail for the project with at least two documents Plot them as bar chart, and list x-axis in descending order. | SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_Details DESC |
CREATE TABLE table_name_43 (
report VARCHAR,
venue VARCHAR
) | What was the report at State Sports Centre? | SELECT report FROM table_name_43 WHERE venue = "state sports centre" |
CREATE TABLE table_54314 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | In which of North Melbourne's away games was there the lowest crowd? | SELECT MIN("Crowd") FROM table_54314 WHERE "Away team" = 'north melbourne' |
CREATE TABLE schedule (
Cinema_ID int,
Film_ID int,
Date text,
Show_times_per_day int,
Price float
)
CREATE TABLE film (
Film_ID int,
Rank_in_series int,
Number_in_season int,
Title text,
Directed_by text,
Original_air_date text,
Production_code text
)
CREATE TABLE cine... | Show each location and the number of cinemas there Show bar chart, I want to display in ascending by the X-axis. | SELECT Location, COUNT(*) FROM cinema GROUP BY Location ORDER BY Location |
CREATE TABLE area (
course_id int,
area varchar
)
CREATE TABLE ta (
campus_job_id int,
student_id int,
location varchar
)
CREATE TABLE course (
course_id int,
name varchar,
department varchar,
number varchar,
credits varchar,
advisory_requirement varchar,
enforced_requi... | In HISTORY 497 which section is after 17:15 A.M. ? | SELECT DISTINCT course_offering.end_time, course_offering.section_number, course_offering.start_time FROM course, course_offering, semester WHERE course_offering.start_time > '17:15' AND course.course_id = course_offering.course_id AND course.department = 'HISTORY' AND course.number = 497 AND semester.semester = 'WN' A... |
CREATE TABLE table_74251 (
"Date/Location" text,
"Mens singles" text,
"Womens Singles" text,
"U21 Mens" text,
"U21 Womens" text,
"Mixed Restricted" text,
"Mixed Veteran" text
) | When Naomi Owen won the Womens Singles and Ricardo Walther won the Mens Singles, who won the mixed veteran? | SELECT "Mixed Veteran" FROM table_74251 WHERE "Womens Singles" = 'Naomi Owen' AND "Mens singles" = 'Ricardo Walther' |
CREATE TABLE table_name_11 (
after_debt VARCHAR,
cash_on_hand VARCHAR
) | How much is after debt when cash on hand is $651,300? | SELECT after_debt FROM table_name_11 WHERE cash_on_hand = "$651,300" |
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE jobs (
job_id int,
job_title varchar,
description varchar,
requirement varchar,
city varchar,
state varchar,
country varchar,
zip int
)
CREATE TABLE area (
course_id int,
area varchar
)
... | What is the least difficult ULCS course with the largest class size ? | SELECT DISTINCT department, name, number FROM course WHERE course_id IN (SELECT PROGRAM_COURSE_ID FROM program_course AS PROGRAM_COURSE WHERE PROGRAM_WORKLOAD = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%ULCS%')) AND num_enrolled = (... |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE prescriptions... | among patients who remained admitted in hospital for more than 20 days, calculate the number of those on po therapy. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "20" AND prescriptions.route = "ORAL" |
CREATE TABLE table_49256 (
"Date" text,
"Home team" text,
"Score" text,
"Away team" text,
"Venue" text,
"Box Score" text,
"Report" text
) | What venue had a Score of 120-108? | SELECT "Venue" FROM table_49256 WHERE "Score" = '120-108' |
CREATE TABLE table_76217 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" real,
"Money ( $ )" real
) | What is the Johnny Palmer with a To larger than 6 Money sum? | SELECT SUM("Money ( $ )") FROM table_76217 WHERE "To par" > '6' AND "Player" = 'johnny palmer' |
CREATE TABLE happy_hour (
hh_id number,
shop_id number,
month text,
num_of_shaff_in_charge number
)
CREATE TABLE member (
member_id number,
name text,
membership_card text,
age number,
time_of_purchase number,
level_of_membership number,
address text
)
CREATE TABLE shop (
... | Which month has the most happy hours? | SELECT month FROM happy_hour GROUP BY month ORDER BY COUNT(*) DESC LIMIT 1 |
CREATE TABLE table_48341 (
"Year" real,
"MLB Club" text,
"Record" text,
"Finish" text,
"Manager" text
) | who is the manager when the year is before 1994 and finish is 5th? | SELECT "Manager" FROM table_48341 WHERE "Year" < '1994' AND "Finish" = '5th' |
CREATE TABLE table_name_7 (
date VARCHAR,
home_team VARCHAR
) | When did the north melbourne team play? | SELECT date FROM table_name_7 WHERE home_team = "north melbourne" |
CREATE TABLE table_11884814_3 (
interview VARCHAR,
country VARCHAR
) | What was the interview score for Hawaii? | SELECT interview FROM table_11884814_3 WHERE country = "Hawaii" |
CREATE TABLE table_20649850_1 (
college VARCHAR,
position VARCHAR
) | Where did the ol go to college? | SELECT college FROM table_20649850_1 WHERE position = "OL" |
CREATE TABLE table_name_71 (
type VARCHAR,
name__wade_giles_ VARCHAR
) | What is the type of Kuang-Hsing? | SELECT type FROM table_name_71 WHERE name__wade_giles_ = "kuang-hsing" |
CREATE TABLE table_23947 (
"City (Utility)" text,
"Residential Monthly usage: 1000 kWh" text,
"Small power Power demand: 40 kW; Consumption 10,000 kWh, load factor: 35%." text,
"Medium power Power demand: 1,000 kW; Consumption: 400,000 kWh, load factor: 56 %." text,
"Large power Power demand: 50,000... | What is every residential monthly usage if large power demand is 6.86? | SELECT "Residential Monthly usage: 1000 kWh" FROM table_23947 WHERE "Large power Power demand: 50,000 kW; Consumption: 30,600,000 kWh, load factor: 85%." = '6.86' |
CREATE TABLE table_203_353 (
id number,
"#" number,
"title" text,
"producer(s)" text,
"featured guest(s)" text,
"time" text
) | how many tracks have their producer as mike punch harper ? | SELECT COUNT("title") FROM table_203_353 WHERE "producer(s)" = 'mike "punch" harper' |
CREATE TABLE regions (
REGION_ID decimal(5,0),
REGION_NAME varchar(25)
)
CREATE TABLE departments (
DEPARTMENT_ID decimal(4,0),
DEPARTMENT_NAME varchar(30),
MANAGER_ID decimal(6,0),
LOCATION_ID decimal(4,0)
)
CREATE TABLE locations (
LOCATION_ID decimal(4,0),
STREET_ADDRESS varchar(40)... | For employees without the letter M in their first name, give me a line chart to show the salary change over their hire date using a line chart, order from low to high by the X. | SELECT HIRE_DATE, SALARY FROM employees WHERE NOT FIRST_NAME LIKE '%M%' ORDER BY HIRE_DATE |
CREATE TABLE table_name_56 (
total INTEGER,
player VARCHAR
) | What is the Total of Player Craig Stadler? | SELECT AVG(total) FROM table_name_56 WHERE player = "craig stadler" |
CREATE TABLE table_13018091_1 (
won INTEGER,
club VARCHAR
) | How many games did whitehaven win? | SELECT MIN(won) FROM table_13018091_1 WHERE club = "Whitehaven" |
CREATE TABLE table_19753079_13 (
result VARCHAR,
district VARCHAR
) | What was the result of the Georgia 8 district? | SELECT result FROM table_19753079_13 WHERE district = "Georgia 8" |
CREATE TABLE table_name_25 (
lead VARCHAR,
left_bloc VARCHAR
) | Name the lead with left bloc of 8.4% | SELECT lead FROM table_name_25 WHERE left_bloc = "8.4%" |
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 (... | what is admission time of subject id 6983? | SELECT demographic.admittime FROM demographic WHERE demographic.subject_id = "6983" |
CREATE TABLE table_name_48 (
date VARCHAR,
leading_scorer VARCHAR
) | When has a Leading scorer of ricky davis (20)? | SELECT date FROM table_name_48 WHERE leading_scorer = "ricky davis (20)" |
CREATE TABLE table_58996 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" real,
"Money ( \u00a3 )" text
) | What is the lowest to par of a player from australia with a score of 76-70-75-72=293? | SELECT MIN("To par") FROM table_58996 WHERE "Country" = 'australia' AND "Score" = '76-70-75-72=293' |
CREATE TABLE table_name_2 (
rules VARCHAR,
location VARCHAR,
event VARCHAR,
result VARCHAR
) | Which rule has The Event of n/a, The Result of loss, and The Location of winsford england? | SELECT rules FROM table_name_2 WHERE event = "n/a" AND result = "loss" AND location = "winsford england" |
CREATE TABLE table_64833 (
"Japanese Title" text,
"English Title" text,
"Year" real,
"First publisher" text,
"ISBN" text
) | What is the First Publisher prior to 1999? | SELECT "First publisher" FROM table_64833 WHERE "Year" < '1999' |
CREATE TABLE table_23718905_6 (
bowl_game VARCHAR,
matchup_results VARCHAR
) | In what bowl game was the result Oklahoma 31, Stanford 27? | SELECT bowl_game FROM table_23718905_6 WHERE matchup_results = "Oklahoma 31, Stanford 27" |
CREATE TABLE table_name_98 (
loss VARCHAR,
date VARCHAR
) | Who recorded the loss on august 7? | SELECT loss FROM table_name_98 WHERE date = "august 7" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.