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_4301 ( "Year" real, "GDP at constant prices (THB trillions)" text, "GDP at constant prices growth rate (percent change)" text, "GDP at current prices (USD billions)" text, "Export volume of goods and services (percent change)" text, "Current account balance (percent of GDP)" text ) ### Question ### How many export volume of goods and services values are associated with GDP at current prices of 161.340? ### Accurate SQL ###
SELECT COUNT("Export volume of goods and services (percent change)") FROM table_4301 WHERE "GDP at current prices (USD billions)" = '161.340'
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_48199 ( "Player" text, "Nationality" text, "Jersey Number(s)" real, "Position" text, "Years" text, "From" text ) ### Question ### What is From, when Player is Jackie Robinson Category:Articles With Hcards? ### Accurate SQL ###
SELECT "From" FROM table_48199 WHERE "Player" = 'jackie robinson category:articles with hcards'
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_80008 ( "Name" text, "Years" text, "Gender" text, "Area" text, "Authority" text, "Decile" real, "Roll" real ) ### Question ### What is the total of the roll with a Decile of 8, and an Area of hororata? ### Accurate SQL ###
SELECT SUM("Roll") FROM table_80008 WHERE "Decile" = '8' AND "Area" = 'hororata'
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_88 (date VARCHAR, country VARCHAR) ### Question ### For the United Kingdom, what's the date? ### Accurate SQL ###
SELECT date FROM table_name_88 WHERE country = "united kingdom"
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_10 ( name VARCHAR, total_point VARCHAR, bonus VARCHAR, only_point VARCHAR ) ### Question ### What is Name, when Bonus is greater than 1, when Only Point is greater than 7, and when Total Point is less than 21? ### Accurate SQL ###
SELECT name FROM table_name_10 WHERE bonus > 1 AND only_point > 7 AND total_point < 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 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) ) 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 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) ) 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 did not have any job in the past, show me about the distribution of hire_date and the average of manager_id bin hire_date by time in 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_203_146 ( id number, "year" number, "association" text, "category" text, "nominated work" text, "result" text ) ### Question ### which association awarded jones ' first award after the year 2000 ? ### Accurate SQL ###
SELECT "association" FROM table_203_146 WHERE "year" > 2000 ORDER BY "year" 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_203_692 ( id number, "name" text, "pos." text, "caps" number, "goals" number, "club" text ) ### Question ### who 2 players had at least 6 goals ? ### Accurate SQL ###
SELECT "name" FROM table_203_692 WHERE "goals" >= 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 table_name_48 ( runner_s__up VARCHAR, winning_score VARCHAR ) ### Question ### Who is the runner(s)-up with a winning score of 5 (72-71-68=211)? ### Accurate SQL ###
SELECT runner_s__up FROM table_name_48 WHERE winning_score = −5(72 - 71 - 68 = 211)
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_73168 ( "Season" real, "Class" text, "Team" text, "Motorcycle" text, "Type" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real, "Pts" real, "Position" text ) ### Question ### What's the name of the team who had a Honda motorcycle? ### Accurate SQL ###
SELECT "Team" FROM table_73168 WHERE "Motorcycle" = 'Honda'
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 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 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 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 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) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) ### Question ### For all employees who have the letters D or S in their first name, show me about the correlation between salary and commission_pct in a scatter chart. ### Accurate SQL ###
SELECT SALARY, COMMISSION_PCT FROM employees WHERE FIRST_NAME LIKE '%D%' OR FIRST_NAME LIKE '%S%'
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 singer (song_name VARCHAR, age INTEGER) ### Question ### List all song names by singers above the average age. ### Accurate SQL ###
SELECT song_name FROM singer WHERE age > (SELECT AVG(age) FROM singer)
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 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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE ReviewTaskTypes ( 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 Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) 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 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE PostTypes ( Id number, Name 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE PostHistoryTypes ( 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) 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 PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) ### Question ### Reputation from Answers to Closed Questions. ### Accurate SQL ###
SELECT SUM(CASE WHEN v.VoteTypeId = 1 THEN 15 WHEN v.VoteTypeId = 2 THEN 10 WHEN v.VoteTypeId = 3 THEN -2 ELSE 0 END) AS "Reputation" FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id INNER JOIN Votes AS v ON v.PostId = a.Id WHERE a.CommunityOwnedDate IS NULL AND a.OwnerUserId = '##UserId##' AND a.PostTypeId = 2 AND NOT (q.ClosedDate IS NULL)
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_21 (type VARCHAR, company VARCHAR) ### Question ### Which Type has a Company of epcor? ### Accurate SQL ###
SELECT type FROM table_name_21 WHERE company = "epcor"
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_72 (score VARCHAR, partner VARCHAR) ### Question ### What was the score of the match in which mardy fish was the partner? ### Accurate SQL ###
SELECT score FROM table_name_72 WHERE partner = "mardy fish"
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 (surface VARCHAR, date VARCHAR) ### Question ### Name the surface for february 25, 1996 ### Accurate SQL ###
SELECT surface FROM table_name_58 WHERE date = "february 25, 1996"
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_54 ( rank INTEGER, time___sec__ VARCHAR ) ### Question ### What is the rank for the person with time 11.14? ### Accurate SQL ###
SELECT AVG(rank) FROM table_name_54 WHERE time___sec__ = 11.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_97 (nhl_team VARCHAR, player VARCHAR) ### Question ### Which NHL team has a Player of steve durbano? ### Accurate SQL ###
SELECT nhl_team FROM table_name_97 WHERE player = "steve durbano"
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 ( Code Char(4), Name Char(50), Hours int ) TABLE: CREATE TABLE Scientists ( SSN int, Name Char(30) ) TABLE: CREATE TABLE AssignedTo ( Scientist int, Project char(4) ) ### Question ### Find the number of scientists involved for the projects that require more than 300 hours. Show bar chart. ### Accurate SQL ###
SELECT Name, COUNT(*) FROM Projects AS T1 JOIN AssignedTo AS T2 ON T1.Code = T2.Project WHERE T1.Hours > 300 GROUP BY T1.Name
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 microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime 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 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 cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) ### Question ### what are the five most frequently conducted lab tests for patients who have already been diagnosed with depression within 2 months, last year? ### Accurate SQL ###
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'depression' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, lab.labname, lab.labresulttime FROM lab JOIN patient ON lab.patientunitstayid = patient.patientunitstayid WHERE DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.labresulttime AND DATETIME(t2.labresulttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month') GROUP BY t2.labname) AS t3 WHERE t3.c1 <= 5
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 (quantity_made VARCHAR, manufacturer VARCHAR) ### Question ### What's the quantity made when the manufacturer was 4-6-2 — oooooo — pacific? ### Accurate SQL ###
SELECT quantity_made FROM table_name_7 WHERE manufacturer = "4-6-2 — oooooo — pacific"
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_1717824_1 ( south_asians_2001 VARCHAR, province VARCHAR ) ### Question ### What was the South Asian population in Nova Scotia in 2001? ### Accurate SQL ###
SELECT south_asians_2001 FROM table_1717824_1 WHERE province = "Nova Scotia"
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_17 ( coombe_road VARCHAR, selsdon VARCHAR ) ### Question ### What is the Coombe Road time with a Selsdon evening peak? ### Accurate SQL ###
SELECT coombe_road FROM table_name_17 WHERE selsdon = "evening peak"
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_19769687_3 ( _percentage_of_popular_vote VARCHAR, election VARCHAR ) ### Question ### Name the % of popular vote for election for 1926 ### Accurate SQL ###
SELECT _percentage_of_popular_vote FROM table_19769687_3 WHERE election = "1926"
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_2 ( manner_of_departure VARCHAR, date_of_appointment VARCHAR ) ### Question ### I want the manner of departure for 1 june 2007 ### Accurate SQL ###
SELECT manner_of_departure FROM table_name_2 WHERE date_of_appointment = "1 june 2007"
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_12286195_1 (original_team VARCHAR, result VARCHAR) ### Question ### What is the original team of the celebrity who had the result 08 fired in week 10 (2008-03-06) ### Accurate SQL ###
SELECT original_team FROM table_12286195_1 WHERE result = "08 Fired in week 10 (2008-03-06)"
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_55 ( tournament VARCHAR, opponent_in_the_final VARCHAR ) ### Question ### Which tournament has raffaella reggi listed as the opponent in the final? ### Accurate SQL ###
SELECT tournament FROM table_name_55 WHERE opponent_in_the_final = "raffaella reggi"
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 PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress 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 PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment 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 ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId 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 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 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 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 FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskStates ( 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 ReviewTaskTypes ( Id number, Name text, Description 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 VoteTypes ( 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense 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 ) ### Question ### Convert UTC to PST with DST. Functionality for converting UTC / GMT unix server epoch time into Pacific Daylight Time (PDT) or Pacific Standard Time (PST) time zones including adjustment for Daylight Savings Time (DST), which in North America begins on the 2nd Sunday of March at 02:00am and ends on the 1st Sunday of November at 02:00am, every year. Unfortunately we can't add custom functions to SEDE so this will have to be otherwise adapted for use in a query. ### Accurate SQL ###
SELECT CURRENT_TIMESTAMP()
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_18018214_4 (goals_conceded VARCHAR, points VARCHAR) ### Question ### In the game with 31 points, how many goals were conceded? ### Accurate SQL ###
SELECT COUNT(goals_conceded) FROM table_18018214_4 WHERE points = 31
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_65511 ( "Rank" real, "Rowers" text, "Country" text, "Time" text, "Notes" text ) ### Question ### What was the rank of the team who raced at a time of 7:16.13? ### Accurate SQL ###
SELECT "Rank" FROM table_65511 WHERE "Time" = '7:16.13'
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 ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time ) TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text ) TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time ) TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number ) TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time ) TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time ) TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime 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 treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime 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 ) ### Question ### retrieve the patients' ids who are diagnosed with cardiac arrest - un-witnessed since 5 years ago. ### Accurate SQL ###
SELECT patient.uniquepid FROM patient WHERE patient.patientunitstayid IN (SELECT diagnosis.patientunitstayid FROM diagnosis WHERE diagnosis.diagnosisname = 'cardiac arrest - un-witnessed' AND DATETIME(diagnosis.diagnosistime) >= 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 table_23211041_5 (team VARCHAR, date VARCHAR) ### Question ### What team was played on november 24? ### Accurate SQL ###
SELECT team FROM table_23211041_5 WHERE date = "November 24"
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_23177573_1 ( original_air_date VARCHAR, rank__week_ VARCHAR ) ### Question ### What is the original air date of the episode that had a week ranking of 21? ### Accurate SQL ###
SELECT original_air_date FROM table_23177573_1 WHERE rank__week_ = 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_29770 ( "Game" real, "Date" text, "Team" text, "Score" text, "High points" text, "High rebounds" text, "High assists" text, "Location Attendance" text, "Record" text ) ### Question ### Who was the other team on march 27? ### Accurate SQL ###
SELECT "Team" FROM table_29770 WHERE "Date" = 'March 27'
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_22128871_1 ( year__ceremony_ VARCHAR, result VARCHAR ) ### Question ### What is every ceremony year for the result of nominee? ### Accurate SQL ###
SELECT year__ceremony_ FROM table_22128871_1 WHERE result = "Nominee"
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_71 (gold INTEGER, total VARCHAR, bronze VARCHAR, rank VARCHAR) ### Question ### What is the smallest number of gold of a country of rank 6, with 2 bronzes? ### Accurate SQL ###
SELECT MIN(gold) FROM table_name_71 WHERE bronze = 2 AND rank = 6 AND total > 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_37489 ( "Name" text, "Gain" real, "Loss" real, "Long" real, "Avg/G" real ) ### Question ### Which Loss has a Name of bullock, chris, and a Long smaller than 36? ### Accurate SQL ###
SELECT SUM("Loss") FROM table_37489 WHERE "Name" = 'bullock, chris' AND "Long" < '36'
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_60643 ( "Year" real, "Total Horses" real, "Working Horses" text, "Total Cattle" real, "Oxen" real, "Bulls" text, "Cows" real, "Pigs" real, "Sheep and Goats" real ) ### Question ### How many years had fewer than 2089.2 pigs? ### Accurate SQL ###
SELECT COUNT("Year") FROM table_60643 WHERE "Pigs" < '2089.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_71198 ( "Res." text, "Record" text, "Opponent" text, "Method" text, "Event" text, "Round" real, "Time" text, "Location" text ) ### Question ### Which opponent has a Time of 1:34? ### Accurate SQL ###
SELECT "Opponent" FROM table_71198 WHERE "Time" = '1:34'
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 (opponents VARCHAR, year VARCHAR, outcome VARCHAR, surface VARCHAR, partner VARCHAR) ### Question ### Who were the opponents on grass when playing with Mark Woodforde, and the outcome of winner, and a year greater than 1996? ### Accurate SQL ###
SELECT opponents FROM table_name_61 WHERE surface = "grass" AND partner = "mark woodforde" AND outcome = "winner" AND year > 1996
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_22355_11 (rank VARCHAR, athlete VARCHAR) ### Question ### What rank did the nation with athlete peter snell category:articles with hcards have? ### Accurate SQL ###
SELECT COUNT(rank) FROM table_22355_11 WHERE athlete = "Peter Snell Category:Articles with hCards"
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_31793 ( "Rank" real, "Nation" text, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### What is the average value of Bronze when silver is 0 and the total is less than 1? ### Accurate SQL ###
SELECT AVG("Bronze") FROM table_31793 WHERE "Silver" = '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_name_42 ( unformatted_capacity_per_side VARCHAR, size VARCHAR ) ### Question ### What is the unformatted capacity per side if the size is 8in? ### Accurate SQL ###
SELECT unformatted_capacity_per_side FROM table_name_42 WHERE size = "8in"
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_18138132_2 ( developer VARCHAR, title VARCHAR ) ### Question ### Who is the developer for Windows live messenger? ### Accurate SQL ###
SELECT developer FROM table_18138132_2 WHERE title = "Windows Live Messenger"
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_206 ( id number, "saros" number, "member" number, "date" text, "time\n(greatest)\nutc" text, "type" text, "location\nlat,long" text, "gamma" number, "mag." number, "width\n(km)" number, "duration\n(min:sec)" text, "ref" number ) ### Question ### when did the first solar saros with a magnitude of greater than 1.00 occur ? ### Accurate SQL ###
SELECT "date" FROM table_204_206 WHERE "mag." > 1.00 ORDER BY "date" 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_14 (attendance VARCHAR, record VARCHAR) ### Question ### What was the attendance at the game when the record was 49-61? ### Accurate SQL ###
SELECT attendance FROM table_name_14 WHERE record = "49-61"
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_70 ( score VARCHAR, date VARCHAR ) ### Question ### Which score has a Date of october 29, 2008? ### Accurate SQL ###
SELECT score FROM table_name_70 WHERE date = "october 29, 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 submission ( Submission_ID int, Scores real, Author text, College text ) TABLE: CREATE TABLE Acceptance ( Submission_ID int, Workshop_ID int, Result text ) TABLE: CREATE TABLE workshop ( Workshop_ID int, Date text, Venue text, Name text ) ### Question ### Visualize a pie chart with how many workshops did each author submit to? Return the author name and the number of workshops. ### Accurate SQL ###
SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID
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_21422977_2 (ministries VARCHAR, duration VARCHAR) ### Question ### What is the ministries number when duration is 4 years, 4 days (1,465 days)? ### Accurate SQL ###
SELECT ministries FROM table_21422977_2 WHERE duration = "4 years, 4 days (1,465 days)"
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_57 (total INTEGER, gold INTEGER) ### Question ### What is the largest total that has a gold less than 0? ### Accurate SQL ###
SELECT MAX(total) FROM table_name_57 WHERE gold < 0
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_34 ( round INTEGER, college VARCHAR, pick VARCHAR ) ### Question ### What is the largest round of a pick smaller than 92 from Toledo University? ### Accurate SQL ###
SELECT MAX(round) FROM table_name_34 WHERE college = "toledo" AND pick < 92
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_Facilities ( apt_id INTEGER, facility_code CHAR(15) ) 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 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 ) 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 ) ### Question ### What are the number of start date of the apartment bookings made by female guests (gender code 'Female') for each year? Plot a bar chart, I want to order Y in descending order. ### Accurate SQL ###
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id WHERE T2.gender_code = "Female" ORDER BY COUNT(booking_start_date) 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_38316 ( "Date" text, "Opponent" text, "Score" text, "Loss" text, "Attendance" real, "Record" text ) ### Question ### What is the date of the match with a 28-15 record? ### Accurate SQL ###
SELECT "Date" FROM table_38316 WHERE "Record" = '28-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_name_51 ( album VARCHAR, number VARCHAR ) ### Question ### What is the 1st week sales for the album finding forever before the number 6? ### Accurate SQL ###
SELECT SUM(1 AS st_week_sales) FROM table_name_51 WHERE album = "finding forever" AND number < 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 table_38336 ( "Round" real, "Pick" real, "Player" text, "Position" text, "School" text ) ### Question ### What is the lowest round for the player whose position is guard and had a pick number smaller than 144? ### Accurate SQL ###
SELECT MIN("Round") FROM table_38336 WHERE "Position" = 'guard' AND "Pick" < '144'
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_64469 ( "Season" real, "Level" text, "Division" text, "Administration" text, "Position" text ) ### Question ### What Position has a Level of tier 4 with a Season smaller than 2003? ### Accurate SQL ###
SELECT "Position" FROM table_64469 WHERE "Level" = 'tier 4' AND "Season" < '2003'
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_38165 ( "Season" real, "Belonging league" text, "Matches" real, "Points" real, "Draw" real, "Lose" real, "Goal difference" real, "Goals For" real, "Goals Against" real, "Position" real ) ### Question ### What is the earliest season that has a position over 12? ### Accurate SQL ###
SELECT MIN("Season") FROM table_38165 WHERE "Position" > '12'
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_24399615_3 ( viewers INTEGER, airdate VARCHAR ) ### Question ### How many viewers were there for airdate is 22 october 2009? ### Accurate SQL ###
SELECT MAX(viewers) FROM table_24399615_3 WHERE airdate = "22 October 2009"
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_74632 ( "Club" text, "Total points" text, "Bonus points" text, "Match points" text, "Games" text, "Drawn" text, "Lost" text, "Points for" text, "Points against" text, "Diff" text ) ### Question ### How many bonus points did the Colomiers earn? ### Accurate SQL ###
SELECT "Bonus points" FROM table_74632 WHERE "Club" = 'colomiers'
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_41924 ( "Rank" real, "Name" text, "Team" text, "Games" real, "Points" real ) ### Question ### What is the sum of Rank, when Name is Will Solomon, and when Games is greater than 21? ### Accurate SQL ###
SELECT SUM("Rank") FROM table_41924 WHERE "Name" = 'will solomon' AND "Games" > '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 days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) 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_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id 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 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 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 city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar ) 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 equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text ) 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 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 time_interval ( period text, begin_time int, end_time int ) TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar ) 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 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 month ( month_number int, month_name text ) ### Question ### what flights are there on sunday from SEATTLE to MINNEAPOLIS ### 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 = 'MINNEAPOLIS' AND date_day.day_number = 27 AND date_day.month_number = 8 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 = 'SEATTLE' 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_50367 ( "Date" text, "Visitor" text, "Score" text, "Home" text, "Record" text ) ### Question ### Who was the home team when the record was 2-3? ### Accurate SQL ###
SELECT "Home" FROM table_50367 WHERE "Record" = '2-3'
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_73608 ( "County" text, "Kerry%" text, "Kerry#" real, "Bush%" text, "Bush#" real, "Others%" text, "Others#" real ) ### Question ### How many different counts of the votes for Bush are there in the county where he got 69.7% of the votes? ### Accurate SQL ###
SELECT COUNT("Bush#") FROM table_73608 WHERE "Bush%" = '69.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 table_11970 ( "CERCLIS ID" text, "Name" text, "County" text, "Partially deleted" text, "Deleted" text ) ### Question ### Which Superfund site has the CERCLIS ID fld980494959? ### Accurate SQL ###
SELECT "Partially deleted" FROM table_11970 WHERE "CERCLIS ID" = 'fld980494959'
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### what is diagnoses short title and procedure long title of subject id 3623? ### Accurate SQL ###
SELECT diagnoses.short_title, procedures.long_title FROM diagnoses INNER JOIN procedures ON diagnoses.hadm_id = procedures.hadm_id WHERE diagnoses.subject_id = "3623"
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_19350 ( "Pos" real, "Member Association" text, "Points (total 500)" real, "Clubs" text, "Group stage" real, "Play-off" real, "AFC Cup" real ) ### Question ### what is the maximum value for afc cup ### Accurate SQL ###
SELECT MAX("AFC Cup") FROM table_19350
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_94 ( years_exp VARCHAR, height VARCHAR ) ### Question ### What is Years Exp, when Height is '7-2'? ### Accurate SQL ###
SELECT years_exp FROM table_name_94 WHERE height = "7-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_14960574_6 (german_voice_actor VARCHAR, french_voice_actor VARCHAR) ### Question ### Name the german voice actor for alain dorval ### Accurate SQL ###
SELECT german_voice_actor FROM table_14960574_6 WHERE french_voice_actor = "Alain Dorval"
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_2 ( opponent VARCHAR, week INTEGER ) ### Question ### Who did the Jets play in their post-week 15 game? ### Accurate SQL ###
SELECT opponent FROM table_name_2 WHERE week > 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_name_53 (cuts_made VARCHAR, events VARCHAR, top_5 VARCHAR, top_25 VARCHAR) ### Question ### Which Cuts made has a Top-5 smaller than 3, and a Top-25 smaller than 6, and an Events of 10? ### Accurate SQL ###
SELECT cuts_made FROM table_name_53 WHERE top_5 < 3 AND top_25 < 6 AND events = 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 table_56753 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### What did the home team score against the away team Hawthorn? ### Accurate SQL ###
SELECT "Home team score" FROM table_56753 WHERE "Away team" = 'hawthorn'
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_92 (length INTEGER, taper VARCHAR, large_end VARCHAR) ### Question ### Which Length has a Taper of #15, and a Large end larger than 1.875? ### Accurate SQL ###
SELECT MAX(length) FROM table_name_92 WHERE taper = "#15" AND large_end > 1.875
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_57092 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text ) ### Question ### How many people were in attendance at Hawthorn's home match? ### Accurate SQL ###
SELECT MIN("Crowd") FROM table_57092 WHERE "Home team" = 'hawthorn'
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 airline ( airline_code varchar, airline_name text, note 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 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 dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text ) 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 compartment_class ( compartment varchar, class_type varchar ) TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar ) TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar ) TABLE: CREATE TABLE days ( days_code varchar, day_name varchar ) TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int ) 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 state ( state_code text, state_name text, country_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 class_of_service ( booking_class varchar, rank int, class_description text ) TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int ) TABLE: CREATE TABLE month ( month_number int, month_name text ) 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 airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int ) 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 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 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 ground_service ( city_code text, airport_code text, transport_type text, ground_fare int ) TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int ) ### Question ### what is the airfare for flights from DENVER to PITTSBURGH on DL ### Accurate SQL ###
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PITTSBURGH' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight_fare.fare_id = fare.fare_id AND flight.airline_code = 'DL' AND flight.flight_id = flight_fare.flight_id
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 ### Give me the comparison about the sum of meter_100 over the meter_200 , and group by attribute meter_200 by a bar chart, list x-axis in descending order. ### Accurate SQL ###
SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 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_6109 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Game site" text, "Attendance" text ) ### Question ### Name the opponent for week of 2 ### Accurate SQL ###
SELECT "Opponent" FROM table_6109 WHERE "Week" = '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_203_862 ( id number, "draw" number, "artist" text, "song" text, "points" number, "place" text ) ### Question ### what are the number of times an artist earned first place ? ### Accurate SQL ###
SELECT COUNT(*) FROM table_203_862 WHERE "place" = 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 prereq (title VARCHAR, course_id VARCHAR) TABLE: CREATE TABLE course (title VARCHAR, course_id VARCHAR) ### Question ### Find the name of the courses that do not have any prerequisite? ### Accurate SQL ###
SELECT title FROM course WHERE NOT course_id IN (SELECT course_id FROM prereq)
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_25 (wins INTEGER, scored VARCHAR, conceded VARCHAR) ### Question ### What is the number of wins when scored was less than 26, and conceded was larger than 23? ### Accurate SQL ###
SELECT SUM(wins) FROM table_name_25 WHERE scored < 26 AND conceded > 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 countries (country_name VARCHAR, country_id VARCHAR) TABLE: CREATE TABLE departments (department_id VARCHAR, location_id VARCHAR) TABLE: CREATE TABLE locations (location_id VARCHAR, country_id VARCHAR) TABLE: CREATE TABLE employees (first_name VARCHAR, last_name VARCHAR, employee_id VARCHAR, department_id VARCHAR) ### Question ### display the full name (first and last name ) of employee with ID and name of the country presently where (s)he is working. ### Accurate SQL ###
SELECT T1.first_name, T1.last_name, T1.employee_id, T4.country_name FROM employees AS T1 JOIN departments AS T2 ON T1.department_id = T2.department_id JOIN locations AS T3 ON T2.location_id = T3.location_id JOIN countries AS T4 ON T3.country_id = T4.country_id
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_57230 ( "Years" text, "Engine" text, "Power" text, "Torque" text, "Notes" text ) ### Question ### what is the years for engin 5.7l hemi v8? ### Accurate SQL ###
SELECT "Years" FROM table_57230 WHERE "Engine" = '5.7l hemi v8'
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 (obama VARCHAR, undecided VARCHAR) ### Question ### What kind of Obama has a Undecided of 1%? ### Accurate SQL ###
SELECT obama FROM table_name_87 WHERE undecided = "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_87 (cultural_and_educational_panel INTEGER, administrative_panel VARCHAR, agricultural_panel VARCHAR) ### Question ### What is the sum of the cultural and educational panel value with an administrative panel of 0 and an agricultural panel value less than 0? ### Accurate SQL ###
SELECT SUM(cultural_and_educational_panel) FROM table_name_87 WHERE administrative_panel = 0 AND agricultural_panel < 0
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 Catalog_Contents_Additional_Attributes ( catalog_entry_id INTEGER, catalog_level_number INTEGER, attribute_id INTEGER, attribute_value VARCHAR(255) ) TABLE: CREATE TABLE Catalog_Contents ( catalog_entry_id INTEGER, catalog_level_number INTEGER, parent_entry_id INTEGER, previous_entry_id INTEGER, next_entry_id INTEGER, catalog_entry_name VARCHAR(80), product_stock_number VARCHAR(50), price_in_dollars DOUBLE, price_in_euros DOUBLE, price_in_pounds DOUBLE, capacity VARCHAR(20), length VARCHAR(20), height VARCHAR(20), width VARCHAR(20) ) TABLE: CREATE TABLE Catalogs ( catalog_id INTEGER, catalog_name VARCHAR(50), catalog_publisher VARCHAR(80), date_of_publication DATETIME, date_of_latest_revision DATETIME ) TABLE: CREATE TABLE Attribute_Definitions ( attribute_id INTEGER, attribute_name VARCHAR(30), attribute_data_type VARCHAR(10) ) TABLE: CREATE TABLE Catalog_Structure ( catalog_level_number INTEGER, catalog_id INTEGER, catalog_level_name VARCHAR(50) ) ### Question ### Which attribute definitions have attribute value 0? Give me the number of attributes in each attribute name, I want to show from high to low by the X. ### Accurate SQL ###
SELECT attribute_name, COUNT(attribute_name) FROM Attribute_Definitions AS t1 JOIN Catalog_Contents_Additional_Attributes AS t2 ON t1.attribute_id = t2.attribute_id WHERE t2.attribute_value = 0 GROUP BY attribute_name ORDER BY attribute_name 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 regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,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 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) ) ### Question ### For those employees who did not have any job in the past, show me about the distribution of hire_date and the sum of employee_id bin hire_date by time in a bar chart. ### Accurate SQL ###
SELECT HIRE_DATE, SUM(EMPLOYEE_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_12119 ( "Mininera DFL" text, "Wins" real, "Byes" real, "Losses" real, "Draws" real, "Against" real ) ### Question ### WHAT IS THE HIGHEST WINS WITH AGAINST SMALLER THAN 924, LOSSES SMALLER THAN 2? ### Accurate SQL ###
SELECT MAX("Wins") FROM table_12119 WHERE "Against" < '924' AND "Losses" < '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 lapTimes ( raceId INTEGER, driverId INTEGER, lap INTEGER, position INTEGER, time TEXT, milliseconds INTEGER ) TABLE: CREATE TABLE results ( resultId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, grid INTEGER, position TEXT, positionText TEXT, positionOrder INTEGER, points REAL, laps TEXT, time TEXT, milliseconds TEXT, fastestLap TEXT, rank TEXT, fastestLapTime TEXT, fastestLapSpeed TEXT, statusId INTEGER ) TABLE: CREATE TABLE status ( statusId INTEGER, status TEXT ) TABLE: CREATE TABLE constructorStandings ( constructorStandingsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) TABLE: CREATE TABLE seasons ( year INTEGER, url TEXT ) TABLE: CREATE TABLE qualifying ( qualifyId INTEGER, raceId INTEGER, driverId INTEGER, constructorId INTEGER, number INTEGER, position INTEGER, q1 TEXT, q2 TEXT, q3 TEXT ) TABLE: CREATE TABLE circuits ( circuitId INTEGER, circuitRef TEXT, name TEXT, location TEXT, country TEXT, lat REAL, lng REAL, alt TEXT, url TEXT ) TABLE: CREATE TABLE driverStandings ( driverStandingsId INTEGER, raceId INTEGER, driverId INTEGER, points REAL, position INTEGER, positionText TEXT, wins INTEGER ) TABLE: CREATE TABLE drivers ( driverId INTEGER, driverRef TEXT, number TEXT, code TEXT, forename TEXT, surname TEXT, dob TEXT, nationality TEXT, url TEXT ) TABLE: CREATE TABLE races ( raceId INTEGER, year INTEGER, round INTEGER, circuitId INTEGER, name TEXT, date TEXT, time TEXT, url TEXT ) TABLE: CREATE TABLE constructorResults ( constructorResultsId INTEGER, raceId INTEGER, constructorId INTEGER, points REAL, status TEXT ) TABLE: CREATE TABLE constructors ( constructorId INTEGER, constructorRef TEXT, name TEXT, nationality TEXT, url TEXT ) TABLE: CREATE TABLE pitStops ( raceId INTEGER, driverId INTEGER, stop INTEGER, lap INTEGER, time TEXT, duration TEXT, milliseconds INTEGER ) ### Question ### What are the number of the names of all races held between 2009 and 2011?, display by the y-axis from high to low. ### Accurate SQL ###
SELECT name, COUNT(name) FROM races WHERE year BETWEEN 2009 AND 2011 GROUP BY name ORDER BY COUNT(name) 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 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 ### what is admission time of subject id 29961? ### Accurate SQL ###
SELECT demographic.admittime FROM demographic WHERE demographic.subject_id = "29961"
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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### what is the number of patients whose lab test abnormal status is abnormal and lab test name is magnesium, urine? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "Magnesium, Urine"
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_21564794_3 ( championships_in_st_louis VARCHAR, sport VARCHAR ) ### Question ### How many championships were won for arena football? ### Accurate SQL ###
SELECT championships_in_st_louis FROM table_21564794_3 WHERE sport = "Arena Football"
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_73198 ( "No." real, "Title" text, "Directed by" text, "Written by" text, "Original air date" text, "Production code" real, "Television order" text ) ### Question ### what is the the television order of 'deep cover for batman! ### Accurate SQL ###
SELECT "Television order" FROM table_73198 WHERE "Title" = 'Deep Cover for Batman!'
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_66 (score VARCHAR, home_team VARCHAR) ### Question ### what is the score when the home team is king's lynn? ### Accurate SQL ###
SELECT score FROM table_name_66 WHERE home_team = "king's lynn"
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_88 (to_par INTEGER, player VARCHAR, total VARCHAR) ### Question ### With a Total of more than 149, what is Davis Love III's To par? ### Accurate SQL ###
SELECT AVG(to_par) FROM table_name_88 WHERE player = "davis love iii" AND total > 149
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_67 ( organized VARCHAR, occupation VARCHAR ) ### Question ### What is the organized date of the stake with an occupation of senior buyer for Wal-mart? ### Accurate SQL ###
SELECT organized FROM table_name_67 WHERE occupation = "senior buyer for wal-mart"
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 (venue VARCHAR, opposing_team VARCHAR, round VARCHAR) ### Question ### Which Venue has an Opposing Team of manchester united, and a Round of 5th round replay? ### Accurate SQL ###
SELECT venue FROM table_name_79 WHERE opposing_team = "manchester united" AND round = "5th round replay"
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_train_171 ( "id" int, "systolic_blood_pressure_sbp" int, "hiv_infection" bool, "hemoglobin_a1c_hba1c" float, "hepatitis_c" bool, "diastolic_blood_pressure_dbp" int, "body_mass_index_bmi" float, "triglyceride_tg" float, "NOUSE" float ) ### Question ### 6.5 % < hba1c < 11 % ### Accurate SQL ###
SELECT * FROM table_train_171 WHERE hemoglobin_a1c_hba1c > 6.5 AND hemoglobin_a1c_hba1c < 11
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_27 (score VARCHAR, location_attendance VARCHAR, game VARCHAR) ### Question ### What is Score, when Location Attendance is "US Airways Center 18,422", and when Game is less than 22? ### Accurate SQL ###
SELECT score FROM table_name_27 WHERE location_attendance = "us airways center 18,422" AND game < 22
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_3698 ( "Position" text, "Nationality" text, "Name" text, "League apps" real, "League goals" real, "FA Cup apps" real, "FA Cup goals" real, "Total apps" real, "Total goals" real ) ### Question ### Name the total apps for league apps being 4 ### Accurate SQL ###
SELECT "Total apps" FROM table_3698 WHERE "League apps" = '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_24353141_1 (original_3rd_us_tour_cast VARCHAR, original_uk_cast VARCHAR) ### Question ### How many original 3rd us tour cast were there while the original uk cast was alyssa dipalma? ### Accurate SQL ###
SELECT COUNT(original_3rd_us_tour_cast) FROM table_24353141_1 WHERE original_uk_cast = "Alyssa DiPalma"
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_71955 ( "Year" text, "Start" text, "Qual" text, "Rank" text, "Finish" text, "Laps" real ) ### Question ### What's the smallest amount of Laps that had a finish of 7 with a start of 6? ### Accurate SQL ###
SELECT MIN("Laps") FROM table_71955 WHERE "Finish" = '7' AND "Start" = '6'