table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
RejectionReasonId number,
Comment text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
... | Negatively scored answers that have been recently undeleted. | SELECT e.PostId AS "post_link", p.Score, e.CreationDate AS "undeletion_date", p.Body FROM PostHistory AS e INNER JOIN Posts AS p ON e.PostId = p.Id WHERE p.PostTypeId = 2 AND p.Score < 0 AND e.PostHistoryTypeId = 13 ORDER BY e.CreationDate DESC |
CREATE TABLE table_name_16 (
rides VARCHAR,
bonus_pts VARCHAR,
total_points VARCHAR,
rider VARCHAR
) | How many rides did it take Ray Day to get 274 points in total with less than 3 bonus points? | SELECT COUNT(rides) FROM table_name_16 WHERE total_points < 274 AND rider = "ray day" AND bonus_pts > 3 |
CREATE TABLE airports (
city VARCHAR,
country VARCHAR
) | How many airports are there per city in the United States? Order the cities by decreasing number of airports. | SELECT COUNT(*), city FROM airports WHERE country = 'United States' GROUP BY city ORDER BY COUNT(*) DESC |
CREATE TABLE table_name_80 (
player VARCHAR,
score VARCHAR
) | What is Player, when Score is '68-71=139'? | SELECT player FROM table_name_80 WHERE score = 68 - 71 = 139 |
CREATE TABLE table_80190 (
"City" text,
"Country" text,
"IATA" text,
"ICAO" text,
"Airport" text
) | What city is fuhlsb ttel airport in? | SELECT "City" FROM table_80190 WHERE "Airport" = 'fuhlsbüttel airport' |
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,
... | among patients treated with main drug, calculate the number of those who had icd9 code 7291 | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.icd9_code = "7291" AND prescriptions.drug_type = "MAIN" |
CREATE TABLE train (
Train_ID int,
Train_Num text,
Name text,
From text,
Arrival text,
Railway_ID int
)
CREATE TABLE manager (
Manager_ID int,
Name text,
Country text,
Working_year_starts text,
Age int,
Level int
)
CREATE TABLE railway_manage (
Railway_ID int,
M... | Show id and location of railways that are associated with more than one train. Visualize by bar chart. | SELECT T1.Location, T1.Railway_ID FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID |
CREATE TABLE cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id number,
chargetime time,
cost number
)
CREATE TABLE d_icd_procedures (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE admissions (
row_id num... | count the number of patients who have had an glucose, body fluid test this year. | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT labevents.hadm_id FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'glucose, body fluid') AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME... |
CREATE TABLE table_13336122_3 (
title VARCHAR,
directed_by VARCHAR,
no_in_series VARCHAR
) | What's the title of the episode directed by David von Ancken, with a episode number bigger than 16.0? | SELECT title FROM table_13336122_3 WHERE directed_by = "David Von Ancken" AND no_in_series > 16.0 |
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,
... | give me the number of patients whose primary disease is t5 fracture and procedure icd9 code is 8105? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "T5 FRACTURE" AND procedures.icd9_code = "8105" |
CREATE TABLE table_1341568_34 (
district VARCHAR,
party VARCHAR,
elected VARCHAR
) | In how many districts was the democratic incumbent elected in 1974? | SELECT COUNT(district) FROM table_1341568_34 WHERE party = "Democratic" AND elected = 1974 |
CREATE TABLE table_204_793 (
id number,
"call-sign" text,
"location" text,
"rf" number,
"psip" number,
"programming" text
) | is the rf for wivm ld 39 or 29 ? | SELECT "rf" FROM table_204_793 WHERE "rf" IN (39, 29) AND "call-sign" = 'wivm-ld' |
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... | Which classes next semester can be taken as ULCS ? | SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program, program_course, semester WHERE course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_... |
CREATE TABLE table_68144 (
"Year" text,
"Start" text,
"Qual" text,
"Rank" text,
"Finish" text,
"Laps" real
) | What is the finish when there was more than 192 laps and a qual of 135.736? | SELECT "Finish" FROM table_68144 WHERE "Laps" > '192' AND "Qual" = '135.736' |
CREATE TABLE table_name_89 (
opponent VARCHAR,
attendance INTEGER
) | Who is the opponent of the match with an attendance larger than 59,000? | SELECT opponent FROM table_name_89 WHERE attendance > 59 OFFSET 000 |
CREATE TABLE table_name_83 (
score VARCHAR,
opponent_in_the_final VARCHAR
) | What was the score for the opponent against Katerina Maleeva in the final? | SELECT score FROM table_name_83 WHERE opponent_in_the_final = "katerina maleeva" |
CREATE TABLE table_name_73 (
player VARCHAR,
school_club_team VARCHAR
) | Who is the player for the School/Club team in Georgia? | SELECT player FROM table_name_73 WHERE school_club_team = "georgia" |
CREATE TABLE ReviewTaskTypes (
Id number,
Name text,
Description text
)
CREATE TABLE Votes (
Id number,
PostId number,
VoteTypeId number,
UserId number,
CreationDate time,
BountyAmount number
)
CREATE TABLE PostTags (
PostId number,
TagId number
)
CREATE TABLE ReviewTaskSt... | Who from your location is better than you?. | SELECT U2.* FROM Users AS U1 JOIN Users AS U2 ON U1.Location = U2.Location WHERE 1 = 1 AND U1.DisplayName = 'jyparask' AND U1.Reputation <= U2.Reputation ORDER BY U2.Reputation DESC, U2.DisplayName |
CREATE TABLE table_39339 (
"Rank" real,
"Country/Territory" text,
"Miss World" real,
"1st Runner-up" real,
"2nd Runner-up" real,
"3rd Runner-up" real,
"4th Runner-up" real,
"5th Runner-up" real,
"6th Runner-up" real,
"Semifinalists" real,
"Total" real
) | 2nd Runner-up larger than 4, and a Country/Territory of israel, and a 4th Runner-up smaller than 0 has which sum of 6th Runner-up? | SELECT SUM("6th Runner-up") FROM table_39339 WHERE "2nd Runner-up" > '4' AND "Country/Territory" = 'israel' AND "4th Runner-up" < '0' |
CREATE TABLE table_203_815 (
id number,
"pick #" number,
"nfl team" text,
"player" text,
"position" text,
"college" text
) | how many guards were picked ? | SELECT COUNT(*) FROM table_203_815 WHERE "position" = 'guard' |
CREATE TABLE table_name_84 (
home_team VARCHAR,
away_team VARCHAR
) | When the Away team was hawthorn, what's the Home team? | SELECT home_team FROM table_name_84 WHERE away_team = "hawthorn" |
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 lab (
subject_id text,
hadm_id text,
... | How many patients with icd9 code 5732 received IM therapy? | 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 = "5732" AND prescriptions.route = "IM" |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title 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... | how many hours has it been since the first time that patient 6170 on the current icu visit received a .9% normal saline intake? | SELECT 24 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6170) AND icustays.outtime IS NULL) ... |
CREATE TABLE table_67076 (
"Competition" text,
"1993\u2013 94" text,
"1994\u2013 95" text,
"1995\u2013 96" text,
"1996\u2013 97" text,
"1997\u2013 98" text,
"1998\u2013 99" text,
"1999\u2013 2000" text,
"2000\u2013 01" text,
"2001\u2013 02" text,
"2002\u2013 03" text,
"20... | Name the 1999-2000 for 1993-94 of did not participate | SELECT "1999\u2013 2000" FROM table_67076 WHERE "1993\u2013 94" = 'did not participate' |
CREATE TABLE COURSE (
CRS_CODE varchar(10),
DEPT_CODE varchar(10),
CRS_DESCRIPTION varchar(35),
CRS_CREDIT float(8)
)
CREATE TABLE DEPARTMENT (
DEPT_CODE varchar(10),
DEPT_NAME varchar(30),
SCHOOL_CODE varchar(8),
EMP_NUM int,
DEPT_ADDRESS varchar(20),
DEPT_EXTENSION varchar(4)
... | Find the number of students in each department that has the top 3 highest number of students. Show the department address and number of students with a pie chart. | SELECT DEPT_ADDRESS, COUNT(*) FROM STUDENT AS T1 JOIN DEPARTMENT AS T2 ON T1.DEPT_CODE = T2.DEPT_CODE GROUP BY T1.DEPT_CODE ORDER BY COUNT(*) DESC LIMIT 3 |
CREATE TABLE producer (
pid int,
gender text,
name text,
nationality text,
birth_city text,
birth_year int
)
CREATE TABLE copyright (
id int,
msid int,
cid int
)
CREATE TABLE writer (
wid int,
gender text,
name text,
nationality text,
birth_city text,
birth_... | Find all actors born in Milan | SELECT name FROM actor WHERE birth_city = 'Milan' |
CREATE TABLE table_203_322 (
id number,
"club" text,
"played" number,
"won" number,
"drawn" number,
"lost" number,
"points for" number,
"points against" number,
"bonus points" number,
"points" number
) | which clubs did not score more than 50 points ? | SELECT "club" FROM table_203_322 WHERE "points" <= 50 |
CREATE TABLE flight_fare (
flight_id int,
fare_id int
)
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 compartment_class ... | what is the cheapest flight on AA from CLEVELAND to MIAMI | 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, fare, flight, flight_fare WHERE ((CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'CLEVELAND' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CIT... |
CREATE TABLE d_icd_diagnoses (
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 patients (
row_id number,
subject_id number,
g... | how many patients in 2105 have undergone packed cell transfusion in the same month following the first hemodialysis? | SELECT COUNT(DISTINCT t1.subject_id) 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 = 'hemodialysi... |
CREATE TABLE table_name_81 (
time_retired VARCHAR,
grid VARCHAR
) | What is the time/retired for the driver with 16 grids? | SELECT time_retired FROM table_name_81 WHERE grid = 16 |
CREATE TABLE table_name_74 (
episode_title VARCHAR,
presenter VARCHAR
) | What is the episode title of the episode with Ben Okri as the presenter? | SELECT episode_title FROM table_name_74 WHERE presenter = "ben okri" |
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... | what is the number of patients whose primary disease is coronary artery disease and admission year is less than 2195? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CORONARY ARTERY DISEASE" AND demographic.admityear < "2195" |
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE ReviewRejectionReasons (
Id number,
Name text,
Description text,
PostTypeId number
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE... | Top 10 tags and associated tags. | SELECT TagName FROM Tags GROUP BY TagName LIMIT 10 |
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
)
CREATE TABLE university (
Scho... | What is the relationship between ACC_Percent and All_Games_Percent , and group by attribute Team_Name? | SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY Team_Name |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | when was the last time that patient 028-55503 on last month/06 had the minimum sao2 value. | 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 = '028-55503')) AND NOT vitalperiodic.sao2 IS NULL AND... |
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 whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, a bar chart shows the distribution of job_id and the sum of salary , and group by attribute job_id, and order by the JOB_ID from low to high. | SELECT JOB_ID, SUM(SALARY) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID |
CREATE TABLE table_12330 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What place is Fred Funk in? | SELECT "Place" FROM table_12330 WHERE "Player" = 'fred funk' |
CREATE TABLE table_27434_2 (
period VARCHAR,
life_expectancy_total VARCHAR
) | What period was the life expectancy at 62.4? | SELECT period FROM table_27434_2 WHERE life_expectancy_total = "62.4" |
CREATE TABLE table_name_11 (
occupation VARCHAR,
riding VARCHAR
) | What is the occupation of the candidate that has a riding of labrador? | SELECT occupation FROM table_name_11 WHERE riding = "labrador" |
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 job_history (
EMPLOYEE_ID decimal(6,0),
START_DATE date,
END... | For those employees who do not work in departments with managers that have ids between 100 and 200, show me about the distribution of job_id and salary in a bar chart, and could you order Y-axis in ascending order? | SELECT JOB_ID, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY SALARY |
CREATE TABLE employee (
eid number(9,0),
name varchar2(30),
salary number(10,2)
)
CREATE TABLE flight (
flno number(4,0),
origin varchar2(20),
destination varchar2(20),
distance number(6,0),
departure_date date,
arrival_date date,
price number(7,2),
aid number(9,0)
)
CREATE... | How many flights in each destination city? Return a bar chart, and I want to rank y-axis in asc order please. | SELECT destination, COUNT(destination) FROM flight GROUP BY destination ORDER BY COUNT(destination) |
CREATE TABLE table_2152 (
"Country" text,
"1948/49 ($ millions)" real,
"1949/50 ($ millions)" real,
"1950/51 ($ millions)" real,
"Cumulative ($ millions)" real
) | How much was spent in 1949/50 (in $ millions) in the country where the cumulative expenditure is $376 millions? | SELECT MIN("1949/50 ($ millions)") FROM table_2152 WHERE "Cumulative ($ millions)" = '376' |
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,
... | what is patient 005-48105's first output amt-chest tube a output time a day before? | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-48105')) AND intakeoutput.cellpath LIKE '%output%... |
CREATE TABLE table_12755786_8 (
league VARCHAR,
player VARCHAR
) | what is the tourney where the winner is kevin mckinlay? | SELECT league AS Cup FROM table_12755786_8 WHERE player = "Kevin McKinlay" |
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 microlab (
microl... | when did patient 022-158475 receive the last prescription in their last hospital visit for morphine sulfate 2 mg/ml ij soln? | SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '022-158475' AND NOT patient.hospitaldischargetime IS NULL ORDE... |
CREATE TABLE table_name_99 (
result VARCHAR,
year VARCHAR,
category VARCHAR
) | What was album of the year after 2009? | SELECT result FROM table_name_99 WHERE year > 2009 AND category = "album of the year" |
CREATE TABLE table_27495117_3 (
team VARCHAR,
date_of_appointment VARCHAR
) | how many teams had an appointment date of 11 april 2011 | SELECT COUNT(team) FROM table_27495117_3 WHERE date_of_appointment = "11 April 2011" |
CREATE TABLE table_42848 (
"Year" real,
"Chassis" text,
"Engine" text,
"Start" real,
"Finish" real,
"Entrant" text
) | What is the lowest year that has lola t93/00 as the chassis with a start leas than 14? | SELECT MIN("Year") FROM table_42848 WHERE "Chassis" = 'lola t93/00' AND "Start" < '14' |
CREATE TABLE table_52026 (
"Player" text,
"Nationality" text,
"Position" text,
"Years for Jazz" text,
"School/Club Team" text
) | What is the Years for Jazz Club at Oregon State? | SELECT "Years for Jazz" FROM table_52026 WHERE "School/Club Team" = 'oregon state' |
CREATE TABLE table_14081 (
"Year" real,
"Category" text,
"Nominee(s)" text,
"Episode" text,
"Result" text
) | Which episode in year 2003 that have Gary Murphy and Neil Thompson? | SELECT "Episode" FROM table_14081 WHERE "Nominee(s)" = 'gary murphy and neil thompson' AND "Year" = '2003' |
CREATE TABLE table_21790203_1 (
result VARCHAR,
film_title_used_in_nomination VARCHAR
) | Name the result for already famous | SELECT result FROM table_21790203_1 WHERE film_title_used_in_nomination = "Already Famous" |
CREATE TABLE table_20170644_5 (
player VARCHAR,
college VARCHAR
) | What player went to montreal college? | SELECT player FROM table_20170644_5 WHERE college = "Montreal" |
CREATE TABLE table_name_10 (
location_attendance VARCHAR,
high_assists VARCHAR,
date VARCHAR
) | Can you tell me the Location Attendance that has the High assists of luke ridnour (10), and the Date of december 3? | SELECT location_attendance FROM table_name_10 WHERE high_assists = "luke ridnour (10)" AND date = "december 3" |
CREATE TABLE table_name_67 (
republican_ticket VARCHAR,
democratic_ticket VARCHAR
) | Who's the Republican ticket with a Democratic ticket of m. william bray? | SELECT republican_ticket FROM table_name_67 WHERE democratic_ticket = "m. william bray" |
CREATE TABLE table_60666 (
"State" text,
"GR\u00dcNE" text,
"FRITZ" text,
"RETT\u00d6" text,
"LINKE" text,
"STARK" text
) | What percent did GR NE get in Tyrol where RETT got 0.6%? | SELECT "GR\u00dcNE" FROM table_60666 WHERE "RETT\u00d6" = '0.6%' AND "State" = 'tyrol' |
CREATE TABLE Restaurant (
ResID INTEGER,
ResName VARCHAR(100),
Address VARCHAR(100),
Rating INTEGER
)
CREATE TABLE Student (
StuID INTEGER,
LName VARCHAR(12),
Fname VARCHAR(12),
Age INTEGER,
Sex VARCHAR(1),
Major INTEGER,
Advisor INTEGER,
city_code VARCHAR(3)
)
CREATE T... | List how many students in each last name who majored in 600 using a bar chart, and I want to rank by the Y in desc. | SELECT LName, COUNT(LName) FROM Student WHERE Major = 600 GROUP BY LName ORDER BY COUNT(LName) DESC |
CREATE TABLE table_35150 (
"Tournament" text,
"1998" text,
"2000" text,
"2001" text,
"2002" text,
"2003" text,
"2004" text,
"2005" text,
"2006" text,
"2007" text,
"2008" text,
"2009" text,
"2010" text,
"2011" text,
"2012" text,
"Career SR" text,
"Caree... | Which 2003 has a 2012 of 1r, and a 2008 of 1r? | SELECT "2003" FROM table_35150 WHERE "2012" = '1r' AND "2008" = '1r' |
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... | until 2 years ago what are the top four most frequent diagnoses that patients were given during the same hospital encounter after being diagnosed with hyperglycemia? | SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'hyper... |
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 allergy (
allergy... | when did patient 030-34260 the last time had voided amount output yesterday? | SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '030-34260')) AND intakeoutput.cellpath LIKE '%output%... |
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 n... | has hypocalcemia been diagnosed with patient 015-57922? | SELECT COUNT(*) > 0 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '015-57922')) AND diagnosis.diagnosisname = 'hypocalcemia' |
CREATE TABLE table_51133 (
"Place" text,
"Player" text,
"Country" text,
"Score" text,
"To par" text
) | What is Country, when Player is 'Rives McBee'? | SELECT "Country" FROM table_51133 WHERE "Player" = 'rives mcbee' |
CREATE TABLE table_name_31 (
winner VARCHAR,
location VARCHAR,
year VARCHAR
) | Who was the winner in philadelphia municipal stadium in 1939? | SELECT winner FROM table_name_31 WHERE location = "philadelphia municipal stadium" AND year = 1939 |
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_p... | Are there upper level classes that have projects but no exams ? | SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE course.has_exams = 'N' AND course.has_projects = 'Y' AND program_course.category LIKE 'ULCS' |
CREATE TABLE table_name_60 (
date VARCHAR,
opponent VARCHAR
) | What was the date of the game against Hayes & Yeading United? | SELECT date FROM table_name_60 WHERE opponent = "hayes & yeading united" |
CREATE TABLE table_35286 (
"Date" text,
"Opponents" text,
"Venue" text,
"Result" text,
"Score F\u2013A" text
) | Opponents of sheffield wednesday had what date? | SELECT "Date" FROM table_35286 WHERE "Opponents" = 'sheffield wednesday' |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE cost (
costid number,
uniquepid text,
patienthealthsystemstayid number,
eventtype text,
eventid number,
chargetime time,
cost number
)
CREATE TABLE p... | what are the four most common microbiology tests that patients had in the same month after receiving antiarrhythmics - atropine during the last year? | SELECT t3.culturesite FROM (SELECT t2.culturesite, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'antiarrhythmics - atropine' AND DATETIME(tre... |
CREATE TABLE table_48063 (
"Game" real,
"Date" text,
"Opponent" text,
"Result" text,
"Nets points" real,
"Opponent score" real,
"Record" text,
"Streak" text
) | When the opponent scored 96 points after game 61, what was the streak? | SELECT "Streak" FROM table_48063 WHERE "Game" > '61' AND "Opponent score" = '96' |
CREATE TABLE city (
city_code varchar,
city_name varchar,
state_code varchar,
country_name varchar,
time_zone_code varchar
)
CREATE TABLE airport_service (
city_code varchar,
airport_code varchar,
miles_distant int,
direction varchar,
minutes_distant int
)
CREATE TABLE code_des... | show flights between BOSTON and DENVER | 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_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER'... |
CREATE TABLE table_15288 (
"First game" real,
"Played" real,
"Drawn" real,
"Lost" real,
"Percentage" text
) | When was the earliest first game with 11 played and 12 games lost? | SELECT MIN("First game") FROM table_15288 WHERE "Played" > '11' AND "Lost" = '12' |
CREATE TABLE table_4989 (
"Result" text,
"Date" text,
"Race" text,
"Venue" text,
"Group" text,
"Distance" text,
"Weight (kg)" real,
"Jockey" text,
"Winner/2nd" text
) | with race of ranvet stakes what is the group? | SELECT "Group" FROM table_4989 WHERE "Race" = 'ranvet stakes' |
CREATE TABLE table_name_5 (
no_in_series INTEGER,
written_by VARCHAR,
no_in_season VARCHAR
) | What is the sum of the numbers in series written by sam meikle, which have 21 numbers in the season? | SELECT SUM(no_in_series) FROM table_name_5 WHERE written_by = "sam meikle" AND no_in_season = 21 |
CREATE TABLE table_75545 (
"Longi- tude" text,
"Usual translation" text,
"Chinese name \u00b9" text,
"Japanese name" text,
"Korean name \u00b2" text,
"Vietnamese name" text,
"Date \u00b3" text
) | Which Japanese name has a Korean name of ( ) gyeongchip? | SELECT "Japanese name" FROM table_75545 WHERE "Korean name \u00b2" = '경칩 (驚蟄) gyeongchip' |
CREATE TABLE table_name_5 (
venue VARCHAR,
away_team VARCHAR
) | What is the name of the venue where the game played had an away team of Melbourne? | SELECT venue FROM table_name_5 WHERE away_team = "melbourne" |
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 of the patients aged below 58 had a lab test for d-dimer? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "58" AND lab.label = "D-Dimer" |
CREATE TABLE table_76301 (
"noun root (meaning)" text,
"case suffix (case)" text,
"postposition" text,
"full word" text,
"English meaning" text
) | What is Case Suffix (Case), when English Meaning is 'to Georgia, in Georgia'? | SELECT "case suffix (case)" FROM table_76301 WHERE "English meaning" = 'to georgia, in georgia' |
CREATE TABLE party (
Party_ID int,
Minister text,
Took_office text,
Left_office text,
Region_ID int,
Party_name text
)
CREATE TABLE party_events (
Event_ID int,
Event_Name text,
Party_ID int,
Member_in_charge_ID int
)
CREATE TABLE region (
Region_ID int,
Region_name tex... | Show party names and the number of events for each party, and rank Party_name in asc order. | SELECT Party_name, COUNT(*) FROM party_events AS T1 JOIN party AS T2 ON T1.Party_ID = T2.Party_ID GROUP BY T1.Party_ID ORDER BY Party_name |
CREATE TABLE table_21937 (
"Round" text,
"Main date" text,
"Number of fixtures" real,
"Clubs" text,
"New entries this round" text,
"Prize money" text,
"Player of the Round" text
) | Who is the player of the round with 80 fixtures? | SELECT "Player of the Round" FROM table_21937 WHERE "Number of fixtures" = '80' |
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,
... | what is diagnoses short title and procedure short title of subject id 25167? | SELECT diagnoses.short_title, procedures.short_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "25167" |
CREATE TABLE table_name_87 (
competition VARCHAR,
club VARCHAR
) | What competition did the maccabi haifa fc club play? | SELECT competition FROM table_name_87 WHERE club = "maccabi haifa fc" |
CREATE TABLE Users (
Id number,
Reputation number,
CreationDate time,
DisplayName text,
LastAccessDate time,
WebsiteUrl text,
Location text,
AboutMe text,
Views number,
UpVotes number,
DownVotes number,
ProfileImageUrl text,
EmailHash text,
AccountId number
)
CRE... | My score on the algorithm tag. | SELECT SUM(A.Score) FROM Posts AS A JOIN Posts AS Q ON A.ParentId = Q.Id JOIN PostTags ON PostTags.PostId = Q.Id JOIN Tags ON PostTags.TagId = Tags.Id WHERE A.OwnerUserId = '##UserId##' AND A.PostTypeId = 2 AND Q.PostTypeId = 1 AND TagName = 'algorithm' |
CREATE TABLE geographic (
city_name varchar,
county varchar,
region varchar
)
CREATE TABLE restaurant (
id int,
name varchar,
food_type varchar,
city_name varchar,
rating "decimal
)
CREATE TABLE location (
restaurant_id int,
house_number int,
street_name varchar,
city_n... | give me some restaurants in the bay area ? | SELECT location.house_number, restaurant.name FROM location, restaurant WHERE restaurant.city_name IN (SELECT GEOGRAPHICalias0.city_name FROM geographic AS GEOGRAPHICalias0 WHERE GEOGRAPHICalias0.region = 'bay area') AND restaurant.id = location.restaurant_id |
CREATE TABLE table_57524 (
"Class" text,
"Type" text,
"Introduced" text,
"Fleet Size" real,
"Numbers" text
) | What is the fleet size of the Vanguard 0-6-0dh class? | SELECT "Fleet Size" FROM table_57524 WHERE "Class" = 'vanguard 0-6-0dh' |
CREATE TABLE Participants_in_Events (
Event_ID INTEGER,
Participant_ID INTEGER
)
CREATE TABLE Services (
Service_ID INTEGER,
Service_Type_Code CHAR(15)
)
CREATE TABLE Participants (
Participant_ID INTEGER,
Participant_Type_Code CHAR(15),
Participant_Details VARCHAR(255)
)
CREATE TABLE Eve... | List all the participant ids and their details using a bar chart, and I want to order in asc by the bar. | SELECT Participant_Details, Participant_ID FROM Participants ORDER BY Participant_Details |
CREATE TABLE CloseAsOffTopicReasonTypes (
Id number,
IsUniversal boolean,
InputTitle text,
MarkdownInputGuidance text,
MarkdownPostOwnerGuidance text,
MarkdownPrivilegedUserGuidance text,
MarkdownConcensusDescription text,
CreationDate time,
CreationModeratorId number,
ApprovalDa... | PostTypeId of C++ Tag Wiki and Excerpt. | SELECT 'Tag Wiki', PostTypeId FROM Posts WHERE Id = 3606997 UNION ALL SELECT 'Excerpt', PostTypeId FROM Posts WHERE Id = 3624963 |
CREATE TABLE table_13314 (
"Tie no" text,
"Home team" text,
"Score" text,
"Away team" text,
"Date" text
) | What date has wrexham as the home team? | SELECT "Date" FROM table_13314 WHERE "Home team" = 'wrexham' |
CREATE TABLE table_name_17 (
score VARCHAR,
loss VARCHAR
) | Loss of lyon (5-4) had what score? | SELECT score FROM table_name_17 WHERE loss = "lyon (5-4)" |
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 (
diagn... | among patients who were prescribed metoprolol tartrate 25 mg tablet after having been diagnosed with pancreatitis - with pseudocyst formation calculate the three year survival rate. | SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid... |
CREATE TABLE table_name_50 (
tournament VARCHAR,
runner_s__up VARCHAR
) | What tournament was Laura Davies the runner-up? | SELECT tournament FROM table_name_50 WHERE runner_s__up = "laura davies" |
CREATE TABLE table_name_36 (
rank INTEGER,
profits__billion_$_ VARCHAR,
industry VARCHAR,
company VARCHAR
) | What is the smallest rank for an industry of banking, a company of bank of america, and profits (billion $) larger than 16.47? | SELECT MIN(rank) FROM table_name_36 WHERE industry = "banking" AND company = "bank of america" AND profits__billion_$_ > 16.47 |
CREATE TABLE allergy (
allergyid number,
patientunitstayid number,
drugname text,
allergyname text,
allergytime time
)
CREATE TABLE vitalperiodic (
vitalperiodicid number,
patientunitstayid number,
temperature number,
sao2 number,
heartrate number,
respiration number,
sy... | count the number of medicines that have been prescribed to patient 033-7332 since 32 months ago. | SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-7332')) AND DATETIME(medication.drugstarttime) >= DATETIME(CURRENT_TIME(),... |
CREATE TABLE table_2741 (
"Rank" real,
"Census-designated place" text,
"Metropolitan area" text,
"State" text,
"Population (2000 census)" real,
"Land area (mi 2 )" text,
"Population density (people per mi 2 )" text
) | what is the total number of census designated places with a population of 10581? | SELECT COUNT("Census-designated place") FROM table_2741 WHERE "Population (2000 census)" = '10581' |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title 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... | how many patients died after being diagnosed this year with chr osteomyelit-l/leg within 2 months? | 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 driver (
Driver_ID int,
Name text,
Party text,
Home_city text,
Age int
)
CREATE TABLE school (
School_ID int,
Grade text,
School text,
Location text,
Type text
)
CREATE TABLE school_bus (
School_ID int,
Driver_ID int,
Years_Working int,
If_full_time... | Please give me a pie chart to show the number of home cities of all drivers, show by the x axis from low to high. | SELECT Home_city, COUNT(Home_city) FROM driver GROUP BY Home_city ORDER BY Home_city |
CREATE TABLE Person (
name varchar(20),
age INTEGER,
city TEXT,
gender TEXT,
job TEXT
)
CREATE TABLE PersonFriend (
name varchar(20),
friend varchar(20),
year INTEGER
) | Draw a bar chart for what is minimum age for different job title?, and I want to rank in desc by the y axis. | SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY MIN(age) DESC |
CREATE TABLE gas_station (
Station_ID int,
Open_Year int,
Location text,
Manager_Name text,
Vice_Manager_Name text,
Representative_Name text
)
CREATE TABLE station_company (
Station_ID int,
Company_ID int,
Rank_of_the_Year int
)
CREATE TABLE company (
Company_ID int,
Rank i... | Bar chart of the total number from each headquarters, order in asc by the Headquarters. | SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters ORDER BY Headquarters |
CREATE TABLE table_11542 (
"Year" real,
"Date" text,
"Location" text,
"Score" text,
"Result" text
) | What day was the score 3-0 after 2011? | SELECT "Date" FROM table_11542 WHERE "Score" = '3-0' AND "Year" = '2011' |
CREATE TABLE table_44748 (
"Date" text,
"Series" text,
"Circuit" text,
"City / State" text,
"Winner" text,
"Team" text
) | What is Date, when Team is Holden Racing Team, and when Circuit is Eastern Creek Raceway? | SELECT "Date" FROM table_44748 WHERE "Team" = 'holden racing team' AND "Circuit" = 'eastern creek raceway' |
CREATE TABLE table_73945 (
"Rank" real,
"Couple" text,
"Judges" real,
"Public" real,
"Total" real,
"Vote percentage" text,
"Result" text
) | What was the result for the total of 12? | SELECT "Result" FROM table_73945 WHERE "Total" = '12' |
CREATE TABLE table_name_35 (
circuit VARCHAR,
winning_driver VARCHAR,
race_name VARCHAR
) | What circuit did Innes Ireland win at for the I lombank trophy? | SELECT circuit FROM table_name_35 WHERE winning_driver = "innes ireland" AND race_name = "i lombank trophy" |
CREATE TABLE table_18207285_2 (
result VARCHAR,
attendance VARCHAR
) | What was the result of the game seen by 31095 people? | SELECT result FROM table_18207285_2 WHERE attendance = 31095 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.