table stringlengths 33 7.14k | question stringlengths 4 1.06k | output stringlengths 2 4.44k ⌀ |
|---|---|---|
CREATE TABLE payment (
staff_id VARCHAR
)
CREATE TABLE staff (
first_name VARCHAR,
last_name VARCHAR,
staff_id VARCHAR
) | Which staff handled least number of payments? List the full name and the id. | SELECT T1.first_name, T1.last_name, T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY COUNT(*) LIMIT 1 |
CREATE TABLE table_name_53 (
award_show VARCHAR,
category VARCHAR,
year VARCHAR
) | In what award show was Bad Girls nominated for Best Loved Drama in 2002? | SELECT award_show FROM table_name_53 WHERE category = "best loved drama" AND year = 2002 |
CREATE TABLE table_name_76 (
party VARCHAR,
results VARCHAR,
district VARCHAR
) | What is Party, when Results is 'Re-Elected', and when District is 'Louisiana 5'? | SELECT party FROM table_name_76 WHERE results = "re-elected" AND district = "louisiana 5" |
CREATE TABLE table_name_84 (
company VARCHAR,
number VARCHAR,
price VARCHAR
) | What company is numbered larger than 5 and priced at $389M? | SELECT company FROM table_name_84 WHERE number > 5 AND price = "$389m" |
CREATE TABLE table_40300 (
"Week" real,
"Date" text,
"Opponent" text,
"Result" text,
"Attendance" real
) | Mean attendance for December 22, 1980? | SELECT AVG("Attendance") FROM table_40300 WHERE "Date" = 'december 22, 1980' |
CREATE TABLE table_2628 (
"District" text,
"Vacator" text,
"Reason for change" text,
"Successor" text,
"Date successor seated" text
) | Name the reason for change for jonathan jennings | SELECT COUNT("Reason for change") FROM table_2628 WHERE "Successor" = 'Jonathan Jennings' |
CREATE TABLE table_25382 (
"No." real,
"Player" text,
"Position" text,
"Height" text,
"Weight" real,
"Class" text,
"Hometown" text
) | Who are the player's who weighed 170? | SELECT "Player" FROM table_25382 WHERE "Weight" = '170' |
CREATE TABLE loan (
loan_id text,
loan_type text,
cust_id text,
branch_id text,
amount number
)
CREATE TABLE customer (
cust_id text,
cust_name text,
acc_type text,
acc_bal number,
no_of_loans number,
credit_score number,
branch_id number,
state text
)
CREATE TABLE ... | What is the average credit score for customers who have taken a loan? | SELECT AVG(credit_score) FROM customer WHERE cust_id IN (SELECT cust_id FROM loan) |
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... | Give me a pie to show team_id from different acc regular season. | SELECT ACC_Regular_Season, Team_ID FROM basketball_match |
CREATE TABLE table_name_28 (
capacity INTEGER,
club VARCHAR
) | What is the capacity of Band rma Banvit? | SELECT AVG(capacity) FROM table_name_28 WHERE club = "bandırma banvit" |
CREATE TABLE table_56338 (
"Player" text,
"No.(s)" text,
"Height in Ft." text,
"Position" text,
"School/Club Team/Country" text
) | Name the school/club team/country for the player that is 6-5 ft | SELECT "School/Club Team/Country" FROM table_56338 WHERE "Height in Ft." = '6-5' |
CREATE TABLE comment_instructor (
instructor_id int,
student_id int,
score int,
comment_text varchar
)
CREATE TABLE course_prerequisite (
pre_course_id int,
course_id int
)
CREATE TABLE course_offering (
offering_id int,
course_id int,
semester int,
section_number int,
star... | Are there any courses that are worth 6 credits ? | SELECT DISTINCT name, number FROM course WHERE credits = 6 AND department = 'EECS' |
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE prescriptions (
row_id number,
subject_id number,
hadm_id number,
startdate time,
enddate time,
drug text,
... | what was the first time that patient 28443 had the maximum value of the arterial bp mean on this month/18? | 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 = 28443)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial... |
CREATE TABLE table_14670060_1 (
languages VARCHAR,
call_sign VARCHAR
) | What languages are spoken when call sign XEJAM is used? | SELECT languages FROM table_14670060_1 WHERE call_sign = "XEJAM" |
CREATE TABLE table_204_88 (
id number,
"year" number,
"english title" text,
"japanese" text,
"romanization" text,
"type" text
) | how many years is the chart for ? | SELECT MAX("year") - MIN("year") + 1 FROM table_204_88 |
CREATE TABLE table_10111 (
"Place" real,
"TV network" text,
"% of US households reached" text,
"Number of households viewable" real,
"Type of Television Network" text
) | Which TV network is a spanish commercial network with greater than 53,674,000 households viewable and place lower than 1? | SELECT "TV network" FROM table_10111 WHERE "Type of Television Network" = 'spanish commercial' AND "Number of households viewable" > '53,674,000' AND "Place" > '1' |
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,
predicted_graduation_semester int,
degree varchar,
minor varchar,
internship varch... | What is the number of courses which are being taught by more than 2 professors ? | SELECT COUNT(DISTINCT course_offering.course_id) FROM course, course_offering, offering_instructor AS OFFERING_INSTRUCTOR_0, offering_instructor AS OFFERING_INSTRUCTOR_1, offering_instructor AS OFFERING_INSTRUCTOR_2 WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND OFFERING_INSTRUCTO... |
CREATE TABLE table_60196 (
"Position" real,
"Team" text,
"Played" real,
"Drawn" real,
"Lost" real,
"Goals For" real,
"Goals Against" real,
"Goal Difference" text,
"Points 1" text
) | How many Goals Against have a Position of 4? | SELECT COUNT("Goals Against") FROM table_60196 WHERE "Position" = '4' |
CREATE TABLE medicine (
id int,
name text,
Trade_Name text,
FDA_approved text
)
CREATE TABLE enzyme (
id int,
name text,
Location text,
Product text,
Chromosome text,
OMIM int,
Porphyria text
)
CREATE TABLE medicine_enzyme_interaction (
enzyme_id int,
medicine_id in... | what is the id and trade name of the medicines can interact with at least 3 enzymes?, I want to list in descending by the y axis. | SELECT Trade_Name, id FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id ORDER BY id DESC |
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
OwnerUserId number,
OwnerDisplayName text,
LastEditorUserId number,
LastEditorDispl... | Users by total number of favorites on their posts. | SELECT RANK() OVER (ORDER BY SUM(Posts.FavoriteCount) DESC) AS "no.", Posts.OwnerUserId AS "user_link", Users.Reputation, SUM(Posts.FavoriteCount) AS "TotalFavorites", COUNT(*) AS "Posts with favorites" FROM Posts JOIN Users ON Users.Id = Posts.OwnerUserId WHERE NOT Posts.OwnerUserId IS NULL AND Posts.FavoriteCount > 0... |
CREATE TABLE field (
fieldid int
)
CREATE TABLE author (
authorid int,
authorname varchar
)
CREATE TABLE keyphrase (
keyphraseid int,
keyphrasename varchar
)
CREATE TABLE journal (
journalid int,
journalname varchar
)
CREATE TABLE dataset (
datasetid int,
datasetname varchar
)
C... | Which paper should I read about Dependent type ? | SELECT DISTINCT paper.paperid FROM keyphrase, paper, paperkeyphrase WHERE keyphrase.keyphrasename = 'Dependent type' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid |
CREATE TABLE table_name_26 (
nickname VARCHAR,
no_of_premierships VARCHAR,
years_in_competition VARCHAR
) | What was the Nickname that had a No. 0, and Years in Competition of 1982-2003? | SELECT nickname FROM table_name_26 WHERE no_of_premierships = 0 AND years_in_competition = "1982-2003" |
CREATE TABLE table_name_42 (
designated_visitors VARCHAR,
designated_home VARCHAR
) | Who were the visitors when the Atlanta Falcons were the home team? | SELECT designated_visitors FROM table_name_42 WHERE designated_home = "atlanta falcons" |
CREATE TABLE table_name_36 (
round INTEGER,
overall VARCHAR,
pick__number VARCHAR,
position VARCHAR
) | Which cornerback round has a pick number lower than 26 and an overall higher than 41? | SELECT SUM(round) FROM table_name_36 WHERE pick__number < 26 AND position = "cornerback" AND overall > 41 |
CREATE TABLE table_52465 (
"Player" text,
"Height" text,
"School" text,
"Hometown" text,
"College" text
) | What school is the player who has a hometown of Chicago, IL from? | SELECT "School" FROM table_52465 WHERE "Hometown" = 'chicago, il' |
CREATE TABLE table_name_7 (
venue VARCHAR,
home_team VARCHAR
) | Where does Geelong play their home game? | SELECT venue FROM table_name_7 WHERE home_team = "geelong" |
CREATE TABLE d_items (
row_id number,
itemid number,
label text,
linksto text
)
CREATE TABLE outputevents (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
value number
)
CREATE TABLE icustays (
row_id number,
subj... | what were the three most frequently given diagnoses for patients who received ins nondrug elut cor st previously within 2 months until 2104? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, 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 = admissi... |
CREATE TABLE player (
Player_ID int,
Sponsor_name text,
Player_name text,
Gender text,
Residence text,
Occupation text,
Votes int,
Rank text
)
CREATE TABLE player_coach (
Player_ID int,
Coach_ID int,
Starting_year int
)
CREATE TABLE coach (
Coach_ID int,
Coach_name ... | Show different occupations along with the number of players in each occupation with a bar chart, could you order by the names from high to low? | SELECT Occupation, COUNT(*) FROM player GROUP BY Occupation ORDER BY Occupation 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... | what is the admission location and discharge time of subject id 52118? | SELECT demographic.admission_location, demographic.dischtime FROM demographic WHERE demographic.subject_id = "52118" |
CREATE TABLE table_70811 (
"Year" real,
"Points" text,
"Rebounds" text,
"Assists" text,
"Steals" text,
"Blocks" text
) | What is Assists that has a Blocks of 2 tied (1) with a Year larger than 1995 | SELECT "Assists" FROM table_70811 WHERE "Blocks" = '2 tied (1)' AND "Year" > '1995' |
CREATE TABLE table_name_84 (
total_games VARCHAR,
years VARCHAR,
pac_12 VARCHAR
) | How many total games associated with the Pac-12 of california and 117 years? | SELECT total_games FROM table_name_84 WHERE years = 117 AND pac_12 = "california" |
CREATE TABLE table_name_65 (
year VARCHAR,
finish VARCHAR
) | What year had the Finish of 12? | SELECT year FROM table_name_65 WHERE finish = "12" |
CREATE TABLE table_name_46 (
decile INTEGER,
roll VARCHAR,
area VARCHAR
) | What is the highest decile value with a roll greater than 301 in Hauraki? | SELECT MAX(decile) FROM table_name_46 WHERE roll > 301 AND area = "hauraki" |
CREATE TABLE table_30346 (
"Character" text,
"Game" text,
"Platform" text,
"Status" text,
"Mystic Arte" text,
"Character Voice" text
) | How many platforms have nanaly fletch as the character? | SELECT COUNT("Platform") FROM table_30346 WHERE "Character" = 'Nanaly Fletch' |
CREATE TABLE table_65635 (
"Year" real,
"Game" text,
"Genre" text,
"Platform(s)" text,
"Developer(s)" text
) | Who was the developer of Wii? | SELECT "Developer(s)" FROM table_65635 WHERE "Platform(s)" = 'wii' |
CREATE TABLE requirement (
requirement_id int,
requirement varchar,
college varchar
)
CREATE TABLE student (
student_id int,
lastname varchar,
firstname varchar,
program_id int,
declare_major varchar,
total_credit int,
total_gpa float,
entered_as varchar,
admit_term int,... | Each week 483 usually has 2 or 3 lectures ? | SELECT DISTINCT course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday, semester.semester, semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND c... |
CREATE TABLE ReviewTaskResultTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PostsWithDeleted (
Id number,
PostTypeId number,
AcceptedAnswerId number,
ParentId number,
CreationDate time,
DeletionDate time,
Score number,
ViewCount number,
Body text,
Owne... | How many users have answered more than N questions. | SELECT CommentCount, COUNT(*) FROM Posts WHERE PostTypeId = 1 AND CreationDate > DATEADD(DAY, -90, CURRENT_TIMESTAMP()) AND AnswerCount = 0 GROUP BY CommentCount |
CREATE TABLE table_203_707 (
id number,
"rank" number,
"npc" text,
"gold" number,
"silver" number,
"bronze" number,
"total" number
) | what country won the least amount of gold medals ? | SELECT "npc" FROM table_203_707 ORDER BY "gold" LIMIT 1 |
CREATE TABLE table_58278 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What is the crowd with a Home team score of 8.17 (65)? | SELECT AVG("Crowd") FROM table_58278 WHERE "Home team score" = '8.17 (65)' |
CREATE TABLE orders (
order_id VARCHAR,
date_order_placed VARCHAR
) | What is the id of the most recent order? | SELECT order_id FROM orders ORDER BY date_order_placed DESC LIMIT 1 |
CREATE TABLE table_262476_1 (
location VARCHAR,
institution VARCHAR
) | Name where bethany college is | SELECT location FROM table_262476_1 WHERE institution = "Bethany College" |
CREATE TABLE table_26998135_2 (
date_of_appointment VARCHAR,
date_of_vacancy VARCHAR
) | What is the date of appointment when the date of vacancy is 15 march 2011? | SELECT date_of_appointment FROM table_26998135_2 WHERE date_of_vacancy = "15 March 2011" |
CREATE TABLE PostTypes (
Id number,
Name text
)
CREATE TABLE PostFeedback (
Id number,
PostId number,
IsAnonymous boolean,
VoteTypeId number,
CreationDate time
)
CREATE TABLE PostHistoryTypes (
Id number,
Name text
)
CREATE TABLE PostNoticeTypes (
Id number,
ClassId number... | Percentage of Users with 10K or 20K rep out of 'real users' (>100 rep). | SELECT (((SELECT CAST(COUNT(*) AS FLOAT) FROM Users WHERE Reputation > 10000) / (SELECT CAST(COUNT(*) AS FLOAT) FROM Users WHERE LastAccessDate > GETUTCDATE() - 30 AND Reputation > 200 AND (UpVotes + DownVotes) > 0)) * 100) AS PercentageOver10k, (((SELECT CAST(COUNT(*) AS FLOAT) FROM Users WHERE Reputation > 20000) / (... |
CREATE TABLE table_name_94 (
rider VARCHAR,
team VARCHAR
) | Who is the rider with a 399cc Kawasaki? | SELECT rider FROM table_name_94 WHERE team = "399cc kawasaki" |
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 microbiologyevents (
row_id number,
subject_id number,
... | what are the top four common diagnosis of patients aged 50s in 2101? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN... |
CREATE TABLE table_name_23 (
position VARCHAR
) | What position did Garion Weller hold in 2012? | SELECT position FROM table_name_23 WHERE 2012 = "garion weller" |
CREATE TABLE organization (
continent varchar,
homepage varchar,
name varchar,
oid int
)
CREATE TABLE domain (
did int,
name varchar
)
CREATE TABLE keyword (
keyword varchar,
kid int
)
CREATE TABLE domain_publication (
did int,
pid int
)
CREATE TABLE domain_journal (
did ... | return me the number of researchers in ' University of Michigan ' . | SELECT COUNT(DISTINCT (author.name)) FROM author, organization WHERE organization.name = 'University of Michigan' AND organization.oid = author.oid |
CREATE TABLE table_26986076_5 (
fri_27_aug VARCHAR,
wed_25_aug VARCHAR
) | When 21' 05.83 107.304mph is Wednesday August 25th what is Friday August 27th? | SELECT fri_27_aug FROM table_26986076_5 WHERE wed_25_aug = "21' 05.83 107.304mph" |
CREATE TABLE table_14144 (
"Manufacturer" text,
"Transmission" text,
"Engine Capacity" real,
"Fuel Type" text,
"L/100km Urban (Cold)" real,
"L/100km Extra-Urban" real,
"L/100km Combined" real,
"mpg-UK Urban (Cold)" real,
"mpg-UK Extra-Urban" real,
"mpg-UK Combined" real,
"mpg... | What is the average L/100km urban value having an L/100km extraurban under 7.2, mpg combined in the UK under 39.8, l/100km combined over 7.9, and mpg combined in the US under 25.1? | SELECT AVG("L/100km Urban (Cold)") FROM table_14144 WHERE "L/100km Extra-Urban" < '7.2' AND "mpg-UK Combined" < '39.8' AND "L/100km Combined" > '7.9' AND "mpg-US Combined" < '25.1' |
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE diagnoses (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic (
subject_id text,
hadm_id t... | Look for the private health insurance patients who had an open liver biopsy procedure. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.insurance = "Private" AND procedures.long_title = "Open biopsy of liver" |
CREATE TABLE lab (
subject_id text,
hadm_id text,
itemid text,
charttime text,
flag text,
value_unit text,
label text,
fluid text
)
CREATE TABLE procedures (
subject_id text,
hadm_id text,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE demographic ... | provide the number of patients whose ethnicity is hispanic or latino and item id is 51044? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.ethnicity = "HISPANIC OR LATINO" AND lab.itemid = "51044" |
CREATE TABLE table_train_184 (
"id" int,
"gender" string,
"systolic_blood_pressure_sbp" int,
"heart_disease" bool,
"renal_disease" bool,
"hematocrit_hct" float,
"allergy_to_insulin_lispro" bool,
"diastolic_blood_pressure_dbp" int,
"serum_creatinine" float,
"hypertension" bool,
... | renal insufficiency: serum creatinine > 1.3 mg / dl ( male ) or > 1.2 mg / dl ( female ) | SELECT * FROM table_train_184 WHERE renal_disease = 1 OR ((gender = 'male' AND serum_creatinine > 1.3) OR (gender = 'female' AND serum_creatinine > 1.2)) |
CREATE TABLE table_47117 (
"Senator" text,
"Party" text,
"District" real,
"Home Town" text,
"Took Office" real
) | What is the sum of District, when Took Office is greater than 1981, and when Senator is Cyndi Taylor Krier? | SELECT SUM("District") FROM table_47117 WHERE "Took Office" > '1981' AND "Senator" = 'cyndi taylor krier' |
CREATE TABLE table_65847 (
"Draw" real,
"Artist" text,
"Song" text,
"Points" real,
"Place" real
) | What is the highest Place with more than 3 draws, for the Song 'dajana', with less than 31 points? | SELECT MAX("Place") FROM table_65847 WHERE "Draw" > '3' AND "Song" = 'dajana' AND "Points" < '31' |
CREATE TABLE CLASS (
CLASS_CODE varchar(5),
CRS_CODE varchar(10),
CLASS_SECTION varchar(2),
CLASS_TIME varchar(20),
CLASS_ROOM varchar(8),
PROF_NUM int
)
CREATE TABLE PROFESSOR (
EMP_NUM int,
DEPT_CODE varchar(10),
PROF_OFFICE varchar(50),
PROF_EXTENSION varchar(4),
PROF_HIG... | How many students are in each department Visualize by bar chart, and I want to order by the names in ascending. | SELECT DEPT_CODE, COUNT(*) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE |
CREATE TABLE table_name_55 (
location VARCHAR
) | Tell me the average 1st prize for tennessee | SELECT AVG(1 AS st_prize__) AS $__ FROM table_name_55 WHERE location = "tennessee" |
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 number of patients that were discharged from hospital until 2100? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) <= '2100' |
CREATE TABLE table_57838 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Venue" text,
"Crowd" real,
"Date" text
) | What was the home score when the away team scored 16.11 (107)? | SELECT "Home team" FROM table_57838 WHERE "Away team score" = '16.11 (107)' |
CREATE TABLE table_16579 (
"#" real,
"Episode" text,
"Rating" text,
"Share" real,
"Rating/Share (18-49)" text,
"Viewers (millions)" text,
"Rank (timeslot)" real,
"Rank (night)" real,
"Rank (week)" text
) | What is the lowest rank (night) for having viewers (millions) 5.25? | SELECT MIN("Rank (night)") FROM table_16579 WHERE "Viewers (millions)" = '5.25' |
CREATE TABLE table_name_30 (
year INTEGER,
reg_season VARCHAR,
division VARCHAR
) | Which Year is the highest one that has a Reg Season of 3rd, western, and a Division larger than 2? | SELECT MAX(year) FROM table_name_30 WHERE reg_season = "3rd, western" AND division > 2 |
CREATE TABLE date_day (
month_number int,
day_number int,
year int,
day_name varchar
)
CREATE TABLE time_interval (
period text,
begin_time int,
end_time int
)
CREATE TABLE flight_leg (
flight_id int,
leg_number int,
leg_flight int
)
CREATE TABLE days (
days_code varchar,
... | what are the flights between MEMPHIS and CINCINNATI on wednesday | 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, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CINCINNATI' AND date_day.day_number = 23 AND date_day.month_number = 4 AN... |
CREATE TABLE table_9931 (
"Round" real,
"Pick" real,
"Overall" real,
"Name" text,
"Position" text,
"College" text
) | What's the average round for the OT position from tulane college with an overall over 38? | SELECT AVG("Round") FROM table_9931 WHERE "Position" = 'ot' AND "College" = 'tulane' AND "Overall" > '38' |
CREATE TABLE d_icd_diagnoses (
row_id number,
icd9_code text,
short_title text,
long_title text
)
CREATE TABLE transfers (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
eventtype text,
careunit text,
wardid number,
intime time,
outtime time
)
... | what are the four most commonly prescribed drugs that were prescribed to male patients in their 50s in the same hospital encounter after they were diagnosed with tobacco use disorder in 2105? | SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id 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_... |
CREATE TABLE table_73921 (
"Outcome" text,
"No." text,
"Date" text,
"Championship" text,
"Surface" text,
"Opponent in the final" text,
"Score in the final" text
) | The score in the final is 2 6, 6 2, 6 0, on what surface? | SELECT "Surface" FROM table_73921 WHERE "Score in the final" = '2–6, 6–2, 6–0' |
CREATE TABLE table_46640 (
"Tournament" text,
"Surface" text,
"Week" text,
"Winners" text,
"Finalists" text,
"Semifinalists" text
) | What is Tournament, when Week is November 23? | SELECT "Tournament" FROM table_46640 WHERE "Week" = 'november 23' |
CREATE TABLE table_63502 (
"Iteration" text,
"Year" real,
"Dates" text,
"Location" text,
"Theme" text
) | What is the Location of the 'My Pacific' Theme? | SELECT "Location" FROM table_63502 WHERE "Theme" = 'my pacific' |
CREATE TABLE Sportsinfo (
StuID VARCHAR
)
CREATE TABLE Student (
StuID VARCHAR
) | Show student ids who don't have any sports. | SELECT StuID FROM Student EXCEPT SELECT StuID FROM Sportsinfo |
CREATE TABLE table_46089 (
"Year" real,
"Dates" text,
"Champion" text,
"Country" text,
"Winning score" text,
"To par" text,
"Margin of victory" text,
"Tournament location" text,
"Purse ( $ )" text,
"Winner's share ($)" text
) | What tournament location has south korea as the country? | SELECT "Tournament location" FROM table_46089 WHERE "Country" = 'south korea' |
CREATE TABLE table_15972 (
"Formula" text,
"Notation" text,
"T c (K)" real,
"No. of Cu-O planes in unit cell" real,
"Crystal structure" text
) | What is the crystal structure for the formula yba 2 cu 3 o 7? | SELECT "Crystal structure" FROM table_15972 WHERE "Formula" = 'YBa 2 Cu 3 O 7' |
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 flight_stop (
flight_id int,
stop_number int,
stop_days text,
stop_... | what is the smallest aircraft available flying from PITTSBURGH to BALTIMORE arriving on 5 7 | SELECT DISTINCT aircraft.aircraft_code FROM aircraft, airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, equipment_sequence, flight WHERE (((((flight.arrival_time < 41 OR flight.time_elapsed >= 60) AND flight.departure_time > flight.arrival_time) ... |
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... | Give the number of patients whose marital status is married and were admitted before the year 2194. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.marital_status = "MARRIED" AND demographic.admityear < "2194" |
CREATE TABLE table_40341 (
"Venue" text,
"Location" text,
"Capacity" text,
"Owner" text,
"Environment" text,
"Year Built" text
) | What year was transamerica field built in? | SELECT "Year Built" FROM table_40341 WHERE "Venue" = 'transamerica field' |
CREATE TABLE table_16381914_1 (
affiliation VARCHAR,
location VARCHAR
) | What affiliation is Erie, Pennsylvania? | SELECT affiliation FROM table_16381914_1 WHERE location = "Erie, Pennsylvania" |
CREATE TABLE table_204_498 (
id number,
"location" text,
"building" text,
"year" number,
"km" number,
"monument" number
) | which location has the most km ? | SELECT "location" FROM table_204_498 ORDER BY "km" DESC LIMIT 1 |
CREATE TABLE table_name_79 (
drawn INTEGER,
goals_for VARCHAR,
lost VARCHAR
) | For entries with lost larger than 21 and goals for smaller than 36, what is the average drawn? | SELECT AVG(drawn) FROM table_name_79 WHERE goals_for < 36 AND lost > 21 |
CREATE TABLE table_25981 (
"Season" real,
"Series" text,
"Team" text,
"Races" real,
"Wins" real,
"Poles" real,
"F/Laps" real,
"Podiums" real,
"Points" text,
"Position" text
) | How many seasons have motopark team? | SELECT COUNT("Season") FROM table_25981 WHERE "Team" = 'Motopark' |
CREATE TABLE table_name_16 (
dubose_porter VARCHAR,
roy_barnes VARCHAR
) | What is the DuBose Porter with Roy Barnes at 54%? | SELECT dubose_porter FROM table_name_16 WHERE roy_barnes = "54%" |
CREATE TABLE FlagTypes (
Id number,
Name text,
Description text
)
CREATE TABLE PendingFlags (
Id number,
FlagTypeId number,
PostId number,
CreationDate time,
CloseReasonTypeId number,
CloseAsOffTopicReasonTypeId number,
DuplicateOfQuestionId number,
BelongsOnBaseHostAddress ... | Percentage of closed question per tag (among the posts that were not deleted). | WITH closed_cte AS (SELECT t.TagName AS tag, COUNT(q.Id) AS totalcount, COUNT(q.ClosedDate) AS closedcount, ROUND(COUNT(q.ClosedDate) * 100.0 / COUNT(q.Id), 2) AS percentage FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON pt.TagId = t.Id WHERE q.PostTypeId = 1 GROUP BY t.TagName) S... |
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 time. | SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) |
CREATE TABLE table_462 (
"Name" text,
"Pennant" text,
"Builder" text,
"Laid Down" text,
"Launched" text,
"Commissioned" text,
"Fate" text
) | What is the pennant for 4 may 1943? | SELECT "Pennant" FROM table_462 WHERE "Laid Down" = '4 May 1943' |
CREATE TABLE table_1341522_36 (
status VARCHAR,
incumbent VARCHAR
) | How many districts are respresented by Alex McMillan? | SELECT COUNT(status) FROM table_1341522_36 WHERE incumbent = "Alex McMillan" |
CREATE TABLE table_38752 (
"Home team" text,
"Home team score" text,
"Away team" text,
"Away team score" text,
"Ground" text,
"Crowd" real,
"Date" text,
"Report" text
) | What was the home team score for essendon? | SELECT "Home team score" FROM table_38752 WHERE "Home team" = 'essendon' |
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,
... | what is date of death and admission time of subject id 15898? | SELECT demographic.dod, demographic.admittime FROM demographic WHERE demographic.subject_id = "15898" |
CREATE TABLE record (
ID int,
Result text,
Swimmer_ID int,
Event_ID int
)
CREATE TABLE swimmer (
ID int,
name text,
Nationality text,
meter_100 real,
meter_200 text,
meter_300 text,
meter_400 text,
meter_500 text,
meter_600 text,
meter_700 text,
Time text
)
... | A bar chart shows the distribution of meter_500 and ID , list by the X-axis in descending. | SELECT meter_500, ID FROM swimmer ORDER BY meter_500 DESC |
CREATE TABLE table_name_53 (
grid VARCHAR,
laps VARCHAR
) | What grid features 6 laps? | SELECT grid FROM table_name_53 WHERE laps = 6 |
CREATE TABLE table_29554 (
"Season" text,
"Points per Game" text,
"Total Yards per Game" text,
"Rushing Yards per Game" text,
"Passing Yards per Game" text,
"Sacks" text,
"Interceptions" text
) | What is every value for passing yards per game if rushing yards per game is 113.6? | SELECT "Passing Yards per Game" FROM table_29554 WHERE "Rushing Yards per Game" = '113.6' |
CREATE TABLE tweets (
id number,
uid number,
text text,
createdate time
)
CREATE TABLE user_profiles (
uid number,
name text,
email text,
partitionid number,
followers number
)
CREATE TABLE follows (
f1 number,
f2 number
) | Find the number of users who posted some tweets. | SELECT COUNT(DISTINCT uid) FROM tweets |
CREATE TABLE table_69979 (
"Name" text,
"Date of Execution" text,
"Crime" text,
"Method" text,
"Race" text
) | How was the native american executed in July 1836? | SELECT "Method" FROM table_69979 WHERE "Race" = 'native american' AND "Date of Execution" = 'july 1836' |
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 cost (
row_id number,
subject_id number,
hadm_id number,
event_type text,
event_id... | what were the five most common drugs prescribed to the female patients 20s within 2 months after being diagnosed with nephritis nos in oth dis since 5 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 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 those employees who did not have any job in the past, visualize a line chart about the change of salary over hire_date , order by the x-axis from high to low please. | SELECT HIRE_DATE, SALARY FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY HIRE_DATE DESC |
CREATE TABLE treatment (
treatmentid number,
patientunitstayid number,
treatmentname text,
treatmenttime time
)
CREATE TABLE diagnosis (
diagnosisid number,
patientunitstayid number,
diagnosisname text,
diagnosistime time,
icd9code text
)
CREATE TABLE lab (
labid number,
pa... | what is the number of patients that sodium chloride 0.9% is prescribed to? | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'sodium chloride 0.9%') |
CREATE TABLE table_name_86 (
interview INTEGER,
state VARCHAR,
average VARCHAR
) | What is the lowest interview of Texas, with an average larger than 9.531? | SELECT MIN(interview) FROM table_name_86 WHERE state = "texas" AND average > 9.531 |
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... | give me the number of patients born before 2126 who are still alive. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.expire_flag = "0" AND demographic.dob_year < "2126" |
CREATE TABLE table_name_56 (
median_household_income VARCHAR,
median_family_income VARCHAR
) | What is the Median household income associated with a median family income of $46,616? | SELECT median_household_income FROM table_name_56 WHERE median_family_income = "$46,616" |
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 (
... | how many patients are admitted before the year 2166 and followed the procedure exteriorization of small intestine? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admityear < "2166" AND procedures.long_title = "Exteriorization of small intestine" |
CREATE TABLE table_71533 (
"name" text,
"type" text,
"elevation" text,
"USGS Map" text,
"GNIS ID" real
) | Which name has a USGS Map of clear lake? | SELECT "name" FROM table_71533 WHERE "USGS Map" = 'clear lake' |
CREATE TABLE table_28753 (
"Episode number (Production number)" text,
"Title" text,
"Original air date" text,
"Total viewers on FX" text,
"Total viewers on FX+" text,
"Total viewers" text,
"Rank on channel" text
) | Name the total viewers on fx+ for 583,000 total viewers | SELECT "Total viewers on FX+" FROM table_28753 WHERE "Total viewers" = '583,000' |
CREATE TABLE Comments (
Id number,
PostId number,
Score number,
Text text,
CreationDate time,
UserDisplayName text,
UserId number,
ContentLicense text
)
CREATE TABLE ReviewTaskResults (
Id number,
ReviewTaskId number,
ReviewTaskResultTypeId number,
CreationDate time,
... | Question Count or Score growth over time by tag comparison. Plots total questions over time or total score over time, comparing up to 4 tags.
Reference: http://meta.stackoverflow.com/q/260570/331508 | SELECT DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS "month", COUNT(q.Id) AS NumQuests FROM Posts AS q INNER JOIN PostTags AS pt ON q.Id = pt.PostId INNER JOIN Tags AS t ON t.Id = pt.TagId WHERE q.PostTypeId = 1 AND q.CreationDate >= '2016-01-01 00:00:00' AND t.TagName IN (@Tag1) GROUP BY DATEADD(month, DATEDI... |
CREATE TABLE table_73716 (
"Year" text,
"Superintendent" text,
"Middlesex Principal" text,
"Gorham Principal" text,
"Middle School Principal" text,
"High School Principal" text
) | How many years was lynn muscarella the high school principal and charlie wiltse the superintendent? | SELECT COUNT("Year") FROM table_73716 WHERE "High School Principal" = 'Lynn Muscarella' AND "Superintendent" = 'Charlie Wiltse' |
CREATE TABLE inputevents_cv (
row_id number,
subject_id number,
hadm_id number,
icustay_id number,
charttime time,
itemid number,
amount number
)
CREATE TABLE admissions (
row_id number,
subject_id number,
hadm_id number,
admittime time,
dischtime time,
admission_typ... | calculate the difference between patient 8016's total output and the total input on last month/23. | SELECT (SELECT SUM(inputevents_cv.amount) 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 = 8016)) AND DATETIME(inputevents_cv.charttime, 'start of month') = DATETIME(CURRENT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.