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,... | 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 te... | 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... | 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 ele... |
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
)
C... | 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 num... | 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 tr... |
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... | 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,
... | 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),
... | 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... | 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,
a... | 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.chargetim... |
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... | 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 T... | 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_proje... | 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... |
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 tex... | 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,... | 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_di... |
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,... | 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 ... |
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 (
uniquep... | 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(CU... |
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,
Nu... | 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_... | 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(... | 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,
systemics... | 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'))... |
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... | 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 (
... | 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,
... | 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 DATE... | 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... | 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 re... | 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,... | 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.airpor... |
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 varch... | 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,
a... | 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',... |
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_Per... | 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,
... | 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(), 's... |
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... | 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.