text
stringlengths
432
6.49k
target
stringlengths
2
4.44k
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_17516922_1 (play_by_play VARCHAR, network VARCHAR, sideline_reporters VARCHAR) ### Question ### Who had the play-by-play on espn with sideline reporter monica gonzalez? ### Accurate SQL ###
SELECT play_by_play FROM table_17516922_1 WHERE network = "ESPN" AND sideline_reporters = "Monica Gonzalez"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_1 ( first_issue VARCHAR, last_issue VARCHAR ) ### Question ### What is the First issue date of the title with a Last Issue of July 2010? ### Accurate SQL ###
SELECT first_issue FROM table_name_1 WHERE last_issue = "july 2010"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_11677691_5 ( school VARCHAR, player VARCHAR ) ### Question ### Zach Banner is a player at which school? ### Accurate SQL ###
SELECT school FROM table_11677691_5 WHERE player = "Zach Banner"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_39259 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) ### Question ### what is the score on november 15 ### Accurate SQL ###
SELECT "Score" FROM table_39259 WHERE "Date" = 'november 15'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_48613 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" text ) ### Question ### What is the Result of the game with an Attendance of 55,353? ### Accurate SQL ###
SELECT "Result" FROM table_48613 WHERE "Attendance" = '55,353'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1341672_10 ( district VARCHAR, incumbent VARCHAR ) ### Question ### what is the district where the incumbent is james a. haley? ### Accurate SQL ###
SELECT district FROM table_1341672_10 WHERE incumbent = "James A. Haley"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_43 ( copies_sold VARCHAR, first_week_sales VARCHAR ) ### Question ### What's the total number of copies sold for the single that sold 206,030 in the first week? ### Accurate SQL ###
SELECT COUNT(copies_sold) FROM table_name_43 WHERE first_week_sales = 206 OFFSET 030
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_20630462_1 (city_s_ VARCHAR, also_currently_known_as VARCHAR) ### Question ### What is the city location of the tournament currently known as the Medibank International Sydney? ### Accurate SQL ###
SELECT city_s_ FROM table_20630462_1 WHERE also_currently_known_as = "Medibank International Sydney"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: 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 ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) ### Question ### QUERY: count tags from daterange. TODO: compare from two different dateranges... ### Accurate SQL ###
SELECT Tags.TagName, COUNT(*) AS tagcount FROM Posts INNER JOIN PostTags ON PostTags.PostId = Posts.Id INNER JOIN Tags ON Tags.Id = PostTags.TagId WHERE TIME_TO_STR(Posts.CreationDate, '%Y') = 2011 AND TIME_TO_STR(Posts.CreationDate, '%m') = 1 GROUP BY Tags.TagName ORDER BY tagcount DESC LIMIT 10
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: 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 ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: 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 ) ### Question ### calculate the number of medicines that patient 57050 had been prescribed since 03/2105. ### Accurate SQL ###
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57050) AND STRFTIME('%y-%m', prescriptions.startdate) >= '2105-03'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_160 ( id number, "rank" number, "heat" number, "nation" text, "competitors" text, "time" text, "notes" text ) ### Question ### which nation came before spain ? ### Accurate SQL ###
SELECT "nation" FROM table_203_160 WHERE "rank" = (SELECT "rank" FROM table_203_160 WHERE "nation" = 'spain') - 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: 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 ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) ### Question ### what is the daily average of chesttube total output of patient 032-9230 on this hospital visit? ### Accurate SQL ###
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '032-9230' AND patient.hospitaldischargetime IS NULL)) AND intakeoutput.celllabel = 'chesttube total' AND intakeoutput.cellpath LIKE '%output%' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_45 (shoulder_charge VARCHAR, body_tackle VARCHAR) ### Question ### Which shoulder charge has restricted as the body tackle? ### Accurate SQL ###
SELECT shoulder_charge FROM table_name_45 WHERE body_tackle = "restricted"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_29 ( pick INTEGER, player VARCHAR, nationality VARCHAR, draft VARCHAR ) ### Question ### What was the lowest Pick number of Player Brian Bradley from Canada, in a Draft year before 1985? ### Accurate SQL ###
SELECT MIN(pick) FROM table_name_29 WHERE nationality = "canada" AND draft < 1985 AND player = "brian bradley"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_86 ( icao VARCHAR, airport VARCHAR ) ### Question ### What is the ICAO for Antalya Airport? ### Accurate SQL ###
SELECT icao FROM table_name_86 WHERE airport = "antalya airport"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_40 (goalsagainst INTEGER, points VARCHAR, lost VARCHAR) ### Question ### Goalsagainst that has a Points of 108, and a Lost smaller than 14 has what average? ### Accurate SQL ###
SELECT AVG(goalsagainst) FROM table_name_40 WHERE points = 108 AND lost < 14
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_58 ( record VARCHAR, high_points VARCHAR ) ### Question ### Which Record has a High points of hoffman (16)? ### Accurate SQL ###
SELECT record FROM table_name_58 WHERE high_points = "hoffman (16)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_32 (record VARCHAR, game_site VARCHAR, result VARCHAR) ### Question ### Game site of kingdome, and a Result of w 24-6 has what record? ### Accurate SQL ###
SELECT record FROM table_name_32 WHERE game_site = "kingdome" AND result = "w 24-6"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) TABLE: 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 ) TABLE: CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) TABLE: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) ### Question ### Give me the comparison about ID over the meter_700 . ### Accurate SQL ###
SELECT meter_700, ID FROM swimmer
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_48 (instant_messaging VARCHAR, electronic_meeting_system VARCHAR, name VARCHAR) ### Question ### What is Instant Messaging, when Electronic Meeting System is "Yes", and when Name is "Microsoft Sharepoint"? ### Accurate SQL ###
SELECT instant_messaging FROM table_name_48 WHERE electronic_meeting_system = "yes" AND name = "microsoft sharepoint"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_50 ( score VARCHAR, to_par VARCHAR, player VARCHAR ) ### Question ### What is the Score of Stewart Cink with a To par of +4? ### Accurate SQL ###
SELECT score FROM table_name_50 WHERE to_par = "+4" AND player = "stewart cink"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_946 ( id number, "pos" number, "no" number, "driver" text, "team" text, "laps" number, "time/retired" text, "grid" number, "points" number ) ### Question ### greg moore was from the same team as what other 9th place driver ? ### Accurate SQL ###
SELECT "driver" FROM table_204_946 WHERE "pos" = 9
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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(4,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) ### Question ### For those employees who was hired before 2002-06-21, draw a scatter chart about the correlation between commission_pct and department_id . ### Accurate SQL ###
SELECT COMMISSION_PCT, DEPARTMENT_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_52370 ( "Party" text, "Leader" text, "Votes" real, "Percentage" text, "Seats" real ) ### Question ### Who is the leader of the party which has Seats less than 28, a percentage of votes 54.03, and more votes than 120,801? ### Accurate SQL ###
SELECT "Leader" FROM table_52370 WHERE "Seats" < '28' AND "Percentage" = '54.03' AND "Votes" > '120,801'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_76838 ( "Name" text, "Took Office" text, "Left Office" text, "President" text, "Party" text ) ### Question ### What is Party, when Took Office is 1998? ### Accurate SQL ###
SELECT "Party" FROM table_76838 WHERE "Took Office" = '1998'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_15 (year VARCHAR, playoffs VARCHAR) ### Question ### What year did the team make conference semifinals? ### Accurate SQL ###
SELECT COUNT(year) FROM table_name_15 WHERE playoffs = "conference semifinals"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_16226 ( "1st players choice" text, "2nd players choice" text, "Probability 1st player wins" text, "Probability 2nd player wins" text, "Probability of a draw" text ) ### Question ### In Penney's game what is the probability where the 1st player wins if the probability of a draw is 8.28% and the 2nd player chooses B BR? ### Accurate SQL ###
SELECT "Probability 1st player wins" FROM table_16226 WHERE "Probability of a draw" = '8.28%' AND "2nd players choice" = 'B BR'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_13 ( wk_9 INTEGER, wk_11 VARCHAR, wk_7 VARCHAR, wk_6 VARCHAR, wk_10 VARCHAR ) ### Question ### What is the highest week 9 that had a week 6 of 7, a week 10 of greater than 2, a week 7 of 5, and a week 11 less than 2? ### Accurate SQL ###
SELECT MAX(wk_9) FROM table_name_13 WHERE wk_6 = "7" AND wk_10 > 2 AND wk_7 = "5" AND wk_11 < 2
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_26 ( date VARCHAR, attendance VARCHAR ) ### Question ### When was the game that had 58,025 people in attendance? ### Accurate SQL ###
SELECT date FROM table_name_26 WHERE attendance = "58,025"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_79 ( tie_no VARCHAR, away_team VARCHAR ) ### Question ### What was the tie number of the away game for Ashford Town (Middx)? ### Accurate SQL ###
SELECT tie_no FROM table_name_79 WHERE away_team = "ashford town (middx)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: 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 ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: 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 ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) ### Question ### Who downvotes most (compared to upvotes)?. ### Accurate SQL ###
SELECT DisplayName, DownVotes, UpVotes, ROUND(CAST(UpVotes AS FLOAT) / CAST(DownVotes AS FLOAT), 3) AS "UV/DV Ratio" FROM Users WHERE DownVotes > 1 ORDER BY 'DownVotes'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_3110 ( "No. in series" real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real ) ### Question ### How many episodes were written by Ross brown? ### Accurate SQL ###
SELECT COUNT("No. in series") FROM table_3110 WHERE "Written by" = 'Ross Brown'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: 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 ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) ### Question ### on 08/30/2105, when was the last time that patient 027-210868 had a gastric (ng) output? ### Accurate SQL ###
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 = '027-210868')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'gastric (ng)' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) = '2105-08-30' ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_19 ( venue VARCHAR, event VARCHAR, competition VARCHAR ) ### Question ### Where was the London Marathon held? ### Accurate SQL ###
SELECT venue FROM table_name_19 WHERE event = "marathon" AND competition = "london marathon"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_61 (set_3 VARCHAR, total VARCHAR, time VARCHAR, score VARCHAR) ### Question ### Which set 3 has a Time of 10:00, and a Score of 3–2, and a Total of 113–102? ### Accurate SQL ###
SELECT set_3 FROM table_name_61 WHERE time = "10:00" AND score = "3–2" AND total = "113–102"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### count the number of patients whose diagnoses short title is hyp ht dis nos w ht fail? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Hyp ht dis NOS w ht fail"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_16 ( transfers VARCHAR, distance__km_ VARCHAR, station_name VARCHAR ) ### Question ### What's the transfer distance (km) larger than 36.5, at the station of guangximen? ### Accurate SQL ###
SELECT transfers FROM table_name_16 WHERE distance__km_ > 36.5 AND station_name = "guangximen"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_203_442 ( id number, "#" number, "date" text, "venue" text, "opponent" text, "score" text, "result" text, "competition" text ) ### Question ### how many friendly competitions occurred before september ? ### Accurate SQL ###
SELECT COUNT(*) FROM table_203_442 WHERE "date" < 9 AND "competition" = 'friendly'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: 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 ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) ### Question ### a one way flight from BOSTON to SAN FRANCISCO please ### Accurate SQL ###
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_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_74747 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### What was the score of the home team when the away team scored 14.12 (96)? ### Accurate SQL ###
SELECT "Home team score" FROM table_74747 WHERE "Away team score" = '14.12 (96)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: 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 ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: 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 ) ### Question ### Number of users per location. ### Accurate SQL ###
SELECT Location, COUNT(*) AS cnt FROM Users GROUP BY Location ORDER BY cnt DESC LIMIT 100
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: 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 ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) ### Question ### how do i get downtown from the TORONTO airport ### Accurate SQL ###
SELECT DISTINCT ground_service.transport_type FROM airport, airport_service, city, ground_service WHERE airport.airport_code = airport_service.airport_code AND city.city_code = airport_service.city_code AND city.city_name = 'TORONTO' AND ground_service.airport_code = airport.airport_code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 ( gold INTEGER, bronze VARCHAR, total VARCHAR ) ### Question ### When the Total is less than 1, and Bronze is 0, how many Gold medals are there? ### Accurate SQL ###
SELECT SUM(gold) FROM table_name_73 WHERE bronze = 0 AND total < 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_70107 ( "Year" text, "Men's singles" text, "Women's singles" text, "Men's doubles" text, "Women's doubles" text, "Mixed doubles" text ) ### Question ### Who won Mixed doubles the year that Pablo Abian won Men's singles? ### Accurate SQL ###
SELECT "Mixed doubles" FROM table_70107 WHERE "Men's singles" = 'pablo abian'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_23958917_1 (stacks VARCHAR, in_service_dates VARCHAR) ### Question ### Name the stacks for 1 1969 2 1995 ### Accurate SQL ###
SELECT stacks FROM table_23958917_1 WHERE in_service_dates = "1 1969 2 1995"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_35 (away_team VARCHAR, venue VARCHAR) ### Question ### What team has a Venue at Lake Oval? ### Accurate SQL ###
SELECT away_team FROM table_name_35 WHERE venue = "lake oval"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1341598_39 (party VARCHAR, incumbent VARCHAR) ### Question ### To which party does Robert W. Edgar belong? ### Accurate SQL ###
SELECT party FROM table_1341598_39 WHERE incumbent = "Robert W. Edgar"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_61 (average INTEGER, lowest VARCHAR, team VARCHAR) ### Question ### Lowest larger than 288, and a Team of east stirlingshire has what lowest average? ### Accurate SQL ###
SELECT MIN(average) FROM table_name_61 WHERE lowest > 288 AND team = "east stirlingshire"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_78969 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real ) ### Question ### Which Number of electorates (2009) has a Constituency number of 46? ### Accurate SQL ###
SELECT AVG("Number of electorates (2009)") FROM table_78969 WHERE "Constituency number" = '46'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: 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 ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: 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 ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) ### Question ### Which questions have no popular tags?. The proliferation of tags can mean that many questions have no popular tags. Such questions are more difficult to find, and do not contribute to enabling the 'Generalist' badge for smaller sites. Here, choose a threshold (i.e., 40, for top 40 tags), and this query will return all questions that have no tags that popular. It will also provide the name of the question's most popular tag. Related: Query 342344 (Which open or duplicate questions have no popular tags?) ### Accurate SQL ###
WITH My_Table AS (SELECT t.Id AS Tag_ID, t.TagName AS Tag_Name, t.Count AS Count, p.Id AS Post_ID, p.Title AS Post_Title, p.PostTypeId AS Type, p.OwnerUserId AS Owner, MAX(t.Count) OVER (PARTITION BY p.Id) AS Max_Count FROM Tags AS t INNER JOIN PostTags AS pt ON t.Id = pt.TagId INNER JOIN Posts AS p ON pt.PostId = p.Id) SELECT Tag_ID, Tag_Name, 'site://questions/' + CAST(Post_ID AS TEXT) + '|' + Post_Title AS Post, Max_Count FROM My_Table WHERE Type = 1 AND Max_Count = Count AND Max_Count < @Threshold ORDER BY Max_Count
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_34064 ( "Name" text, "Years" text, "Seasons" real, "Lost" real, "Pct." real ) ### Question ### What's the average pct for George Felton when he had losses greater than 7? ### Accurate SQL ###
SELECT AVG("Pct.") FROM table_34064 WHERE "Lost" > '7' AND "Name" = 'george felton'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_26 ( first_issued INTEGER, color VARCHAR ) ### Question ### When was Color of green last issued? ### Accurate SQL ###
SELECT MAX(first_issued) FROM table_name_26 WHERE color = "green"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_84 (state VARCHAR, interview VARCHAR, evening_gown VARCHAR, swimsuit VARCHAR) ### Question ### Name the state with an evening gown more than 8.86 and interview less than 8.7 and swimsuit less than 8.96 ### Accurate SQL ###
SELECT state FROM table_name_84 WHERE evening_gown > 8.86 AND swimsuit < 8.96 AND interview < 8.7
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE event ( ID int, Name text, Stadium_ID int, Year text ) TABLE: 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 ) TABLE: CREATE TABLE stadium ( ID int, name text, Capacity int, City text, Country text, Opening_year int ) TABLE: CREATE TABLE record ( ID int, Result text, Swimmer_ID int, Event_ID int ) ### Question ### Find meter_400 and meter_100 , and visualize them by a bar chart, and I want to sort by the Y in desc. ### Accurate SQL ###
SELECT meter_400, meter_100 FROM swimmer ORDER BY meter_100 DESC
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_96 (last_match VARCHAR, manner_of_departure VARCHAR, date_of_vacancy VARCHAR) ### Question ### What is the last match with a resigned manner of departure and a round 1 date of vacancy? ### Accurate SQL ###
SELECT last_match FROM table_name_96 WHERE manner_of_departure = "resigned" AND date_of_vacancy = "round 1"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_50 (constructor VARCHAR, driver VARCHAR) ### Question ### What company was the constructor when Nick Heidfeld was the driver/ ### Accurate SQL ###
SELECT constructor FROM table_name_50 WHERE driver = "nick heidfeld"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_55062 ( "Block A" text, "Ryuji Hijikata" text, "Shuji Kondo" text, "El NOSAWA Mendoza" text, "PEPE Michinoku" text, "Katsuhiko Nakajima" text ) ### Question ### What is the Block A value for an El NOSAWA Mendoza value of kondo (7:08)? ### Accurate SQL ###
SELECT "Block A" FROM table_55062 WHERE "El NOSAWA Mendoza" = 'kondo (7:08)'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: 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(4,0) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) ### Question ### For those employees who did not have any job in the past, give me the comparison about the average of manager_id over the hire_date bin hire_date by time by a bar chart. ### Accurate SQL ###
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_15647838_3 ( _number INTEGER, location VARCHAR, opponent VARCHAR ) ### Question ### What is the lowest # in Atlanta, GA with the Georgia Bulldogs as an opponent? ### Accurate SQL ###
SELECT MIN(_number) FROM table_15647838_3 WHERE location = "Atlanta, GA" AND opponent = "Georgia Bulldogs"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_42 ( date VARCHAR, host_team VARCHAR ) ### Question ### On what date did the New York Giants host a game? ### Accurate SQL ###
SELECT date FROM table_name_42 WHERE host_team = "new york giants"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1999350_1 ( playoffs VARCHAR, year VARCHAR ) ### Question ### What is the total number of playoffs held in exactly 2006? ### Accurate SQL ###
SELECT COUNT(playoffs) FROM table_1999350_1 WHERE year = 2006
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_39504 ( "Start date" text, "End date" text, "Pos." text, "Player" text, "To club" text ) ### Question ### A player was moved to celtic had an end of what date? ### Accurate SQL ###
SELECT "End date" FROM table_39504 WHERE "To club" = 'celtic'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: 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 ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: 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 ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: 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 ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) ### Question ### has patient 42454 had any cont inv mec ven 96+ hrs treatment? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'cont inv mec ven 96+ hrs') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 42454)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: 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(4,0) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) ### Question ### 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? ### Accurate SQL ###
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
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_66454 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### what is the least silver for germany when gold is more than 4? ### Accurate SQL ###
SELECT MIN("Silver") FROM table_66454 WHERE "Nation" = 'germany' AND "Gold" > '4'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_10904 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### What did the team score when playing against home in geelong? ### Accurate SQL ###
SELECT "Away team score" FROM table_10904 WHERE "Home team" = 'geelong'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_22100 ( "Player" text, "Alma Mater" text, "National Lacrosse League" text, "Major League Lacrosse" text, "International Competition" text ) ### Question ### List the plats that attended Wilfrid Laurier University. ### Accurate SQL ###
SELECT "Player" FROM table_22100 WHERE "Alma Mater" = 'Wilfrid Laurier University'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_343 ( id number, "nation" text, "model" text, "length" text, "barrel length" text, "weight" text ) ### Question ### what country has the least number of rifles in service ? ### Accurate SQL ###
SELECT "nation" FROM table_204_343 GROUP BY "nation" ORDER BY COUNT(*) LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_56695 ( "PRR Class" text, "Builder\u2019s Model" text, "Build date" text, "Total produced" real, "Wheel arrangement" text, "Service" text, "Power output" text ) ### Question ### What is the wheel arrangement of cf-16-4, and 16 produced? ### Accurate SQL ###
SELECT "Wheel arrangement" FROM table_56695 WHERE "Builder\u2019s Model" = 'cf-16-4' AND "Total produced" = '16'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_99 (player VARCHAR, money___£__ VARCHAR, country VARCHAR) ### Question ### What player has money of (£) 159,500, and france is the country? ### Accurate SQL ###
SELECT player FROM table_name_99 WHERE money___£__ = "159,500" AND country = "france"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_63 ( area VARCHAR, roll VARCHAR ) ### Question ### What is the Area with 26 in Roll ### Accurate SQL ###
SELECT area FROM table_name_63 WHERE roll = 26
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_36372 ( "Call sign" text, "Frequency MHz" real, "City of license" text, "ERP W" text, "Class" text, "FCC info" text ) ### Question ### WHich FCC info has 3,000 ERP W? ### Accurate SQL ###
SELECT "FCC info" FROM table_36372 WHERE "ERP W" = '3,000'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_11238597_4 (share VARCHAR, air_date VARCHAR) ### Question ### What was the share for the episode with the air date december 10, 2008? ### Accurate SQL ###
SELECT share FROM table_11238597_4 WHERE air_date = "December 10, 2008"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_65 ( round INTEGER, overall VARCHAR, position VARCHAR ) ### Question ### During which round was the first defensive end with an overall rank larger than 186 drafted? ### Accurate SQL ###
SELECT MIN(round) FROM table_name_65 WHERE overall > 186 AND position = "defensive end"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_90 ( director VARCHAR, title VARCHAR ) ### Question ### What is the Director of the Film The Fugitive? ### Accurate SQL ###
SELECT director FROM table_name_90 WHERE title = "the fugitive"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_38583 ( "Designation HD" text, "Constellation" text, "Date sent" text, "Arrival date" text, "Message" text ) ### Question ### Which constellation has cosmic call 1 as the message, and an arrival date of october 2067? ### Accurate SQL ###
SELECT "Constellation" FROM table_38583 WHERE "Message" = 'cosmic call 1' AND "Arrival date" = 'october 2067'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_79 ( player VARCHAR, country VARCHAR, to_par VARCHAR ) ### Question ### What is Player, when Country is 'United States', and when To Par is 'WD'? ### Accurate SQL ###
SELECT player FROM table_name_79 WHERE country = "united states" AND to_par = "wd"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_863 ( id number, "state" text, "city/county" text, "population served" number, "charter type" text, "station name" text, "web site" text ) ### Question ### what is the number of people served by the rolla station ? ### Accurate SQL ###
SELECT "population served" FROM table_204_863 WHERE "city/county" = 'rolla'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_204_867 ( id number, "number" number, "date" text, "name" text, "age\n(at execution)" number, "age\n(at offense)" number, "race" text, "state" text, "method" text ) ### Question ### how many total women have been executed by lethal injection ? ### Accurate SQL ###
SELECT COUNT("name") FROM table_204_867 WHERE "method" = 'lethal injection'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_95 (tied VARCHAR, team VARCHAR, matches VARCHAR, lost VARCHAR) ### Question ### Which Tied has Matches of 1, and a Lost of 0, and a Team of durham? ### Accurate SQL ###
SELECT tied FROM table_name_95 WHERE matches = "1" AND lost = "0" AND team = "durham"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_29 ( acres VARCHAR, landfill VARCHAR, opened VARCHAR ) ### Question ### What is the total number of acres at Sai Tso Wan, opening before 1978? ### Accurate SQL ###
SELECT COUNT(acres) FROM table_name_29 WHERE landfill = "sai tso wan" AND opened < 1978
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time ) TABLE: 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 ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) ### Question ### since 5 years ago, had patient 035-10830 been in an er? ### Accurate SQL ###
SELECT COUNT(*) > 0 FROM patient WHERE patient.uniquepid = '035-10830' AND patient.hospitaladmitsource = 'emergency department' AND DATETIME(patient.unitadmittime) >= DATETIME(CURRENT_TIME(), '-5 year')
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### give me short title of diagnoses for diagnoses icd9 code 45981. ### Accurate SQL ###
SELECT diagnoses.short_title FROM diagnoses WHERE diagnoses.icd9_code = "45981"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE month ( month_number int, month_name text ) TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE code_description ( code varchar, description text ) TABLE: 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 ) TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text ) TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar ) ### Question ### is there a flight tomorrow morning from COLUMBUS to NASHVILLE ### Accurate SQL ###
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 = 'NASHVILLE' AND date_day.day_number = 20 AND date_day.month_number = 1 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'COLUMBUS' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_87 ( mins INTEGER, club VARCHAR, shts VARCHAR ) ### Question ### What is the largest MINS for the San Jose Earthquakes with a SHTS less than 166? ### Accurate SQL ###
SELECT MAX(mins) FROM table_name_87 WHERE club = "san jose earthquakes" AND shts < 166
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: 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 ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: 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 ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: 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 ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: 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 ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: 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 ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) ### Question ### Titre des 10 derni res questions pos es et pseudo de l'auteur. ### Accurate SQL ###
SELECT MONTH(10)
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE projects ( name VARCHAR, hours INTEGER ) ### Question ### Find the name of projects that require between 100 and 300 hours of work. ### Accurate SQL ###
SELECT name FROM projects WHERE hours BETWEEN 100 AND 300
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_60 ( catalogue VARCHAR, writer_s_ VARCHAR ) ### Question ### Which Catalogue has a Writer(s) of mark james? ### Accurate SQL ###
SELECT catalogue FROM table_name_60 WHERE writer_s_ = "mark james"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_2409041_3 (written_by VARCHAR, no_in_season VARCHAR) ### Question ### Who wrote season 23? ### Accurate SQL ###
SELECT written_by FROM table_2409041_3 WHERE no_in_season = 23
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_47 ( crowd INTEGER, home_team VARCHAR ) ### Question ### What was the smallest crowd size for a home game for Richmond? ### Accurate SQL ###
SELECT MIN(crowd) FROM table_name_47 WHERE home_team = "richmond"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) TABLE: CREATE TABLE Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) ### Question ### For those records from the products and each product's manufacturer, give me the comparison about the average of code over the name , and group by attribute name, and list Y in descending order. ### Accurate SQL ###
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T1.Code DESC
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE job_history ( EMPLOYEE_ID decimal(6,0), START_DATE date, END_DATE date, JOB_ID varchar(10), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: 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(4,0) ) ### Question ### What are the job titles, and range of salaries for jobs with maximum salary between 12000 and 18000. Plot them as bar chart. ### Accurate SQL ###
SELECT JOB_TITLE, MAX_SALARY - MIN_SALARY FROM jobs WHERE MAX_SALARY BETWEEN 12000 AND 18000
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_45302 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( $ )" text ) ### Question ### What country is Jack Nicklaus from? ### Accurate SQL ###
SELECT "Country" FROM table_45302 WHERE "Player" = 'jack nicklaus'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: 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 ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: 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 ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: 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 ) TABLE: 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 ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: 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 ) ### Question ### Number of votes per month. Accounting only for votes cast on questions less than 31 days after the question was created. ### Accurate SQL ###
WITH UpVotesByDay AS (SELECT DATEADD(day, DATEDIFF(day, 0, CreationDate), 0) AS "day", COUNT(v.Id) AS Votes FROM Votes AS v JOIN Posts AS p ON (p.Id = v.PostId) AND p.PostTypeId = 1 WHERE v.VoteTypeId = 2 GROUP BY DATEADD(day, DATEDIFF(day, 0, CreationDate), 0)), DownVotesByDay AS (SELECT DATEADD(day, DATEDIFF(day, 0, CreationDate), 0) AS "day", COUNT(v.Id) AS Votes FROM Votes AS v JOIN Posts AS p ON (p.Id = v.PostId) AND p.PostTypeId = 1 WHERE v.VoteTypeId = 3 GROUP BY DATEADD(day, DATEDIFF(day, 0, CreationDate), 0)) SELECT v."day", v.Votes + dv.Votes AS "total", v.Votes AS "upvotes", dv.Votes AS "downvotes" FROM UpVotesByDay AS v JOIN DownVotesByDay AS dv ON v."day" = dv."day" ORDER BY v."day"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_24 (distance VARCHAR, race VARCHAR) ### Question ### What is the distance of the Sam's town 250 race? ### Accurate SQL ###
SELECT distance FROM table_name_24 WHERE race = "sam's town 250"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_7 ( stories INTEGER, height VARCHAR ) ### Question ### What is the highest number of stories in homes with a height of 42 m.? ### Accurate SQL ###
SELECT MAX(stories) FROM table_name_7 WHERE height = "42 m."
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_37740 ( "Name" text, "Hanzi" text, "Language" text, "Launch" real, "Owner" text ) ### Question ### Which hanzi's name is nmtv mongolian satellite television? ### Accurate SQL ###
SELECT "Hanzi" FROM table_37740 WHERE "Name" = 'nmtv mongolian satellite television'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_45 (winning_driver VARCHAR, race VARCHAR) ### Question ### Name the winning driver for belgian grand prix ### Accurate SQL ###
SELECT winning_driver FROM table_name_45 WHERE race = "belgian grand prix"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) ) TABLE: CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) TABLE: CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME ) TABLE: CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME ) TABLE: CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) ) TABLE: CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT ) ### Question ### Show the booking status code and the corresponding number of bookings by a pie chart. ### Accurate SQL ###
SELECT booking_status_code, COUNT(*) FROM Apartment_Bookings GROUP BY booking_status_code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: 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 ) TABLE: 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 ) ### Question ### how many patients whose diagnoses short title is ath ext ntv at w claudct? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.short_title = "Ath ext ntv at w claudct"