answer
stringlengths
6
3.91k
question
stringlengths
7
766
context
stringlengths
27
7.14k
SELECT location FROM table_1997759_1 WHERE last_flew = "11 June 2000"
at what location is the last flew on 11 june 2000
CREATE TABLE table_1997759_1 ( location VARCHAR, last_flew VARCHAR )
SELECT MAX(birth_2013) FROM table_25703_1 WHERE death_2012 = "14,1"
What is the highest birth/2013 when the death/2012 is 14,1?
CREATE TABLE table_25703_1 (birth_2013 INTEGER, death_2012 VARCHAR)
SELECT SUM(total_assists) FROM table_name_11 WHERE ast_avg > 6 AND games < 55
What is the total number of assists for players with under 55 games and over 6 assists per game average?
CREATE TABLE table_name_11 (total_assists INTEGER, ast_avg VARCHAR, games VARCHAR)
SELECT COUNT(population_density__per_km²_) FROM table_189598_7 WHERE name = "Buffalo Narrows"
When buffalo narrows is the name how many measurements of population density per kilometer squared are there?
CREATE TABLE table_189598_7 ( population_density__per_km²_ VARCHAR, name VARCHAR )
SELECT MAX(death_2013) FROM table_25703_1 WHERE death_2012 = "12,7"
What is the highest death/2013 when the death/2012 is 12,7?
CREATE TABLE table_25703_1 (death_2013 INTEGER, death_2012 VARCHAR)
SELECT AVG(rank) FROM table_name_35 WHERE ast_avg < 2.9
What is the average rank for players with less than 2.9 Assists per game?
CREATE TABLE table_name_35 (rank INTEGER, ast_avg INTEGER)
SELECT COUNT(season) FROM table_25375093_1 WHERE position = "4th"
Name the season for position 4th
CREATE TABLE table_25375093_1 ( season VARCHAR, position VARCHAR )
SELECT death_2012 FROM table_25703_1 WHERE death_2013 = 140 AND january_september_2013 = "Moscow Oblast"
What are the death/2012 number when death/2013 is 140 and January–September 2013 is Moscow Oblast?
CREATE TABLE table_25703_1 (death_2012 VARCHAR, death_2013 VARCHAR, january_september_2013 VARCHAR)
SELECT circuit FROM table_name_79 WHERE winning_car = "ensign n180" AND round = 5
What circuit had an ensign n180 as the winning car in round 5?
CREATE TABLE table_name_79 (circuit VARCHAR, winning_car VARCHAR, round VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2122.0" AND lab.label = "Prot. Electrophoresis, Urine"
what is the number of patients who died in or before 2122 and lab test is prot.electrophoresis urine?
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
SELECT COUNT(birth_2013) FROM table_25703_1 WHERE january_september_2013 = "Oryol Oblast"
How many figures for birth/2013 when January-September is Oryol Oblast?
CREATE TABLE table_25703_1 (birth_2013 VARCHAR, january_september_2013 VARCHAR)
SELECT COUNT(round) FROM table_name_79 WHERE date = "may 31"
How many rounds total were there on may 31?
CREATE TABLE table_name_79 (round VARCHAR, date VARCHAR)
SELECT score FROM table_name_37 WHERE attendance = "1,125"
What is the score of the game with 1,125 people in attendance?
CREATE TABLE table_name_37 ( score VARCHAR, attendance VARCHAR )
SELECT touchdowns FROM table_25711913_2 WHERE points = 25
How many touchdowns did the player took which gained 25 points?
CREATE TABLE table_25711913_2 (touchdowns VARCHAR, points VARCHAR)
SELECT AVG(round) FROM table_name_56 WHERE circuit = "oulton park"
What was the average round for the oulton park circuit?
CREATE TABLE table_name_56 (round INTEGER, circuit VARCHAR)
SELECT nominee_s_ FROM table_name_69 WHERE year < 2005 AND result = "won"
Which nominees won before year 2005?
CREATE TABLE table_name_69 ( nominee_s_ VARCHAR, year VARCHAR, result VARCHAR )
SELECT MAX(points) FROM table_25711913_2 WHERE player = "Curtis"
How many maximum points did Curtis scored?
CREATE TABLE table_25711913_2 (points INTEGER, player VARCHAR)
SELECT away_team FROM table_name_64 WHERE venue = "arden street oval"
Who was the opposing team at the match played at the Arden Street Oval?
CREATE TABLE table_name_64 (away_team VARCHAR, venue VARCHAR)
SELECT opponent FROM table_name_18 WHERE date = "8 april 1999"
What is Opponent, when Date is 8 April 1999?
CREATE TABLE table_name_18 ( opponent VARCHAR, date VARCHAR )
SELECT MAX(touchdowns) FROM table_25711913_2 WHERE position = "Left guard"
How many touchdowns did the left guard took?
CREATE TABLE table_25711913_2 (touchdowns INTEGER, position VARCHAR)
SELECT away_team AS score FROM table_name_31 WHERE venue = "victoria park"
What was the opposing team's score at the match that was played at Victoria Park?
CREATE TABLE table_name_31 (away_team VARCHAR, venue VARCHAR)
SELECT player FROM table_name_44 WHERE to_par = "+2" AND country = "spain"
Who is the player from Spain that has a +2 to par?
CREATE TABLE table_name_44 ( player VARCHAR, to_par VARCHAR, country VARCHAR )
SELECT COUNT(field_goals) FROM table_25711913_2 WHERE position = "Left end"
How many numbers were recorded on the fields goals of the Left End player?
CREATE TABLE table_25711913_2 (field_goals VARCHAR, position VARCHAR)
SELECT venue FROM table_name_32 WHERE home_team = "collingwood"
Which venue did the match where Collingwood was the home team take place?
CREATE TABLE table_name_32 (venue VARCHAR, home_team VARCHAR)
SELECT COUNT("Guests") FROM table_65764 WHERE "Ship name" = 'rv indochina' AND "Crew" < '28'
What is the total for guests with a ship name of rv indochina, and a crew smaller than 28?
CREATE TABLE table_65764 ( "Ship name" text, "Year built" real, "Length" text, "Crew" real, "Guests" real, "Staterooms" real, "Comments" text )
SELECT MIN(touchdowns) FROM table_25711913_2 WHERE position = "Fullback"
What was the minimum touchdowns of the Fullback player?
CREATE TABLE table_25711913_2 (touchdowns INTEGER, position VARCHAR)
SELECT away_team FROM table_name_79 WHERE home_team = "north melbourne"
Who is the away side when north melbourne is the home side?
CREATE TABLE table_name_79 (away_team VARCHAR, home_team VARCHAR)
SELECT venue FROM table_name_60 WHERE runs = "332"
During runs 332, what was the venue?
CREATE TABLE table_name_60 ( venue VARCHAR, runs VARCHAR )
SELECT MIN(touchdowns) FROM table_25711913_8 WHERE position = "Fullback"
How many touchdowns did the fullback score?
CREATE TABLE table_25711913_8 (touchdowns INTEGER, position VARCHAR)
SELECT COUNT(crowd) FROM table_name_8 WHERE away_team = "hawthorn"
How many games feature hawthorn as the away squad?
CREATE TABLE table_name_8 (crowd VARCHAR, away_team VARCHAR)
SELECT Nationality, AVG(meter_100) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
Give me the comparison about the average of meter_100 over the Nationality , and group by attribute Nationality by a bar chart, and sort by the names from high to low.
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) 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 )
SELECT COUNT(field_goals) FROM table_25711913_8 WHERE player = "Weeks"
How many figures are provided for Weeks' field goals?
CREATE TABLE table_25711913_8 (field_goals VARCHAR, player VARCHAR)
SELECT nationality FROM table_name_58 WHERE time = "9:01.70"
What Nationality has a Time of 9:01.70?
CREATE TABLE table_name_58 (nationality VARCHAR, time VARCHAR)
SELECT d_labitems.label FROM d_labitems WHERE d_labitems.itemid IN (SELECT t3.itemid FROM (SELECT t2.itemid, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime, admissions.hadm_id 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 = '1 int mam-cor art bypass') AND STRFTIME('%y', procedures_icd.charttime) >= '2104') AS t1 JOIN (SELECT admissions.subject_id, labevents.itemid, labevents.charttime, admissions.hadm_id FROM labevents JOIN admissions ON labevents.hadm_id = admissions.hadm_id WHERE STRFTIME('%y', labevents.charttime) >= '2104') AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND t1.hadm_id = t2.hadm_id GROUP BY t2.itemid) AS t3 WHERE t3.c1 <= 3)
since 2104, what are the top three most frequent lab tests ordered for patients in the same hospital encounter after having received 1 int mam-cor art bypass?
CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) CREATE TABLE d_labitems ( row_id number, itemid number, label text ) CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) CREATE TABLE 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 )
SELECT MAX(points) FROM table_25711913_8 WHERE position = "Right halfback"
What is the most points recorded for a right halfback?
CREATE TABLE table_25711913_8 (points INTEGER, position VARCHAR)
SELECT MIN(rank) FROM table_name_20 WHERE name = "sun yang"
What is sun yang's lowest rank?
CREATE TABLE table_name_20 (rank INTEGER, name VARCHAR)
SELECT zone_2008 FROM table_name_17 WHERE services = "greater anglia" AND station = "cheshunt"
Which Zone 2008 has Services of greater anglia, and a Station of cheshunt?
CREATE TABLE table_name_17 ( zone_2008 VARCHAR, services VARCHAR, station VARCHAR )
SELECT starter FROM table_25711913_8 WHERE player = "Magoffin"
Was Magoffin a starting player?
CREATE TABLE table_25711913_8 (starter VARCHAR, player VARCHAR)
SELECT COUNT(rank) FROM table_name_12 WHERE nationality = "canada" AND time = "dns"
How many ranks have a ationality of canada, and a Time of dns?
CREATE TABLE table_name_12 (rank VARCHAR, nationality VARCHAR, time VARCHAR)
SELECT AVG(demographic.age) FROM demographic WHERE demographic.marital_status = "SINGLE" AND demographic.dob_year > "2097"
Calculate the average age of unmarried patients born after the year 2097
CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
SELECT player FROM table_25711913_8 WHERE position = "Left tackle"
Which player was at position left tackle?
CREATE TABLE table_25711913_8 (player VARCHAR, position VARCHAR)
SELECT home_team AS score FROM table_name_42 WHERE away_team = "fitzroy"
Who played Fitzroy at their own home?
CREATE TABLE table_name_42 (home_team VARCHAR, away_team VARCHAR)
SELECT "School" FROM table_40166 WHERE "Boys/Girls" = 'boys' AND "Year Entered Competition" = '1929' AND "School Colors" = 'royal blue and gold'
Which boys' school wears Royal Blue and Gold and entered the competition in 1929?
CREATE TABLE table_40166 ( "School" text, "Location" text, "Enrolment" real, "Founded" real, "Denomination" text, "Boys/Girls" text, "Day/Boarding" text, "Year Entered Competition" real, "School Colors" text )
SELECT original_air_date FROM table_25716399_1 WHERE written_by = "Daniel Dratch"
What is the original air date for the episode written by daniel dratch?
CREATE TABLE table_25716399_1 (original_air_date VARCHAR, written_by VARCHAR)
SELECT home_team FROM table_name_2 WHERE venue = "lake oval"
What team plays at home at Lake Oval?
CREATE TABLE table_name_2 (home_team VARCHAR, venue VARCHAR)
SELECT Sex, MIN(Weight) FROM people GROUP BY Sex ORDER BY Sex
What is the minimum weights for people of each sex? Show a bar chart, sort from low to high by the x-axis.
CREATE TABLE candidate ( Candidate_ID int, People_ID int, Poll_Source text, Date text, Support_rate real, Consider_rate real, Oppose_rate real, Unsure_rate real ) CREATE TABLE people ( People_ID int, Sex text, Name text, Date_of_Birth text, Height real, Weight real )
SELECT MAX(no_in_season) FROM table_25716399_1 WHERE directed_by = "Wendey Stanzler"
What season was an episode directed by wendey stanzler?
CREATE TABLE table_25716399_1 (no_in_season INTEGER, directed_by VARCHAR)
SELECT away_team AS score FROM table_name_17 WHERE away_team = "melbourne"
What was Melbourne's score as the away team?
CREATE TABLE table_name_17 (away_team VARCHAR)
SELECT theme FROM table_name_14 WHERE year < 2006 AND issue_price = "$25.22"
What theme is associated with a year before 2006 and Issue Price of $25.22?
CREATE TABLE table_name_14 ( theme VARCHAR, year VARCHAR, issue_price VARCHAR )
SELECT original_air_date FROM table_25716399_1 WHERE us_viewers__millions_ = "5.60"
What was the original air date where there were u.s. viewers (millions) is 5.60?
CREATE TABLE table_25716399_1 (original_air_date VARCHAR, us_viewers__millions_ VARCHAR)
SELECT date FROM table_name_78 WHERE venue = "victoria park"
On what date was the match played in Victoria Park?
CREATE TABLE table_name_78 (date VARCHAR, venue VARCHAR)
SELECT "Venue" FROM table_79078 WHERE "Status" = 'test match' AND "Against" = '12'
What is Venue, when Status is 'Test Match', and when Against is '12'?
CREATE TABLE table_79078 ( "Opposing Teams" text, "Against" real, "Date" text, "Venue" text, "Status" text )
SELECT written_by FROM table_25716399_1 WHERE no_in_season = 14
Who was the writer for season 14?
CREATE TABLE table_25716399_1 (written_by VARCHAR, no_in_season VARCHAR)
SELECT away_team AS score FROM table_name_73 WHERE away_team = "geelong"
What is the away team's score when geelong is the away team?
CREATE TABLE table_name_73 (away_team VARCHAR)
SELECT "Player" FROM table_328 WHERE "School/Club Team/Country" = 'Loyola Marymount'
What player attended Loyola Marymount?
CREATE TABLE table_328 ( "Player" text, "No.(s)" text, "Height in Ft." text, "Position" text, "Years for Rockets" text, "School/Club Team/Country" text )
SELECT written_by FROM table_25716399_1 WHERE original_air_date = "July20,2007"
Who wrote the episode where the original air date is july20,2007?
CREATE TABLE table_25716399_1 (written_by VARCHAR, original_air_date VARCHAR)
SELECT away_team AS score FROM table_name_36 WHERE away_team = "south melbourne"
What is the away team's score when south melbourne is the away team?
CREATE TABLE table_name_36 (away_team VARCHAR)
SELECT "2002" FROM table_43253 WHERE "2008" = 'career statistics'
What 2002 tournament has 2008 career statistics?
CREATE TABLE table_43253 ( "Tournament" 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 )
SELECT MAX(no_in_season) FROM table_25716399_1 WHERE written_by = "Jonathan Collier"
what season was written by jonathan collier?
CREATE TABLE table_25716399_1 (no_in_season INTEGER, written_by VARCHAR)
SELECT result FROM table_name_89 WHERE category = "best actress" AND year < 2005 AND award = "robert award"
What was the result of the film made before 2005, winner of the robert award, in the category of best actress?
CREATE TABLE table_name_89 (result VARCHAR, award VARCHAR, category VARCHAR, year VARCHAR)
SELECT "Location Attendance" FROM table_35312 WHERE "Date" = 'february 27'
What is the Location Attendance when the Date was February 27?
CREATE TABLE table_35312 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text )
SELECT COUNT(no_in_season) FROM table_25716397_1 WHERE written_by = "Tom Scharpling and Daniel Dratch"
How many episodes were written by Tom Scharpling and Daniel Dratch?
CREATE TABLE table_25716397_1 (no_in_season VARCHAR, written_by VARCHAR)
SELECT result FROM table_name_37 WHERE award = "bodil award" AND category = "best actress" AND year = 2005
What was the result of the bodil award winning film from before 2005 in the best actress category?
CREATE TABLE table_name_37 (result VARCHAR, year VARCHAR, award VARCHAR, category VARCHAR)
SELECT rating FROM table_name_23 WHERE viewers__households_in_millions_ = "18.17"
What was the rating of the season that had 18.17 million household viewers?
CREATE TABLE table_name_23 ( rating VARCHAR, viewers__households_in_millions_ VARCHAR )
SELECT COUNT(directed_by) FROM table_25716397_1 WHERE written_by = "Joe Toplyn"
How many people directed the episode that Joe Toplyn wrote?
CREATE TABLE table_25716397_1 (directed_by VARCHAR, written_by VARCHAR)
SELECT category FROM table_name_43 WHERE nominated_work = "cecilie" AND award = "robert award"
What category is the nominated work of cecilie, winner of the robert award?
CREATE TABLE table_name_43 (category VARCHAR, nominated_work VARCHAR, award VARCHAR)
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-56583') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1
what is the length of stay of patient 002-56583 for the last intensive care unit stay?
CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
SELECT COUNT(title) FROM table_25716397_1 WHERE written_by = "Joe Toplyn"
How many titles does the episode written by Joe Toplyn have?
CREATE TABLE table_25716397_1 (title VARCHAR, written_by VARCHAR)
SELECT away_team FROM table_name_1 WHERE venue = "victoria park"
Who was the away team at Victoria Park?
CREATE TABLE table_name_1 (away_team VARCHAR, venue VARCHAR)
SELECT COUNT(high_rebounds) FROM table_22871239_5 WHERE _number = 5
How many high rebound catagories are listed for game number 5?
CREATE TABLE table_22871239_5 ( high_rebounds VARCHAR, _number VARCHAR )
SELECT COUNT(directed_by) FROM table_25716397_1 WHERE series_no = 55
How many directors of episode 55?
CREATE TABLE table_25716397_1 (directed_by VARCHAR, series_no VARCHAR)
SELECT date FROM table_name_2 WHERE away_team = "footscray"
What is the date of the game where Footscray was the away team?
CREATE TABLE table_name_2 (date VARCHAR, away_team VARCHAR)
SELECT TotalUpVotes = SUM(CASE WHEN VoteTypeId = 2 THEN 1 ELSE 0 END), TotalDownVotes = SUM(CASE WHEN VoteTypeId = 3 THEN 1 ELSE 0 END), Accepts = SUM(CASE WHEN VoteTypeId = 1 THEN 1 ELSE 0 END) FROM Posts AS p INNER JOIN Votes AS v ON p.Id = v.PostId WHERE p.OwnerUserId = '##UserId##'
all votes and accepts users have cast for all your posts.
CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) CREATE TABLE VoteTypes ( Id number, Name text ) CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) 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, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) CREATE TABLE PostTypes ( Id number, Name text ) CREATE TABLE FlagTypes ( Id number, Name text, Description text ) CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) CREATE TABLE PostTags ( PostId number, TagId number ) CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) 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 ) CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) CREATE TABLE PostHistoryTypes ( Id number, Name text ) CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
SELECT COUNT(title) FROM table_25716401_1 WHERE written_by = "Tom Scharpling"
How many titles are there for the episode written by Tom Scharpling?
CREATE TABLE table_25716401_1 (title VARCHAR, written_by VARCHAR)
SELECT week FROM table_name_66 WHERE opponent = "bye"
What week did they have a bye?
CREATE TABLE table_name_66 (week VARCHAR, opponent VARCHAR)
SELECT "2011" FROM table_42284 WHERE "2005" = '2r' AND "2003" = '2r'
What was 2011, when 2005 was 2R, and when 2003 was 2R?
CREATE TABLE table_42284 ( "Tournament" text, "1998" text, "1999" 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 )
SELECT MIN(episode_no) FROM table_25721_3 WHERE airdate = "18 October 2012"
Which episode number aired on 18 october 2012?
CREATE TABLE table_25721_3 (episode_no INTEGER, airdate VARCHAR)
SELECT COUNT(crowd) FROM table_name_4 WHERE venue = "western oval"
How many people watch at Western Oval venue?
CREATE TABLE table_name_4 (crowd VARCHAR, venue VARCHAR)
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', 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 = '011-55642' AND patient.hospitaldischargetime IS NULL)) ORDER BY treatment.treatmenttime DESC LIMIT 1
how many days has it been since the last time patient 011-55642's procedure during the current hospital encounter?
CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text ) CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
SELECT MIN(rank__cable_) FROM table_25721_3 WHERE total_viewers = 1464000
What is the lowest cable rank of an episode with 1464000 viewers?
CREATE TABLE table_25721_3 (rank__cable_ INTEGER, total_viewers VARCHAR)
SELECT COUNT(crowd) FROM table_name_66 WHERE home_team = "south melbourne"
How many people are in the crowd in south melbourne?
CREATE TABLE table_name_66 (crowd VARCHAR, home_team VARCHAR)
SELECT name, ID FROM swimmer ORDER BY name
Return a bar chart about the distribution of name and ID , display from low to high by the x axis.
CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) 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 )
SELECT MAX(dave_viewers) FROM table_25721_3 WHERE dave_ja_vu_viewers = 119000
What is the highest number of dave viewers of an episode with 119000 dave ja vu viewers?
CREATE TABLE table_25721_3 (dave_viewers INTEGER, dave_ja_vu_viewers VARCHAR)
SELECT MAX(crowd) FROM table_name_56 WHERE venue = "windy hill"
What was the highest crowd at Windy Hill?
CREATE TABLE table_name_56 (crowd INTEGER, venue VARCHAR)
SELECT "TV season" FROM table_15941 WHERE "Rank" = '39'
What is the season year where the rank is 39?
CREATE TABLE table_15941 ( "Season" real, "Timeslot ( ET )" text, "Season premiere" text, "Season finale" text, "TV season" text, "Rank" text, "Viewers (millions)" text )
SELECT COUNT(total_viewers) FROM table_25721_3 WHERE airdate = "25 October 2012"
How many episodes aired on 25 october 2012?
CREATE TABLE table_25721_3 (total_viewers VARCHAR, airdate VARCHAR)
SELECT COUNT(crowd) FROM table_name_21 WHERE venue = "arden street oval"
How many people at Arden Street Oval?
CREATE TABLE table_name_21 (crowd VARCHAR, venue VARCHAR)
SELECT AVG(fiscal_year) FROM table_name_55 WHERE headquarters = "noida" AND employees < 85 OFFSET 335
What is the average Fiscal Year of the firm Headquartered in noida, with less than 85,335 employees?
CREATE TABLE table_name_55 ( fiscal_year INTEGER, headquarters VARCHAR, employees VARCHAR )
SELECT airdate FROM table_25721_3 WHERE dave_ja_vu_viewers = 106000
What was the airdate of the episode with 106000 dave ja vu viewers?
CREATE TABLE table_25721_3 (airdate VARCHAR, dave_ja_vu_viewers VARCHAR)
SELECT neck FROM table_name_48 WHERE bullet = "10.566 (.416)" AND base = "14.78 (.582)"
Which Neck has a Bullet of 10.566 (.416), and a Base of 14.78 (.582)?
CREATE TABLE table_name_48 (neck VARCHAR, bullet VARCHAR, base VARCHAR)
SELECT Country, COUNT(Country) FROM artist GROUP BY Country
Create a pie chart showing how many country across country.
CREATE TABLE exhibition_record ( Exhibition_ID int, Date text, Attendance int ) CREATE TABLE exhibition ( Exhibition_ID int, Year int, Theme text, Artist_ID int, Ticket_Price real ) CREATE TABLE artist ( Artist_ID int, Name text, Country text, Year_Join int, Age int )
SELECT _number_of_discs FROM table_25721_4 WHERE release = "The Complete Collection Series 1-8 with extras"
How many DVDs where were in the complete collection series 1-8 with extras?
CREATE TABLE table_25721_4 (_number_of_discs VARCHAR, release VARCHAR)
SELECT case_length FROM table_name_57 WHERE base = "14.96 (.589)"
Which Case Length has a Base of 14.96 (.589)?
CREATE TABLE table_name_57 (case_length VARCHAR, base VARCHAR)
SELECT "Main contestant" FROM table_78850 WHERE "Scores by each individual judge" = '8 + 7 + 7 = 21'
Who is the main contestant with scores by each individual judge of 8 + 7 + 7 = 21?
CREATE TABLE table_78850 ( "Main contestant" text, "Co-contestant (Yaar vs. Pyaar)" text, "Date performed" text, "Scores by each individual judge" text, "Total score/week" text, "Position" text, "Status" text )
SELECT release FROM table_25721_4 WHERE _number_of_discs = 6
Which release had 6 DVDs?
CREATE TABLE table_25721_4 (release VARCHAR, _number_of_discs VARCHAR)
SELECT case_length FROM table_name_9 WHERE name = ".416 barrett"
A .416 barrett has which Case Length?
CREATE TABLE table_name_9 (case_length VARCHAR, name VARCHAR)
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.ethnicity = "WHITE" AND diagnoses.short_title = "Portal hypertension"
show me the number of white ethnic background patients who have the diagnoses of portal hypertension.
CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
SELECT COUNT(region_1) FROM table_25721_4 WHERE release = "Back to Earth"
How many region 1's did back to earth have?
CREATE TABLE table_25721_4 (region_1 VARCHAR, release VARCHAR)
SELECT name FROM table_name_16 WHERE case_length = "73.99 (2.913)"
Which Name has a Case Length of 73.99 (2.913)?
CREATE TABLE table_name_16 (name VARCHAR, case_length VARCHAR)
SELECT Years_Played, COUNT(Years_Played) FROM player GROUP BY Years_Played ORDER BY COUNT(Years_Played) DESC
Group and count the years played to draw a bar chart, list y axis in descending order.
CREATE TABLE team ( Team_id int, Name text ) CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Draft_Class text, College text ) CREATE TABLE player ( Player_ID int, Player text, Years_Played text, Total_WL text, Singles_WL text, Doubles_WL text, Team int ) CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text )