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_name_96 (country VARCHAR, player VARCHAR) ### Question ### What is Country, when Player is "Hale Irwin"? ### Accurate SQL ###
SELECT country FROM table_name_96 WHERE player = "hale irwin"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_19 ( week INTEGER, result VARCHAR ) ### Question ### What is the lowest Week when the result was l 6 0? ### Accurate SQL ###
SELECT MIN(week) FROM table_name_19 WHERE result = "l 6–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_30 ( sub_parish__sokn_ VARCHAR, year_built VARCHAR, location_of_the_church VARCHAR ) ### Question ### What is the Sub-Parish (Sokn) that was built in 1957 in the location of Stavang? ### Accurate SQL ###
SELECT sub_parish__sokn_ FROM table_name_30 WHERE year_built = "1957" AND location_of_the_church = "stavang"
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_49637 ( "Rank" real, "1-year peak" text, "5-year peak" text, "10-year peak" text, "15-year peak" text, "20-year peak" text ) ### Question ### What is the 1-year peak with anatoly karpov, 2821 as the 10-year peak? ### Accurate SQL ###
SELECT "1-year peak" FROM table_49637 WHERE "10-year peak" = 'anatoly karpov, 2821'
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_10650711_1 (nfl_team VARCHAR, player VARCHAR) ### Question ### what's the nfl team where player is clifford charlton ### Accurate SQL ###
SELECT nfl_team FROM table_10650711_1 WHERE player = "Clifford Charlton"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_35 ( pba_team VARCHAR, pick VARCHAR ) ### Question ### What is the PBA team with a Pick that is 4? ### Accurate SQL ###
SELECT pba_team FROM table_name_35 WHERE pick = 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_203_89 ( id number, "#" number, "name\n(birth-death)" text, "took office" text, "left office" text, "monarch" text, "prime minister" text ) ### Question ### who took office after the earl of athlone ? ### Accurate SQL ###
SELECT "name\n(birth-death)" FROM table_203_89 WHERE "took office" > (SELECT "took office" FROM table_203_89 WHERE "name\n(birth-death)" = 'the earl of athlone') ORDER BY "took office" 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 wrestler ( Wrestler_ID int, Name text, Reign text, Days_held text, Location text, Event text ) TABLE: CREATE TABLE Elimination ( Elimination_ID text, Wrestler_ID text, Team text, Eliminated_By text, Elimination_Move text, Time text ) ### Question ### What is the number of their teams in elimination? Draw a bar chart, and I want to list by the y-axis from high to low. ### Accurate SQL ###
SELECT Team, COUNT(Team) FROM Elimination GROUP BY Team ORDER BY COUNT(Team) 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_29968 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text, "Position in table" text ) ### Question ### Which manager was replaced by Thomas Thomasberg? ### Accurate SQL ###
SELECT "Outgoing manager" FROM table_29968 WHERE "Replaced by" = 'Thomas Thomasberg'
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 Lives_in ( stuid INTEGER, dormid INTEGER, room_number INTEGER ) TABLE: CREATE TABLE Student ( StuID INTEGER, LName VARCHAR(12), Fname VARCHAR(12), Age INTEGER, Sex VARCHAR(1), Major INTEGER, Advisor INTEGER, city_code VARCHAR(3) ) TABLE: CREATE TABLE Dorm_amenity ( amenid INTEGER, amenity_name VARCHAR(25) ) TABLE: CREATE TABLE Has_amenity ( dormid INTEGER, amenid INTEGER ) TABLE: CREATE TABLE Dorm ( dormid INTEGER, dorm_name VARCHAR(20), student_capacity INTEGER, gender VARCHAR(1) ) ### Question ### Find the number of students whose age is older than the average age for each gender. ### Accurate SQL ###
SELECT Sex, COUNT(*) FROM Student WHERE Age > (SELECT AVG(Age) FROM Student) GROUP BY Sex
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_21501565_1 ( original_artist VARCHAR, order__number VARCHAR, theme VARCHAR ) ### Question ### With order number 7 and the theme is Motown, who were the original artists? ### Accurate SQL ###
SELECT original_artist FROM table_21501565_1 WHERE order__number = "7" AND theme = "Motown"
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_20903658_1 (medium VARCHAR, artist VARCHAR) ### Question ### What medium was used for the sculpture by Ernest Richard Gause? ### Accurate SQL ###
SELECT medium FROM table_20903658_1 WHERE artist = "Ernest Richard Gause"
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 tourist_attraction_features ( tourist_attraction_id number, feature_id number ) TABLE: CREATE TABLE shops ( shop_id number, shop_details text ) TABLE: CREATE TABLE locations ( location_id number, location_name text, address text, other_details text ) TABLE: CREATE TABLE theme_parks ( theme_park_id number, theme_park_details text ) TABLE: CREATE TABLE tourist_attractions ( tourist_attraction_id number, attraction_type_code text, location_id number, how_to_get_there text, name text, description text, opening_hours text, other_details text ) TABLE: CREATE TABLE features ( feature_id number, feature_details text ) TABLE: CREATE TABLE ref_attraction_types ( attraction_type_code text, attraction_type_description text ) TABLE: CREATE TABLE ref_hotel_star_ratings ( star_rating_code text, star_rating_description text ) TABLE: CREATE TABLE hotels ( hotel_id number, star_rating_code text, pets_allowed_yn text, price_range number, other_hotel_details text ) TABLE: CREATE TABLE visitors ( tourist_id number, tourist_details text ) TABLE: CREATE TABLE street_markets ( market_id number, market_details text ) TABLE: CREATE TABLE museums ( museum_id number, museum_details text ) TABLE: CREATE TABLE staff ( staff_id number, tourist_attraction_id number, name text, other_details text ) TABLE: CREATE TABLE royal_family ( royal_family_id number, royal_family_details text ) TABLE: CREATE TABLE visits ( visit_id number, tourist_attraction_id number, tourist_id number, visit_date time, visit_details text ) TABLE: CREATE TABLE photos ( photo_id number, tourist_attraction_id number, name text, description text, filename text, other_details text ) ### Question ### Show the details and star ratings of the 3 least expensive hotels. ### Accurate SQL ###
SELECT other_hotel_details, star_rating_code FROM hotels ORDER BY price_range LIMIT 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_name_47 (draw INTEGER, against VARCHAR, losses VARCHAR, matches VARCHAR) ### Question ### How many draws have less than 35 losses with 136 matches and less than 146 against? ### Accurate SQL ###
SELECT AVG(draw) FROM table_name_47 WHERE losses < 35 AND matches = 136 AND against < 146
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_76535 ( "Scorer" text, "Club" text, "League goals" text, "FA Cup goals" text, "League Cup goals" real, "Texaco Cup goals" text, "Euro competitions" text, "Total" real ) ### Question ### What is the lowest League Cup Goals, when Scorer is Denis Law? ### Accurate SQL ###
SELECT MIN("League Cup goals") FROM table_76535 WHERE "Scorer" = 'denis law'
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_79639 ( "Round" real, "Date" text, "Home Team" text, "Away Team" text, "Attendance" real, "Stadium" text ) ### Question ### What is the round when 11,117 people attended the game on 26 October 2008? ### Accurate SQL ###
SELECT SUM("Round") FROM table_79639 WHERE "Attendance" < '11,117' AND "Date" = '26 october 2008'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_20 (date VARCHAR, home_team VARCHAR) ### Question ### On what date did Collingwood play at home? ### Accurate SQL ###
SELECT date FROM table_name_20 WHERE home_team = "collingwood"
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_17598822_11 (challenge_cup INTEGER, player VARCHAR) ### Question ### Name the most challenge cup for damon gray ### Accurate SQL ###
SELECT MAX(challenge_cup) FROM table_17598822_11 WHERE player = "Damon Gray"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 (number_of_households VARCHAR, median_family_income VARCHAR) ### Question ### What Number of households have a Median family income of $58,491? ### Accurate SQL ###
SELECT number_of_households FROM table_name_73 WHERE median_family_income = "$58,491"
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_41 ( score VARCHAR, home VARCHAR, visitor VARCHAR ) ### Question ### What was the score from the game where Dallas played Home and Edmonton was visiting? ### Accurate SQL ###
SELECT score FROM table_name_41 WHERE home = "dallas" AND visitor = "edmonton"
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 PostTags ( PostId number, TagId 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) 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 CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) TABLE: CREATE TABLE PostTypes ( Id number, Name text ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskTypes ( 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId 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 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) ### Question ### All suggested edits for a specific post. ### Accurate SQL ###
SELECT * FROM Posts WHERE OwnerUserId = 927626
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 store_district ( Store_ID int, District_ID int ) TABLE: CREATE TABLE product ( product_id int, product text, dimensions text, dpi real, pages_per_minute_color real, max_page_size text, interface text ) TABLE: CREATE TABLE store_product ( Store_ID int, Product_ID int ) TABLE: CREATE TABLE store ( Store_ID int, Store_Name text, Type text, Area_size real, Number_of_product_category real, Ranking int ) TABLE: CREATE TABLE district ( District_ID int, District_name text, Headquartered_City text, City_Population real, City_Area real ) ### Question ### Find all types of store and number of them Visualize by bar chart, could you sort x axis in desc order please? ### Accurate SQL ###
SELECT Type, COUNT(*) FROM store GROUP BY Type ORDER BY Type 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_42677 ( "Team 1" text, "Agg." text, "Team 2" text, "1st leg" text, "2nd leg" text ) ### Question ### What was the 1st leg score for the match with Lesotho as team 1? ### Accurate SQL ###
SELECT "1st leg" FROM table_42677 WHERE "Team 1" = 'lesotho'
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 PostTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name 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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number ) TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) 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 FlagTypes ( 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) ### Question ### Most frequently asked (not answered) questions. ### Accurate SQL ###
SELECT a.Id AS "post_link", b.NumberOfDuplicates FROM Posts AS a LEFT JOIN (SELECT Posts.Id, COUNT(PostLinks.RelatedPostId) AS NumberOfDuplicates FROM Posts, PostLinks WHERE Posts.Id = PostLinks.RelatedPostId AND PostLinks.LinkTypeId = 3 GROUP BY Posts.Id) AS b ON a.Id = b.Id WHERE Tags LIKE '%python%' AND Tags LIKE '%regex%' ORDER BY b.NumberOfDuplicates DESC LIMIT 100
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_12 ( tally VARCHAR, opposition VARCHAR, total VARCHAR ) ### Question ### What is the tally when the opposition is Derry, and total is 14? ### Accurate SQL ###
SELECT tally FROM table_name_12 WHERE opposition = "derry" AND total = 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_50233 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text ) ### Question ### What is the score of player bill rogers? ### Accurate SQL ###
SELECT "Score" FROM table_50233 WHERE "Player" = 'bill rogers'
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_189 ( "id" int, "alt" float, "hyperglycemia" bool, "liver_disease" bool, "smoking" bool, "alcohol_abuse" bool, "drug_abuse" bool, "triglyceride_tg" float, "NOUSE" float ) ### Question ### chronic or persistent alcohol or drug abuse ### Accurate SQL ###
SELECT * FROM table_train_189 WHERE alcohol_abuse = 1 OR drug_abuse = 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 ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE CloseReasonTypes ( 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 PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other ) TABLE: CREATE TABLE 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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId 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 FlagTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTaskStates ( 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 PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number ) TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) TABLE: CREATE TABLE 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 PostTypes ( Id number, Name text ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) ### Question ### Activity by hour of day. ### Accurate SQL ###
SELECT TIME_TO_STR(CreationDate, '%h'), 'Questions', COUNT(*) FROM Posts WHERE PostTypeId = 1 GROUP BY TIME_TO_STR(CreationDate, '%h') UNION SELECT TIME_TO_STR(CreationDate, '%h'), 'Answers', COUNT(*) FROM Posts WHERE PostTypeId = 2 GROUP BY TIME_TO_STR(CreationDate, '%h') UNION SELECT TIME_TO_STR(CreationDate, '%h'), 'Comments/3', COUNT(*) / 3 FROM Comments GROUP BY TIME_TO_STR(CreationDate, '%h') UNION SELECT TIME_TO_STR(CreationDate, '%h'), 'Post Events/5', COUNT(*) / 5 FROM PostHistory GROUP BY TIME_TO_STR(CreationDate, '%h')
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 ( award VARCHAR, year VARCHAR, result VARCHAR ) ### Question ### What is the name of the award in a year more than 2005, and the Result of nominated? ### Accurate SQL ###
SELECT award FROM table_name_17 WHERE year > 2005 AND result = "nominated"
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_33478 ( "Season" real, "Coach" text, "Record as played" text, "Actual adjusted record" text, "Regular season Vacated" text ) ### Question ### What is the average Season for coach Fisher, and an actual adjusted record of 0 11? ### Accurate SQL ###
SELECT AVG("Season") FROM table_33478 WHERE "Coach" = 'fisher' AND "Actual adjusted record" = '0–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_39675 ( "Date" text, "City" text, "Opponent" text, "Results\u00b9" text, "Type of game" text ) ### Question ### What was the result of the Euro '64 qualifying game? ### Accurate SQL ###
SELECT "Results\u00b9" FROM table_39675 WHERE "Type of game" = 'euro ''64 qualifying'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_73 (home VARCHAR, date VARCHAR) ### Question ### Who was home on November 26? ### Accurate SQL ###
SELECT home FROM table_name_73 WHERE date = "november 26"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_20 ( township VARCHAR, latitude VARCHAR, land___sqmi__ VARCHAR, geo_id VARCHAR ) ### Question ### what is the township when the land (sqmi) is more than 36.112, the geo id is higher than 3801985060 and the latitude is 46.062384? ### Accurate SQL ###
SELECT township FROM table_name_20 WHERE land___sqmi__ > 36.112 AND geo_id > 3801985060 AND latitude = 46.062384
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 diagnoses ( 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### count the number of patients whose death status is 0 and diagnoses short title is angioneurotic edema? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "0" AND diagnoses.short_title = "Angioneurotic edema"
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_1976898_1 (pinyin VARCHAR, post_code VARCHAR) ### Question ### What's the Pinyin name of the county with a postcode 246500? ### Accurate SQL ###
SELECT pinyin FROM table_1976898_1 WHERE post_code = 246500
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 diagnoses ( 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 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 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 procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### provide the number of patients whose diagnoses short title is hemododialysis hypotensn and drug type is main? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Hemododialysis hypotensn" AND prescriptions.drug_type = "MAIN"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE 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 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 ) 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 ### give me the number of patients whose diagnoses long title is persistent postoperative fistula and lab test category is blood gas? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Persistent postoperative fistula" AND lab."CATEGORY" = "Blood Gas"
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_17404 ( "Vendor and type" text, "Models" text, "NetFlow Version" text, "Implementation" text, "Comments" text ) ### Question ### What are the comments when vendor and type is enterasys switches? ### Accurate SQL ###
SELECT "Comments" FROM table_17404 WHERE "Vendor and type" = 'Enterasys Switches'
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 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 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 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 ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### how many of the patients aged below 61 had hypothyroidism nos? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "61" AND diagnoses.short_title = "Hypothyroidism NOS"
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_31701 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Attendance" real ) ### Question ### Tell me the total number of attendance for week of 16 ### Accurate SQL ###
SELECT COUNT("Attendance") FROM table_31701 WHERE "Week" = '16'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_49845 ( "Round" real, "Player" text, "Position" text, "Nationality" text, "College/Junior/Club Team (League)" text ) ### Question ### What is Position, when Nationality is 'Canada', and when Round is greater than 3? ### Accurate SQL ###
SELECT "Position" FROM table_49845 WHERE "Nationality" = 'canada' AND "Round" > '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 d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) ### Question ### what is the number of days that have passed since the last time patient 28443 received a d5w intake on the current intensive care unit visit? ### Accurate SQL ###
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', inputevents_cv.charttime)) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 28443) AND icustays.outtime IS NULL) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5w' AND d_items.linksto = 'inputevents_cv') ORDER BY inputevents_cv.charttime DESC LIMIT 1
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_54 ( team VARCHAR, driver VARCHAR, schedule VARCHAR, year VARCHAR ) ### Question ### what is the team when the schedule is limited, year is earlier than 2007 and the driver is jason white? ### Accurate SQL ###
SELECT team FROM table_name_54 WHERE schedule = "limited" AND year < 2007 AND driver = "jason white"
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 diagnoses ( 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 prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### provide the number of emergency hospital admission patients who had diagnostic ultrasound of heart. ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.long_title = "Diagnostic ultrasound of heart"
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_33908 ( "Tournament" text, "2002" text, "2004" text, "2005" text, "2006" text, "2007" text, "2008" text, "2009" text, "2010" text, "2011" text, "2012" text, "2013" text ) ### Question ### Which 2013 has a 2010 of 1r? ### Accurate SQL ###
SELECT "2013" FROM table_33908 WHERE "2010" = '1r'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_95 ( tournament VARCHAR ) ### Question ### What was the value in 1995 for A in 2000 at the Indian Wells tournament? ### Accurate SQL ###
SELECT 1995 FROM table_name_95 WHERE 2000 = "a" AND tournament = "indian wells"
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 ( matches VARCHAR, rank VARCHAR ) ### Question ### Which Matches have a Rank of 2? ### Accurate SQL ###
SELECT COUNT(matches) FROM table_name_94 WHERE rank = 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_29436059_1 ( title VARCHAR, no_in_season VARCHAR ) ### Question ### What is the title of episode 10? ### Accurate SQL ###
SELECT title FROM table_29436059_1 WHERE no_in_season = 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_41213 ( "Rank" real, "Name" text, "Years" text, "Matches" real, "Goals" real ) ### Question ### In what years was there a rank lower than 9, under 84 goals, and more than 158 matches? ### Accurate SQL ###
SELECT "Years" FROM table_41213 WHERE "Matches" > '158' AND "Rank" > '9' AND "Goals" < '84'
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_65000 ( "Date" text, "Venue" text, "Score" text, "Comp" text, "Report" text ) ### Question ### What is the Report on November 15, 2000? ### Accurate SQL ###
SELECT "Report" FROM table_65000 WHERE "Date" = 'november 15, 2000'
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_24039597_26 ( dismissals VARCHAR, matches VARCHAR ) ### Question ### How many matches were 44? ### Accurate SQL ###
SELECT COUNT(dismissals) FROM table_24039597_26 WHERE matches = 44
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_53890 ( "Tournament" text, "Winner" text, "Runner-up" text, "Score" text, "Third Place" text ) ### Question ### what is the score when the runner-up is richard krajicek? ### Accurate SQL ###
SELECT "Score" FROM table_53890 WHERE "Runner-up" = 'richard krajicek'
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_83 ( march VARCHAR, year VARCHAR, average_monthly_additions_in_millions_ VARCHAR, january VARCHAR, december VARCHAR ) ### Question ### What was the total number for March with less than 8.77 in January, more than 1.69 in December, an average monthly addition less than 5.35, and before 2004? ### Accurate SQL ###
SELECT COUNT(march) FROM table_name_83 WHERE january < 8.77 AND december > 1.69 AND average_monthly_additions_in_millions_ < 5.35 AND year < 2004
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_692 ( id number, "publication" text, "score" text, "review" text ) ### Question ### which publication only received a letter score ? ### Accurate SQL ###
SELECT "publication" FROM table_204_692 WHERE "score" 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_73 ( architecture VARCHAR, original_vehicle VARCHAR ) ### Question ### What architecture type does the Ford Escort Wagon have? ### Accurate SQL ###
SELECT architecture FROM table_name_73 WHERE original_vehicle = "ford escort wagon"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_86 (venue VARCHAR, date VARCHAR) ### Question ### Which venue was used 22 january 2008? ### Accurate SQL ###
SELECT venue FROM table_name_86 WHERE date = "22 january 2008"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_1875157_1 ( winnings VARCHAR, position VARCHAR ) ### Question ### How many wins in the season he finished 33rd ### Accurate SQL ###
SELECT winnings FROM table_1875157_1 WHERE position = "33rd"
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_36 ( overall INTEGER, name VARCHAR ) ### Question ### what was the overall pick number for rich dobbert? ### Accurate SQL ###
SELECT AVG(overall) FROM table_name_36 WHERE name = "rich dobbert"
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_76 (iata VARCHAR, icao VARCHAR) ### Question ### What is RJCM's IATA? ### Accurate SQL ###
SELECT iata FROM table_name_76 WHERE icao = "rjcm"
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_28863 ( "Year" real, "Competition" text, "Location" text, "Apparatus" text, "Rank-Final" real, "Score-Final" text, "Rank-Qualifying" real, "Score-Qualifying" text ) ### Question ### Where did the event with a final score of 15.050 occur? ### Accurate SQL ###
SELECT "Location" FROM table_28863 WHERE "Score-Final" = '15.050'
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 Manufacturers ( Code INTEGER, Name VARCHAR(255), Headquarter VARCHAR(255), Founder VARCHAR(255), Revenue REAL ) TABLE: CREATE TABLE Products ( Code INTEGER, Name VARCHAR(255), Price DECIMAL, Manufacturer INTEGER ) ### Question ### For those records from the products and each product's manufacturer, draw a bar chart about the distribution of headquarter and the average of code , and group by attribute headquarter, order Y from low to high order. ### Accurate SQL ###
SELECT T2.Headquarter, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Headquarter ORDER BY T1.Code
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_51 (pos VARCHAR, postseason VARCHAR, tier VARCHAR) ### Question ### How many teams were promoted in the postseason in a tier above 2? ### Accurate SQL ###
SELECT COUNT(pos) FROM table_name_51 WHERE postseason = "promoted" AND tier < 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_15187735_17 (segment_a VARCHAR, segment_d VARCHAR) ### Question ### how many segments involve wood boring augers ### Accurate SQL ###
SELECT segment_a FROM table_15187735_17 WHERE segment_d = "Wood Boring Augers"
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_44026 ( "Date" text, "Home" text, "Score" text, "Away" text, "Attendance" real ) ### Question ### Who was the home team when the score was 0:1? ### Accurate SQL ###
SELECT "Home" FROM table_44026 WHERE "Score" = '0: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_37272 ( "Name" text, "Date" text, "Goals" real, "Assists" real, "Team" text, "Venue" text, "Opponent" text, "Competition" text, "Total Goals" real, "Total Assists" real ) ### Question ### What competition had more than 40 assists? ### Accurate SQL ###
SELECT "Competition" FROM table_37272 WHERE "Assists" > '40'
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_83 ( venue VARCHAR, year VARCHAR, position VARCHAR ) ### Question ### Name the venue for 2nd position of year before 2008 ### Accurate SQL ###
SELECT venue FROM table_name_83 WHERE year < 2008 AND position = "2nd"
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_74449 ( "Rank" real, "Rider" text, "Sat 20 Aug" text, "Mon 22 Aug" text, "Tues 23 Aug" text, "Wed 24 Aug" text, "Thurs 25 Aug" text, "Fri 26 Aug" text ) ### Question ### What is every value on Thursday August 25 for rank 3? ### Accurate SQL ###
SELECT "Thurs 25 Aug" FROM table_74449 WHERE "Rank" = '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 icustays ( row_id number, subject_id number, hadm_id number, icustay_id number, first_careunit text, last_careunit text, first_wardid number, last_wardid number, intime time, outtime time ) TABLE: CREATE TABLE outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value number ) TABLE: CREATE TABLE labevents ( row_id number, subject_id number, hadm_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE d_labitems ( row_id number, itemid number, label text ) TABLE: CREATE TABLE d_icd_procedures ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number ) TABLE: CREATE TABLE patients ( row_id number, subject_id number, gender text, dob time, dod time ) TABLE: CREATE TABLE chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text ) TABLE: CREATE TABLE diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE transfers ( row_id number, subject_id number, hadm_id number, icustay_id number, eventtype text, careunit text, wardid number, intime time, outtime time ) TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text ) TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE procedures_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time ) TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number ) TABLE: CREATE TABLE cost ( row_id number, subject_id number, hadm_id number, event_type text, event_id number, chargetime time, cost number ) TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text ) TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto text ) ### Question ### tell me the first time patient 13528 took a microbiology test in 12/last year? ### Accurate SQL ###
SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 13528) AND DATETIME(microbiologyevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', microbiologyevents.charttime) = '12' ORDER BY microbiologyevents.charttime 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 departments ( DEPARTMENT_ID decimal(4,0), DEPARTMENT_NAME varchar(30), MANAGER_ID decimal(6,0), LOCATION_ID decimal(4,0) ) TABLE: CREATE TABLE employees ( EMPLOYEE_ID decimal(6,0), FIRST_NAME varchar(20), LAST_NAME varchar(25), EMAIL varchar(25), PHONE_NUMBER varchar(20), HIRE_DATE date, JOB_ID varchar(10), SALARY decimal(8,2), COMMISSION_PCT decimal(2,2), MANAGER_ID decimal(6,0), DEPARTMENT_ID decimal(4,0) ) TABLE: CREATE TABLE 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 countries ( COUNTRY_ID varchar(2), COUNTRY_NAME varchar(40), REGION_ID decimal(10,0) ) TABLE: CREATE TABLE locations ( LOCATION_ID decimal(4,0), STREET_ADDRESS varchar(40), POSTAL_CODE varchar(12), CITY varchar(30), STATE_PROVINCE varchar(25), COUNTRY_ID varchar(2) ) TABLE: CREATE TABLE regions ( REGION_ID decimal(5,0), REGION_NAME varchar(25) ) TABLE: CREATE TABLE jobs ( JOB_ID varchar(10), JOB_TITLE varchar(35), MIN_SALARY decimal(6,0), MAX_SALARY decimal(6,0) ) ### Question ### For those employees who did not have any job in the past, draw a bar chart about the distribution of job_id and the average of manager_id , and group by attribute job_id, could you order X from high to low order? ### Accurate SQL ###
SELECT JOB_ID, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID ORDER BY JOB_ID 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_7491 ( "1st built" real, "1913 Class" text, "W.A." text, "No. Built" real, "Builder" text, "Date" text, "LNER Class" text ) ### Question ### What is the 1913 Class of the d32 LNER Class? ### Accurate SQL ###
SELECT "1913 Class" FROM table_7491 WHERE "LNER Class" = 'd32'
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 Instruments ( instrument VARCHAR ) ### Question ### What are all the instruments used? ### Accurate SQL ###
SELECT DISTINCT instrument FROM Instruments
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_43 ( state_country VARCHAR, skipper VARCHAR ) ### Question ### WHICH State/country that has ray roberts? ### Accurate SQL ###
SELECT state_country FROM table_name_43 WHERE skipper = "ray roberts"
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_23918997_1 (no VARCHAR, us_viewers__million_ VARCHAR) ### Question ### How many episodes were viewed by 1.29 million people? ### Accurate SQL ###
SELECT COUNT(no) FROM table_23918997_1 WHERE us_viewers__million_ = "1.29"
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_83 (opponent VARCHAR, date VARCHAR) ### Question ### Which opponent has a Date of 16 february 2003? ### Accurate SQL ###
SELECT opponent FROM table_name_83 WHERE date = "16 february 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_name_17 (advertisement_date VARCHAR, block VARCHAR, ensemble_name VARCHAR) ### Question ### What is Ensemble Name Muxco Gloucestershire's Advertisement Date in Block 10C? ### Accurate SQL ###
SELECT advertisement_date FROM table_name_17 WHERE block = "10c" AND ensemble_name = "muxco gloucestershire"
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 parties ( party_id number, payment_method_code text, party_phone text, party_email text ) TABLE: CREATE TABLE organization_contact_individuals ( individual_id number, organization_id number, date_contact_from time, date_contact_to time ) TABLE: CREATE TABLE individuals ( individual_id number, individual_first_name text, individual_middle_name text, inidividual_phone text, individual_email text, individual_address text, individual_last_name text ) TABLE: CREATE TABLE addresses ( address_id number, line_1_number_building text, town_city text, zip_postcode text, state_province_county text, country text ) TABLE: CREATE TABLE organizations ( organization_id number, date_formed time, organization_name text, uk_vat_number text ) TABLE: CREATE TABLE services ( service_id number, service_type_code text, service_name text, service_descriptio text ) TABLE: CREATE TABLE party_addresses ( party_id number, address_id number, date_address_from time, address_type_code text, date_address_to time ) TABLE: CREATE TABLE party_forms ( party_id number, form_id number, date_completion_started time, form_status_code text, date_fully_completed time ) TABLE: CREATE TABLE party_services ( booking_id number, customer_id number, service_id number, service_datetime time, booking_made_date time ) TABLE: CREATE TABLE forms ( form_id number, form_type_code text, service_id number, form_number text, form_name text, form_description text ) ### Question ### How many services are there? ### Accurate SQL ###
SELECT COUNT(*) FROM services
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 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 ) TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) ### Question ### count the number of patients whose discharge location is home health care and age is less than 27? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.age < "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_69752 ( "Outcome" text, "Date" text, "Tournament" text, "Surface" text, "Opponent" text, "Score" text ) ### Question ### What date was the match on a clay surface against Andrea Hlav kov ? ### Accurate SQL ###
SELECT "Date" FROM table_69752 WHERE "Surface" = 'clay' AND "Opponent" = 'andrea hlaváčková'
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_12955 ( "Rank" real, "Gold" real, "Silver" real, "Bronze" real, "Total" real ) ### Question ### What is the most possible bronze medals when rank is more than 11 and there are fewer than 0 gold medals? ### Accurate SQL ###
SELECT MAX("Bronze") FROM table_12955 WHERE "Rank" > '11' AND "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_32 ( series VARCHAR, high_points VARCHAR ) ### Question ### What series had a high points of Prince (23)? ### Accurate SQL ###
SELECT series FROM table_name_32 WHERE high_points = "prince (23)"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_60 (points VARCHAR, races VARCHAR, wins VARCHAR, podiums VARCHAR) ### Question ### What were the points in the year when his Wins were 0, his Podiums were 0, and he drove in 4 races? ### Accurate SQL ###
SELECT points FROM table_name_60 WHERE wins = "0" AND podiums = "0" AND races = "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 Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean ) TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text ) TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time ) TABLE: CREATE TABLE 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 CloseReasonTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text ) TABLE: CREATE TABLE PostTypes ( Id number, Name 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 Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number ) TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number ) TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number ) TABLE: CREATE TABLE VoteTypes ( Id number, Name text ) TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text ) TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number ) TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time ) TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text ) TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number ) TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number ) TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text ) TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description 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 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 PostTags ( PostId number, TagId number ) TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number ) TABLE: CREATE TABLE Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text ) TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text ) ### Question ### Check duplicated EmailHashes for Issues. Duplicated emailhashes with some reputation, probably worth getting merged if validly the same person. ### Accurate SQL ###
SELECT u1.EmailHash, u1.Id FROM Users AS u1
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_28 (constructor VARCHAR, grid VARCHAR, laps VARCHAR, time_retired VARCHAR) ### Question ### What was the constructor when the laps were larger than 54, and the time/retired was +1 lap on a grid of 20? ### Accurate SQL ###
SELECT constructor FROM table_name_28 WHERE laps > 54 AND time_retired = "+1 lap" AND grid = 20
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_14086 ( "Year(s)" real, "Tournament or series" text, "Played in" text, "Games played ( Tests )" text, "Games won ( Tests )" text, "Games lost ( Tests )" text, "Games drawn ( Tests )" text, "Points for ( Tests )" text, "Points against ( Tests )" text ) ### Question ### What are the points against for 2000, when games won is 4 (1)? ### Accurate SQL ###
SELECT "Points against ( Tests )" FROM table_14086 WHERE "Year(s)" = '2000' AND "Games won ( Tests )" = '4 (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_1682026_6 ( market_value__billion_$_ VARCHAR, sales__billion_$_ VARCHAR ) ### Question ### What is the market value of a company in billions that has 172.7 billion in sales? ### Accurate SQL ###
SELECT market_value__billion_$_ FROM table_1682026_6 WHERE sales__billion_$_ = "172.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_name_43 ( round INTEGER, pick__number VARCHAR, overall VARCHAR ) ### Question ### What was the first Round with a Pick # greater than 1 and 140 Overall? ### Accurate SQL ###
SELECT MIN(round) FROM table_name_43 WHERE pick__number > 1 AND overall > 140
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_30949 ( "Rd." real, "Grand Prix" text, "Pole Position" text, "Fastest Lap" text, "Winning Driver" text, "Constructor" text, "Report" text ) ### Question ### What was the constructor in the Belgian Grand Prix round? ### Accurate SQL ###
SELECT "Constructor" FROM table_30949 WHERE "Grand Prix" = 'Belgian Grand Prix'
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_96 ( res VARCHAR, opponent VARCHAR ) ### Question ### What is the result of the match with Jeff Monson as opponent? ### Accurate SQL ###
SELECT res FROM table_name_96 WHERE opponent = "jeff monson"
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_38838 ( "Name" text, "Type" text, "Entered service" text, "Water depth" text, "Location" text ) ### Question ### Which is located in Angola and entered service in 1988? ### Accurate SQL ###
SELECT "Name" FROM table_38838 WHERE "Location" = 'angola' AND "Entered service" = '1988'
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 (percent_of_mass VARCHAR, molweight__daltons_ VARCHAR) ### Question ### what is the percent of mass when the mol.weight (daltons) is 1e11? ### Accurate SQL ###
SELECT percent_of_mass FROM table_name_21 WHERE molweight__daltons_ = "1e11"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_43 (kaz_hayashi VARCHAR, block_a VARCHAR) ### Question ### Name the kaz hayashi for block A being bushi ### Accurate SQL ###
SELECT kaz_hayashi FROM table_name_43 WHERE block_a = "bushi"
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question. Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise. ### Tables ### TABLE: CREATE TABLE table_name_35 ( attendance VARCHAR, date VARCHAR ) ### Question ### What is the attendance from November 3, 1974? ### Accurate SQL ###
SELECT attendance FROM table_name_35 WHERE date = "november 3, 1974"
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 (format VARCHAR, region VARCHAR, label VARCHAR) ### Question ### What format has France as the region, with Universal Licensing Music (ulm) as the label? ### Accurate SQL ###
SELECT format FROM table_name_72 WHERE region = "france" AND label = "universal licensing music (ulm)"
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 ( per_capita_income VARCHAR, median_household_income VARCHAR ) ### Question ### What's the $51,914 median household income per capita? ### Accurate SQL ###
SELECT per_capita_income FROM table_name_34 WHERE median_household_income = "$51,914"
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_59 ( party VARCHAR, district VARCHAR ) ### Question ### What is Illinois 13 District's Party? ### Accurate SQL ###
SELECT party FROM table_name_59 WHERE district = "illinois 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 table_name_59 ( weight VARCHAR, name VARCHAR ) ### Question ### What is Alexandr Elke's Weight? ### Accurate SQL ###
SELECT weight FROM table_name_59 WHERE name = "alexandr elke"
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 lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text ) TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text ) TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text ) ### Question ### provide the number of patients whose diagnoses short title is wheelchair dependence and drug type is main? ### Accurate SQL ###
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Wheelchair dependence" AND prescriptions.drug_type = "MAIN"
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_217 ( id number, "camp" text, "div sec\ndivision" text, "admin\ndistrict" text, "9 feb" number, "11 feb" number, "16 feb" number, "25 feb" number, "27 feb" number, "2 mar" number, "4 mar" number, "6 mar" number, "11 mar" number, "13 mar" number, "24 mar" number, "30 mar" number, "31 mar" number ) ### Question ### who was the first div sec division ? ### Accurate SQL ###
SELECT "div sec\ndivision" FROM table_204_217 WHERE id = 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_15887683_15 (television_service VARCHAR, country VARCHAR, n° VARCHAR) ### Question ### what television service are in the united kingdom and n° is greater than 854.0? ### Accurate SQL ###
SELECT television_service FROM table_15887683_15 WHERE country = "United Kingdom" AND n° > 854.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 authorship (authid VARCHAR, paperid VARCHAR) TABLE: CREATE TABLE papers (paperid VARCHAR, title VARCHAR) TABLE: CREATE TABLE authors (fname VARCHAR, lname VARCHAR, authid VARCHAR) ### Question ### Find the first and last name of the author(s) who wrote the paper "Nameless, Painless". ### Accurate SQL ###
SELECT t1.fname, t1.lname FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t3.title = "Nameless , Painless"