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_6 (set_2 VARCHAR, total VARCHAR, set_3 VARCHAR)
### Question ###
What is the Set 2 with a Total of 45–12, and a Set 3 with 15–2?
### Accurate SQL ###
| SELECT set_2 FROM table_name_6 WHERE total = "45–12" AND set_3 = "15–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 PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE ReviewTaskResults ( Id number, ReviewTaskId number, ReviewTaskResultTypeId number, CreationDate time, RejectionReasonId number, Comment text )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId 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 PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE VoteTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE ReviewTaskTypes ( 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 PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
### Question ###
Metrics - User - Accumulated PU Ratio by Quarter.
### Accurate SQL ###
| SELECT r AS Registered, COUNT(1) AS Users, SUM(s) AS Writers, ROUND(SUM(s) * 100.0 / COUNT(1), 2) AS "writers_%" FROM (SELECT u.Id, (CASE WHEN SUM(CASE WHEN p.PostTypeId = 2 AND (p.Score >= @minVote) THEN 1 ELSE 0 END) >= @minPost THEN 1 ELSE 0 END) AS s, (TIME_TO_STR(u.CreationDate, '%Y') * 100 + TIME_TO_STR(u.CreationDate, '%q')) AS r FROM Users AS u LEFT JOIN Posts AS p ON p.OwnerUserId = u.Id GROUP BY u.Id, u.CreationDate) AS X GROUP BY r ORDER BY r |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_15040_8 (french VARCHAR, russian VARCHAR)
### Question ###
What is the french word for the Russian word filtrovat (фильтровать)?
### Accurate SQL ###
| SELECT french FROM table_15040_8 WHERE russian = "filtrovat (фильтровать)" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_22303 ( "Frequency (in Kuala Lumpur , Selangor , Putrajaya and environs)" text, "Station" text, "Operator" text, "Language" text, "Genre" text, "Coverage Area" text )
### Question ###
Which operators offer a genre of music?
### Accurate SQL ###
| SELECT "Operator" FROM table_22303 WHERE "Genre" = 'music' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_56 ( province VARCHAR, south_asians_2001 VARCHAR, south_asians_2011 VARCHAR )
### Question ###
Which province had fewer than 190 South Asians in 2001 and 115 South Asians in 2011?
### Accurate SQL ###
| SELECT province FROM table_name_56 WHERE south_asians_2001 < 190 AND south_asians_2011 = 115 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_20049 ( "2000 :" text, "January" text, "February" text, "March" text, "April" text, "May" text, "June" text, "July" text, "August" text, "September" text, "October" text, "November" text, "December" text )
### Question ###
Name the number of februaries
### Accurate SQL ###
| SELECT COUNT("February") FROM table_20049 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( jockey VARCHAR, post_time_odds VARCHAR )
### Question ###
Who was the jockey that had post time odds of 34-1?
### Accurate SQL ###
| SELECT jockey FROM table_name_59 WHERE post_time_odds = "34-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_61273 ( "Position" real, "Club" text, "Played" real, "Points" real, "Wins" real, "Draws" real, "Losses" real, "Goals for" real, "Goals against" real, "Goal Difference" real )
### Question ###
How much Played has Goals against smaller than 34, and Wins smaller than 13?
### Accurate SQL ###
| SELECT SUM("Played") FROM table_61273 WHERE "Goals against" < '34' AND "Wins" < '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_8527 ( "Rider" text, "Manufacturer" text, "Laps" real, "Time/Retired" text, "Grid" real )
### Question ###
What are the highest laps for Marco Melandri?
### Accurate SQL ###
| SELECT MAX("Laps") FROM table_8527 WHERE "Rider" = 'marco melandri' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_40 (gold VARCHAR, rank VARCHAR, total VARCHAR, silver VARCHAR)
### Question ###
What is the gold number when the total is less than 8, silver less than 1 and the rank is more than 7?
### Accurate SQL ###
| SELECT COUNT(gold) FROM table_name_40 WHERE total < 8 AND silver < 1 AND rank > 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_18659 ( "District" text, "Incumbent" text, "Party" text, "First elected" real, "Result" text, "Candidates" text )
### Question ###
What year was the first election when Fritz G. Lanham was elected?
### Accurate SQL ###
| SELECT MAX("First elected") FROM table_18659 WHERE "Incumbent" = 'Fritz G. Lanham' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE 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 )
### Question ###
what is drug route of drug name lactated ringers?
### Accurate SQL ###
| SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "Lactated Ringers" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
how many patiens had an uptake ratio test and were treated with main drug?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE prescriptions.drug_type = "MAIN" AND lab.label = "Uptake Ratio" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 (extra INTEGER, meeting VARCHAR, year VARCHAR)
### Question ###
What is the highest extra total before 2003 at the Meeting of all africa games?
### Accurate SQL ###
| SELECT MAX(extra) FROM table_name_51 WHERE meeting = "all africa games" AND year < 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_20339 ( "No. in series" real, "No. in season" real, "Title" text, "Directed by" text, "Written By" text, "Originalairdate" text, "TV Broadcast" text )
### Question ###
Who directed the TV broadcast s03e19?
### Accurate SQL ###
| SELECT "Directed by" FROM table_20339 WHERE "TV Broadcast" = 'S03E19' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE procedures ( 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 ###
count the number of patients whose year of death is less than or equal to 2180 and drug name is verapamil sr?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dod_year <= "2180.0" AND prescriptions.drug = "Verapamil SR" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE country ( Country_id int, Country_name text, Capital text, Official_native_language text )
TABLE: CREATE TABLE team ( Team_id int, Name text )
TABLE: CREATE TABLE player ( Player_ID int, Player text, Years_Played text, Total_WL text, Singles_WL text, Doubles_WL text, Team int )
TABLE: CREATE TABLE match_season ( Season real, Player text, Position text, Country int, Team int, Draft_Pick_Number int, Draft_Class text, College text )
### Question ###
Show me a bar chart for what are the draft pick numbers and draft classes for players who play the Defender position?, could you display in desc by the Y?
### Accurate SQL ###
| SELECT Draft_Class, Draft_Pick_Number FROM match_season WHERE Position = "Defender" ORDER BY Draft_Pick_Number 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_33984 ( "Tournament" text, "2006" text, "2007" text, "2008-12" text, "2013" text )
### Question ###
Which 2006 has a 2007 of A?
### Accurate SQL ###
| SELECT "2006" FROM table_33984 WHERE "2007" = 'a' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_19215259_1 (frequency VARCHAR, branding VARCHAR)
### Question ###
What is the frequency of 101.5 News FM?
### Accurate SQL ###
| SELECT frequency FROM table_19215259_1 WHERE branding = "101.5 News FM" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 (score VARCHAR, location_attendance VARCHAR, record VARCHAR)
### Question ###
What was the score for the game played in Alexander Memorial Coliseum when the record was 0-1?
### Accurate SQL ###
| SELECT score FROM table_name_32 WHERE location_attendance = "alexander memorial coliseum" AND record = "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_37182 ( "Year(s)" real, "Grand Final Television Commentator" text, "Grand Final Dual Television Commentator" text, "Spokesperson" text, "Semi Final Television Commentator" text, "Semi Final Dual Television Commentator" text )
### Question ###
What is the grand final television commentator status after 1959 when Dave was the grand final dual television commentator and Marie Myriam was the spokesperson?
### Accurate SQL ###
| SELECT "Grand Final Television Commentator" FROM table_37182 WHERE "Year(s)" > '1959' AND "Grand Final Dual Television Commentator" = 'dave' AND "Spokesperson" = 'marie myriam' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
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 Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
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 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 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
### Question ###
Longest answers by approximate word count..
### Accurate SQL ###
| SELECT Id AS "post_link", OwnerUserId AS "user_link", LENGTH(Body) - LENGTH(REPLACE(Body, ' ', '')) - 2 * (LENGTH(Body) - LENGTH(REPLACE(Body, ' ', ''))) AS ApproxWords, LastActivityDate AS "last_activity_date" FROM Posts WHERE PostTypeId = 2 AND OwnerUserId = '##UserID##' ORDER BY ApproxWords DESC LIMIT 1000 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_93 (year INTEGER, competition VARCHAR, venue VARCHAR)
### Question ###
Which Year has a Competition of olympic games, and a Venue of atlanta, united states?
### Accurate SQL ###
| SELECT AVG(year) FROM table_name_93 WHERE competition = "olympic games" AND venue = "atlanta, united states" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_36412 ( "Country" text, "Launches" real, "Successes" real, "Failures" real, "Partial failures" real )
### Question ###
Failures larger than 0, and a Successes of 1 has what lowest partial failures?
### Accurate SQL ###
| SELECT MIN("Partial failures") FROM table_36412 WHERE "Failures" > '0' AND "Successes" = '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_83 ( spanish VARCHAR, english VARCHAR )
### Question ###
what is the spanish word for garden
### Accurate SQL ###
| SELECT spanish FROM table_name_83 WHERE english = "garden" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_33 ( paris_roubaix___fra__ VARCHAR, year VARCHAR )
### Question ###
Who won the Paris-Roubaix in 2006?
### Accurate SQL ###
| SELECT paris_roubaix___fra__ FROM table_name_33 WHERE year = 2006 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_1 ( drawn VARCHAR, points_for VARCHAR )
### Question ###
How many matches were drawn by a team with 447 points?
### Accurate SQL ###
| SELECT drawn FROM table_name_1 WHERE points_for = "447" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
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 PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostTags ( PostId number, TagId 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 SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
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 Posts ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE Users ( Id number, Reputation number, CreationDate time, DisplayName text, LastAccessDate time, WebsiteUrl text, Location text, AboutMe text, Views number, UpVotes number, DownVotes number, ProfileImageUrl text, EmailHash text, AccountId number )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
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 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 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
### Question ###
New accounts per day (moving average).
### Accurate SQL ###
| WITH accountsByDate AS (SELECT DATE(u.CreationDate) AS "date", COUNT(*) AS numUsers FROM Users AS u GROUP BY DATE(u.CreationDate)) SELECT a."date", AVG(a.numUsers) OVER (ORDER BY a."date" ROWS BETWEEN '##MovingAvg:int?20##' PRECEDING AND CURRENT ROW) FROM accountsByDate AS a WHERE a."date" >= '2016-01-01' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
### Question ###
Could I take class HHCR 710 as Core ?
### Accurate SQL ###
| SELECT COUNT(*) > 0 FROM course, program, program_course WHERE course.department = 'HHCR' AND course.number = 710 AND program_course.category LIKE '%Core%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_86 ( college VARCHAR, team VARCHAR, round VARCHAR )
### Question ###
Name the college that has 7 rounds and boston celtics team
### Accurate SQL ###
| SELECT college FROM table_name_86 WHERE team = "boston celtics" AND round = "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 Gradeconversion ( lettergrade VARCHAR(2), gradepoint FLOAT )
TABLE: CREATE TABLE Minor_in ( StuID INTEGER, DNO 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 Course ( CID VARCHAR(7), CName VARCHAR(40), Credits INTEGER, Instructor INTEGER, Days VARCHAR(5), Hours VARCHAR(11), DNO INTEGER )
TABLE: CREATE TABLE Department ( DNO INTEGER, Division VARCHAR(2), DName VARCHAR(25), Room VARCHAR(5), Building VARCHAR(13), DPhone INTEGER )
TABLE: CREATE TABLE Enrolled_in ( StuID INTEGER, CID VARCHAR(7), Grade VARCHAR(2) )
TABLE: CREATE TABLE Faculty ( FacID INTEGER, Lname VARCHAR(15), Fname VARCHAR(15), Rank VARCHAR(15), Sex VARCHAR(1), Phone INTEGER, Room VARCHAR(5), Building VARCHAR(13) )
TABLE: CREATE TABLE Member_of ( FacID INTEGER, DNO INTEGER, Appt_Type VARCHAR(15) )
### Question ###
Return a scatter chart about the correlation between Instructor and DNO .
### Accurate SQL ###
| SELECT Instructor, DNO FROM Course ORDER BY Credits |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_1341604_11 (party VARCHAR, incumbent VARCHAR)
### Question ###
Name the party for jack thomas brinkley
### Accurate SQL ###
| SELECT party FROM table_1341604_11 WHERE incumbent = "Jack Thomas Brinkley" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_15 (self_employed VARCHAR, investment_income VARCHAR, other_income_sources VARCHAR, employment___salaries_ VARCHAR, _wages_ VARCHAR)
### Question ###
Investment income of 2%, and an other income sources of 3%, and an employment (salaries & wages) of 71% involves which self employed?
### Accurate SQL ###
| SELECT self_employed FROM table_name_15 WHERE investment_income = "2%" AND other_income_sources = "3%" AND employment___salaries_ & _wages_ = "71%" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_27977 ( "#" real, "Airdate" text, "No. of couples" real, "First couple" text, "Second couple" text, "Third couple" text, "Fourth couple" text, "Viewers (millions)" text, "ITV1 weekly ranking" real )
### Question ###
What is the minimum ITV1 ranking for the episode having viewership of 5.42 million?
### Accurate SQL ###
| SELECT MIN("ITV1 weekly ranking") FROM table_27977 WHERE "Viewers (millions)" = '5.42' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_16275828_4 (location VARCHAR, track_name VARCHAR)
### Question ###
What location is farmer city speedway?
### Accurate SQL ###
| SELECT location FROM table_16275828_4 WHERE track_name = "Farmer City Speedway" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 inputevents_cv ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, amount number )
TABLE: CREATE TABLE d_icd_diagnoses ( row_id number, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE admissions ( row_id number, subject_id number, hadm_id number, admittime time, dischtime time, admission_type text, admission_location text, discharge_location text, insurance text, language text, marital_status text, ethnicity text, age number )
TABLE: CREATE TABLE microbiologyevents ( row_id number, subject_id number, hadm_id number, charttime time, spec_type_desc text, org_name text )
TABLE: CREATE TABLE prescriptions ( row_id number, subject_id number, hadm_id number, startdate time, enddate time, drug text, dose_val_rx text, dose_unit_rx text, route text )
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 diagnoses_icd ( row_id number, subject_id number, hadm_id number, icd9_code text, charttime time )
TABLE: CREATE TABLE d_items ( row_id number, itemid number, label text, linksto 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 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 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 outputevents ( row_id number, subject_id number, hadm_id number, icustay_id number, charttime time, itemid number, value 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 chartevents ( row_id number, subject_id number, hadm_id number, icustay_id number, itemid number, charttime time, valuenum number, valueuom text )
### Question ###
what were the top four commonly prescribed drugs that male patients aged 20s were prescribed within the same hospital visit after having been diagnosed with long-term use anticoagul since 3 years ago?
### Accurate SQL ###
| SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'long-term use anticoagul') AND DATETIME(diagnoses_icd.charttime) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE admissions.subject_id IN (SELECT patients.subject_id FROM patients WHERE patients.gender = 'm') AND admissions.age BETWEEN 20 AND 29 AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-3 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND t1.hadm_id = t2.hadm_id GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 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 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 ###
what is diagnoses long title of diagnoses icd9 code 42731?
### Accurate SQL ###
| SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.icd9_code = "42731" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_10 ( b_score INTEGER, position VARCHAR, total VARCHAR )
### Question ###
What the B Score when the total is 16.125 and the position is less than 7?
### Accurate SQL ###
| SELECT SUM(b_score) FROM table_name_10 WHERE position < 7 AND total = 16.125 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_27450976_1 ( written_by VARCHAR, production_code VARCHAR )
### Question ###
How many people wrote the episode with a production code of 2j5507?
### Accurate SQL ###
| SELECT COUNT(written_by) FROM table_27450976_1 WHERE production_code = "2J5507" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_735 ( id number, "rank" number, "team" text, "names" text, "time" text, "qualification" text )
### Question ###
which country 's team ranked last ?
### Accurate SQL ###
| SELECT "team" FROM table_204_735 ORDER BY "rank" 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_1661124_1 ( brand_name VARCHAR, antibody VARCHAR )
### Question ###
What is the brand name for the antibody Brentuximab Vedotin?
### Accurate SQL ###
| SELECT brand_name FROM table_1661124_1 WHERE antibody = "Brentuximab vedotin" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE 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 )
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 )
### Question ###
How many patients were admitted with transfer from hosp/extram and diagnosed with the primary disease hyperglcemia hyponatremia?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.diagnosis = "HYPERGLYCEMIA;HYPONATREMIA" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_44086 ( "Week" real, "Date" text, "Opponent" text, "Result" text, "Record" text, "Streak" text, "Attendance" real )
### Question ###
What was the week number when they played on Dec. 19?
### Accurate SQL ###
| SELECT COUNT("Week") FROM table_44086 WHERE "Date" = 'dec. 19' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_25 (grid INTEGER, rider VARCHAR)
### Question ###
What is the grid for dirk heidolf?
### Accurate SQL ###
| SELECT SUM(grid) FROM table_name_25 WHERE rider = "dirk heidolf" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_test_27 ( "id" int, "anemia" bool, "bleeding" int, "left_ventricular_ejection_fraction_lvef" int, "intra_aortic_balloon_pump_iabp" bool, "systolic_blood_pressure_sbp" int, "left_main_stem_coronary_artery_stenosis" int, "haemoglobin" float, "renal_disease" bool, "creatinine_clearance_cl" float, "estimated_glomerular_filtration_rate_egfr" int, "cardiogenic_shock" bool, "platelet_count" float, "iv_pressors" bool, "hemodynamic_instability" bool, "hypotension" bool, "serum_creatinine" float, "NOUSE" float )
### Question ###
renal dysfunction, creatinine more than 2 mg / dl
### Accurate SQL ###
| SELECT * FROM table_test_27 WHERE renal_disease = 1 OR creatinine_clearance_cl > 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_11734041_10 (player VARCHAR, height_in_ft VARCHAR)
### Question ###
What are all the names of the players who are 7-0 tall?
### Accurate SQL ###
| SELECT player FROM table_11734041_10 WHERE height_in_ft = "7-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_65439 ( "Position" text, "Drivers" text, "Entrant" text, "Class" text, "Laps" real )
### Question ###
The driver in class A with 125 laps is in what position?
### Accurate SQL ###
| SELECT "Position" FROM table_65439 WHERE "Class" = 'a' AND "Laps" = '125' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_69832 ( "Year" real, "Entrant" text, "Chassis" text, "Engine" text, "Points" real )
### Question ###
Which Chassis was featured in the year 1971?
### Accurate SQL ###
| SELECT "Chassis" FROM table_69832 WHERE "Year" = '1971' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE journal_committee ( Editor_ID int, Journal_ID int, Work_Type text )
TABLE: CREATE TABLE journal ( Journal_ID int, Date text, Theme text, Sales int )
TABLE: CREATE TABLE editor ( Editor_ID int, Name text, Age real )
### Question ###
Show the names of editors that are on the committee of journals with sales bigger than 3000, and count them by a bar chart, sort Name from high to low order.
### Accurate SQL ###
| SELECT Name, COUNT(Name) FROM journal_committee AS T1 JOIN editor AS T2 ON T1.Editor_ID = T2.Editor_ID JOIN journal AS T3 ON T1.Journal_ID = T3.Journal_ID WHERE T3.Sales > 3000 GROUP BY Name ORDER BY Name DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_81 (population_density__per_km²_ VARCHAR, name VARCHAR, capital VARCHAR)
### Question ###
What is Population density (per km²), when Name is Antigua and Barbuda, and when Capital is St. John's?
### Accurate SQL ###
| SELECT population_density__per_km²_ FROM table_name_81 WHERE name = "antigua and barbuda" AND capital = "st. john's" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_25675509_1 (longitude VARCHAR, date__yyyy_mm_dd_ VARCHAR)
### Question ###
What was the longitude for the shock that occured on 2010-01-09?
### Accurate SQL ###
| SELECT longitude FROM table_25675509_1 WHERE date__yyyy_mm_dd_ = "2010-01-09" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_761 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
### Question ###
what is the number of gold medals won by japan ?
### Accurate SQL ###
| SELECT "gold" FROM table_204_761 WHERE "nation" = 'japan' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_26 (date VARCHAR, attendance VARCHAR, home VARCHAR)
### Question ###
What was date was the attendance larger than 875 against Platense?
### Accurate SQL ###
| SELECT date FROM table_name_26 WHERE attendance > 875 AND home = "platense" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE days ( days_code varchar, day_name varchar )
TABLE: CREATE TABLE ground_service ( city_code text, airport_code text, transport_type text, ground_fare int )
TABLE: CREATE TABLE state ( state_code text, state_name text, country_name text )
TABLE: CREATE TABLE airline ( airline_code varchar, airline_name text, note text )
TABLE: CREATE TABLE dual_carrier ( main_airline varchar, low_flight_number int, high_flight_number int, dual_airline varchar, service_name text )
TABLE: CREATE TABLE date_day ( month_number int, day_number int, year int, day_name varchar )
TABLE: CREATE TABLE restriction ( restriction_code text, advance_purchase int, stopovers text, saturday_stay_required text, minimum_stay int, maximum_stay int, application text, no_discounts text )
TABLE: CREATE TABLE code_description ( code varchar, description text )
TABLE: CREATE TABLE city ( city_code varchar, city_name varchar, state_code varchar, country_name varchar, time_zone_code varchar )
TABLE: CREATE TABLE time_zone ( time_zone_code text, time_zone_name text, hours_from_gmt int )
TABLE: CREATE TABLE fare ( fare_id int, from_airport varchar, to_airport varchar, fare_basis_code text, fare_airline text, restriction_code text, one_direction_cost int, round_trip_cost int, round_trip_required varchar )
TABLE: CREATE TABLE flight ( aircraft_code_sequence text, airline_code varchar, airline_flight text, arrival_time int, connections int, departure_time int, dual_carrier text, flight_days text, flight_id int, flight_number int, from_airport varchar, meal_code text, stops int, time_elapsed int, to_airport varchar )
TABLE: CREATE TABLE food_service ( meal_code text, meal_number int, compartment text, meal_description varchar )
TABLE: CREATE TABLE fare_basis ( fare_basis_code text, booking_class text, class_type text, premium text, economy text, discounted text, night text, season text, basis_days text )
TABLE: CREATE TABLE airport ( airport_code varchar, airport_name text, airport_location text, state_code varchar, country_name varchar, time_zone_code varchar, minimum_connect_time int )
TABLE: CREATE TABLE flight_fare ( flight_id int, fare_id int )
TABLE: CREATE TABLE time_interval ( period text, begin_time int, end_time int )
TABLE: CREATE TABLE aircraft ( aircraft_code varchar, aircraft_description varchar, manufacturer varchar, basic_type varchar, engines int, propulsion varchar, wide_body varchar, wing_span int, length int, weight int, capacity int, pay_load int, cruising_speed int, range_miles int, pressurized varchar )
TABLE: CREATE TABLE compartment_class ( compartment varchar, class_type varchar )
TABLE: CREATE TABLE airport_service ( city_code varchar, airport_code varchar, miles_distant int, direction varchar, minutes_distant int )
TABLE: CREATE TABLE equipment_sequence ( aircraft_code_sequence varchar, aircraft_code varchar )
TABLE: CREATE TABLE flight_stop ( flight_id int, stop_number int, stop_days text, stop_airport text, arrival_time int, arrival_airline text, arrival_flight_number int, departure_time int, departure_airline text, departure_flight_number int, stop_time int )
TABLE: CREATE TABLE class_of_service ( booking_class varchar, rank int, class_description text )
TABLE: CREATE TABLE month ( month_number int, month_name text )
TABLE: CREATE TABLE flight_leg ( flight_id int, leg_number int, leg_flight int )
### Question ###
list all direct flights from BOSTON to DENVER
### Accurate SQL ###
| SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DENVER' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.stops = 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_61 ( party VARCHAR, district VARCHAR, delegate VARCHAR )
### Question ###
Which party belongs to district 41, and is delegated by Jill P. Carter?
### Accurate SQL ###
| SELECT party FROM table_name_61 WHERE district = 41 AND delegate = "jill p. carter" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( game INTEGER, record VARCHAR )
### Question ###
Which Game is the lowest one that has a Record of 11-4?
### Accurate SQL ###
| SELECT MIN(game) FROM table_name_30 WHERE record = "11-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_739 ( id number, "rank" number, "nation" text, "gold" number, "silver" number, "bronze" number, "total" number )
### Question ###
which nation received the largest amount of gold medals ?
### Accurate SQL ###
| SELECT "nation" FROM table_203_739 ORDER BY "gold" 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_9 (shooter VARCHAR, total VARCHAR)
### Question ###
What Shooter has a Total of 28?
### Accurate SQL ###
| SELECT shooter FROM table_name_9 WHERE total = "28" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_16689920_1 ( distance VARCHAR, jockey VARCHAR, date VARCHAR )
### Question ###
What is the distance for jockey Kent Desormeaux on 6/7/08?
### Accurate SQL ###
| SELECT distance FROM table_16689920_1 WHERE jockey = "Kent Desormeaux" AND date = "6/7/08" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_92 (population VARCHAR, number_of_households VARCHAR)
### Question ###
What is the population with 41,511 households?
### Accurate SQL ###
| SELECT COUNT(population) FROM table_name_92 WHERE number_of_households = 41 OFFSET 511 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_19283806_4 (location VARCHAR, median_household_income__2011_ VARCHAR)
### Question ###
How many locations have a median household income in 2011 of $71,479?
### Accurate SQL ###
| SELECT COUNT(location) FROM table_19283806_4 WHERE median_household_income__2011_ = "$71,479" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE program_requirement ( program_id int, category varchar, min_credit int, additional_req varchar )
TABLE: CREATE TABLE comment_instructor ( instructor_id int, student_id int, score int, comment_text varchar )
TABLE: CREATE TABLE student_record ( student_id int, course_id int, semester int, grade varchar, how varchar, transfer_source varchar, earn_credit varchar, repeat_term varchar, test_id varchar )
TABLE: CREATE TABLE ta ( campus_job_id int, student_id int, location varchar )
TABLE: CREATE TABLE offering_instructor ( offering_instructor_id int, offering_id int, instructor_id int )
TABLE: CREATE TABLE semester ( semester_id int, semester varchar, year int )
TABLE: CREATE TABLE requirement ( requirement_id int, requirement varchar, college varchar )
TABLE: CREATE TABLE student ( student_id int, lastname varchar, firstname varchar, program_id int, declare_major varchar, total_credit int, total_gpa float, entered_as varchar, admit_term int, predicted_graduation_semester int, degree varchar, minor varchar, internship varchar )
TABLE: CREATE TABLE area ( course_id int, area varchar )
TABLE: CREATE TABLE gsi ( course_offering_id int, student_id int )
TABLE: CREATE TABLE program_course ( program_id int, course_id int, workload int, category varchar )
TABLE: CREATE TABLE program ( program_id int, name varchar, college varchar, introduction varchar )
TABLE: CREATE TABLE course_offering ( offering_id int, course_id int, semester int, section_number int, start_time time, end_time time, monday varchar, tuesday varchar, wednesday varchar, thursday varchar, friday varchar, saturday varchar, sunday varchar, has_final_project varchar, has_final_exam varchar, textbook varchar, class_address varchar, allow_audit varchar )
TABLE: CREATE TABLE course ( course_id int, name varchar, department varchar, number varchar, credits varchar, advisory_requirement varchar, enforced_requirement varchar, description varchar, num_semesters int, num_enrolled int, has_discussion varchar, has_lab varchar, has_projects varchar, has_exams varchar, num_reviews int, clarity_score int, easiness_score int, helpfulness_score int )
TABLE: CREATE TABLE instructor ( instructor_id int, name varchar, uniqname varchar )
TABLE: CREATE TABLE course_prerequisite ( pre_course_id int, course_id int )
TABLE: CREATE TABLE course_tags_count ( course_id int, clear_grading int, pop_quiz int, group_projects int, inspirational int, long_lectures int, extra_credit int, few_tests int, good_feedback int, tough_tests int, heavy_papers int, cares_for_students int, heavy_assignments int, respected int, participation int, heavy_reading int, tough_grader int, hilarious int, would_take_again int, good_lecture int, no_skip int )
TABLE: CREATE TABLE jobs ( job_id int, job_title varchar, description varchar, requirement varchar, city varchar, state varchar, country varchar, zip int )
### Question ###
For the Core requirement , what courses are offered in Fall or Winter ?
### Accurate SQL ###
| SELECT DISTINCT course.department, course.name, course.number, semester.semester FROM course INNER JOIN course_offering ON course.course_id = course_offering.course_id INNER JOIN semester ON semester.semester_id = course_offering.semester INNER JOIN program_course ON program_course.course_id = course_offering.course_id WHERE program_course.category LIKE '%Core%' AND semester.semester IN ('FA', 'WN') AND semester.year = 2016 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_62115 ( "Outcome" text, "Date" text, "Championship" text, "Surface" text, "Opponent in the final" text, "Score in the final" text )
### Question ###
What type of surface did they play on 23 October 2000?
### Accurate SQL ###
| SELECT "Surface" FROM table_62115 WHERE "Date" = '23 october 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_13681 ( "Constituency number" text, "Name" text, "Reserved for ( SC / ST /None)" text, "District" text, "Number of electorates (2009)" real )
### Question ###
Which Number of electorates (2009) has 188 Constituents?
### Accurate SQL ###
| SELECT "Number of electorates (2009)" FROM table_13681 WHERE "Constituency number" = '188' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_33 (overs INTEGER, runs VARCHAR, matches VARCHAR)
### Question ###
How many overs when there are 5231 runs and fewer than 37 matches?
### Accurate SQL ###
| SELECT SUM(overs) FROM table_name_33 WHERE runs = 5231 AND matches < 37 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE treatment ( treatmentid number, patientunitstayid number, treatmentname text, treatmenttime time )
TABLE: CREATE TABLE cost ( costid number, uniquepid text, patienthealthsystemstayid number, eventtype text, eventid number, chargetime time, cost number )
TABLE: CREATE TABLE allergy ( allergyid number, patientunitstayid number, drugname text, allergyname text, allergytime time )
TABLE: CREATE TABLE lab ( labid number, patientunitstayid number, labname text, labresult number, labresulttime time )
TABLE: CREATE TABLE medication ( medicationid number, patientunitstayid number, drugname text, dosage text, routeadmin text, drugstarttime time, drugstoptime time )
TABLE: CREATE TABLE diagnosis ( diagnosisid number, patientunitstayid number, diagnosisname text, diagnosistime time, icd9code text )
TABLE: CREATE TABLE microlab ( microlabid number, patientunitstayid number, culturesite text, organism text, culturetakentime time )
TABLE: CREATE TABLE patient ( uniquepid text, patienthealthsystemstayid number, patientunitstayid number, gender text, age text, ethnicity text, hospitalid number, wardid number, admissionheight number, admissionweight number, dischargeweight number, hospitaladmittime time, hospitaladmitsource text, unitadmittime time, unitdischargetime time, hospitaldischargetime time, hospitaldischargestatus text )
TABLE: CREATE TABLE vitalperiodic ( vitalperiodicid number, patientunitstayid number, temperature number, sao2 number, heartrate number, respiration number, systemicsystolic number, systemicdiastolic number, systemicmean number, observationtime time )
TABLE: CREATE TABLE intakeoutput ( intakeoutputid number, patientunitstayid number, cellpath text, celllabel text, cellvaluenumeric number, intakeoutputtime time )
### Question ###
when did the first procedure time of patient 009-11591 this year?
### Accurate SQL ###
| SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '009-11591')) AND DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') ORDER BY treatment.treatmenttime LIMIT 1 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_14 (round INTEGER, position VARCHAR)
### Question ###
Which Round is the highest one that has a Position of running back?
### Accurate SQL ###
| SELECT MAX(round) FROM table_name_14 WHERE position = "running back" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_60501 ( "Place" text, "Player" text, "Country" text, "Score" text, "To par" text, "Money ( \u00a3 )" text )
### Question ###
What is the place of the player from New Zealand?
### Accurate SQL ###
| SELECT "Place" FROM table_60501 WHERE "Country" = 'new zealand' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_52662 ( "Chemical class" text, "Group" text, "Formula" text, "Prefix" text, "Suffix" text, "Example" text )
### Question ###
Which chemical class uses the example Chloroethane (ethyl chloride)?
### Accurate SQL ###
| SELECT "Chemical class" FROM table_52662 WHERE "Example" = 'chloroethane (ethyl chloride)' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 (score VARCHAR, date VARCHAR, away_team VARCHAR)
### Question ###
On the date of 30/01/1991, when the away team was Liverpool, what was the score?
### Accurate SQL ###
| SELECT score FROM table_name_76 WHERE date = "30/01/1991" AND away_team = "liverpool" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 ( bronze INTEGER, gold VARCHAR, silver VARCHAR )
### Question ###
What is the average bronze medal when gold is greater than 0, and there is less than 0 silver medals?
### Accurate SQL ###
| SELECT AVG(bronze) FROM table_name_86 WHERE gold > 0 AND silver < 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 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 )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
how many patients whose admission location is transfer from hosp/extram and procedure short title is adm inhal nitric oxide?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND procedures.short_title = "Adm inhal nitric oxide" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 procedures ( 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 )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
### Question ###
what is admission location and discharge location of subject id 22377?
### Accurate SQL ###
| SELECT demographic.admission_location, demographic.discharge_location FROM demographic WHERE demographic.subject_id = "22377" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_14 (year VARCHAR, title VARCHAR)
### Question ###
What is the Year of Rio?
### Accurate SQL ###
| SELECT year FROM table_name_14 WHERE title = "rio" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE prescriptions ( subject_id text, hadm_id text, icustay_id text, drug_type text, drug text, formulary_drug_cd text, route text, drug_dose text )
TABLE: CREATE TABLE demographic ( subject_id text, hadm_id text, name text, marital_status text, age text, dob text, gender text, language text, religion text, admission_type text, days_stay text, insurance text, ethnicity text, expire_flag text, admission_location text, discharge_location text, diagnosis text, dod text, dob_year text, dod_year text, admittime text, dischtime text, admityear text )
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE lab ( subject_id text, hadm_id text, itemid text, charttime text, flag text, value_unit text, label text, fluid text )
TABLE: CREATE TABLE diagnoses ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
### Question ###
provide the number of patients on base type drug prescription who were diagnosed with closed fracture of t1-t6 level with other specified spinal cord injury.
### 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 = "T1-t6 fx-cl/cord inj NEC" AND prescriptions.drug_type = "BASE" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE SuggestedEdits ( Id number, PostId number, CreationDate time, ApprovalDate time, RejectionDate time, OwnerUserId number, Comment text, Text text, Title text, Tags text, RevisionGUID other )
TABLE: CREATE TABLE 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 TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE ReviewRejectionReasons ( Id number, Name text, Description text, PostTypeId number )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
TABLE: CREATE TABLE PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId number )
TABLE: CREATE TABLE 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 VoteTypes ( Id number, Name 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 PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount 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 CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE CloseReasonTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
### Question ###
Almost Good Questions and Answers.
### Accurate SQL ###
| SELECT a.Id AS "post_link", Users.DisplayName FROM Posts AS a JOIN Users ON a.OwnerUserId = Users.Id WHERE Score = 24 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_97 ( tonnage INTEGER, nationality VARCHAR, name_of_ship VARCHAR )
### Question ###
What was the average tonnage for the Siljan ship from Sweden?
### Accurate SQL ###
| SELECT AVG(tonnage) FROM table_name_97 WHERE nationality = "sweden" AND name_of_ship = "siljan" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_5462 ( "Season" text, "Races" real, "Wins" real, "Podiums" real, "Poles" real, "Fastest Laps" real )
### Question ###
Which Poles has a Wins larger than 0, and a Podiums smaller than 17?
### Accurate SQL ###
| SELECT "Poles" FROM table_5462 WHERE "Wins" > '0' AND "Podiums" < '17' AND "Fastest Laps" = '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_90 (location__numbersites__global_local_ VARCHAR, software VARCHAR, ipv6_address VARCHAR)
### Question ###
What is the location for the software of BIND and an IPv6 address of 2001:503:c27::2:30?
### Accurate SQL ###
| SELECT location__numbersites__global_local_ FROM table_name_90 WHERE software = "bind" AND ipv6_address = "2001:503:c27::2:30" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_31 (notes VARCHAR, country VARCHAR)
### Question ###
What are the notes of the United States?
### Accurate SQL ###
| SELECT notes FROM table_name_31 WHERE country = "united states" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_29466 ( "Team" text, "Outgoing manager" text, "Manner of departure" text, "Date of vacancy" text, "Replaced by" text, "Date of appointment" text )
### Question ###
Who replaced Michel Preud'homme?
### Accurate SQL ###
| SELECT "Replaced by" FROM table_29466 WHERE "Outgoing manager" = 'Michel Preud''homme' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_62 (years_for_grizzlies VARCHAR, school_club_team VARCHAR)
### Question ###
Which years did the player from Providence play for Memphis?
### Accurate SQL ###
| SELECT years_for_grizzlies FROM table_name_62 WHERE school_club_team = "providence" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_7914 ( "Name" text, "League" real, "FA Cup" real, "League Cup" real, "Total" real )
### Question ###
what is the lowest total when the league cup is more than 0, the name is hei ar helguson and the league is less than 3?
### Accurate SQL ###
| SELECT MIN("Total") FROM table_7914 WHERE "League Cup" > '0' AND "Name" = 'heiðar helguson' AND "League" < '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_75 ( unit VARCHAR, construction_start VARCHAR )
### Question ###
Construction start of 1 december 1984 is what unit?
### Accurate SQL ###
| SELECT unit FROM table_name_75 WHERE construction_start = "1 december 1984" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_24036 ( "Tour" text, "Mens singles" text, "Womens singles" text, "Mens doubles" text, "Womens doubles" text, "Mixed doubles" text )
### Question ###
when womens singles is wang yihan and tour is french super series, what were the men's singles?
### Accurate SQL ###
| SELECT "Mens singles" FROM table_24036 WHERE "Womens singles" = 'Wang Yihan' AND "Tour" = 'French Super Series' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_1 (opponent VARCHAR, date VARCHAR)
### Question ###
what team played on may 11
### Accurate SQL ###
| SELECT opponent FROM table_name_1 WHERE date = "may 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 ( europa_league INTEGER )
### Question ###
Name the least europa league
### Accurate SQL ###
| SELECT MIN(europa_league) FROM table |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 (label VARCHAR, format VARCHAR)
### Question ###
What label has cd single as the format?
### Accurate SQL ###
| SELECT label FROM table_name_20 WHERE format = "cd single" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE procedures ( subject_id text, hadm_id text, icd9_code text, short_title text, long_title text )
TABLE: CREATE TABLE 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 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 ###
provide the number of patients whose diagnosis short title is late ef-hemplga side nos and lab test abnormal status is delta.
### 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.short_title = "Late ef-hemplga side NOS" AND lab.flag = "delta" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_18 ( runner_up VARCHAR, year VARCHAR )
### Question ###
Name the Runner-up of a Year in 1963?
### Accurate SQL ###
| SELECT runner_up FROM table_name_18 WHERE year = 1963 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE Guests ( guest_id INTEGER, gender_code CHAR(1), guest_first_name VARCHAR(80), guest_last_name VARCHAR(80), date_of_birth DATETIME )
TABLE: CREATE TABLE Apartments ( apt_id INTEGER, building_id INTEGER, apt_type_code CHAR(15), apt_number CHAR(10), bathroom_count INTEGER, bedroom_count INTEGER, room_count CHAR(5) )
TABLE: CREATE TABLE Apartment_Facilities ( apt_id INTEGER, facility_code CHAR(15) )
TABLE: CREATE TABLE View_Unit_Status ( apt_id INTEGER, apt_booking_id INTEGER, status_date DATETIME, available_yn BIT )
TABLE: CREATE TABLE Apartment_Buildings ( building_id INTEGER, building_short_name CHAR(15), building_full_name VARCHAR(80), building_description VARCHAR(255), building_address VARCHAR(255), building_manager VARCHAR(50), building_phone VARCHAR(80) )
TABLE: CREATE TABLE Apartment_Bookings ( apt_booking_id INTEGER, apt_id INTEGER, guest_id INTEGER, booking_status_code CHAR(15), booking_start_date DATETIME, booking_end_date DATETIME )
### Question ###
Return the date of birth for all the guests with gender code 'Male', and count them by a line chart, I want to show x axis in ascending order.
### Accurate SQL ###
| SELECT date_of_birth, COUNT(date_of_birth) FROM Guests WHERE gender_code = "Male" ORDER BY date_of_birth |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE club ( Club_ID int, name text, Region text, Start_year text )
TABLE: CREATE TABLE player ( Player_ID int, name text, Position text, Club_ID int, Apps real, Tries real, Goals text, Points real )
TABLE: CREATE TABLE competition_result ( Competition_ID int, Club_ID_1 int, Club_ID_2 int, Score text )
TABLE: CREATE TABLE club_rank ( Rank real, Club_ID int, Gold real, Silver real, Bronze real, Total real )
TABLE: CREATE TABLE competition ( Competition_ID int, Year real, Competition_type text, Country text )
### Question ###
Show me the number of country by country in a histogram, rank by the the number of country in desc.
### Accurate SQL ###
| SELECT Country, COUNT(Country) FROM competition GROUP BY Country ORDER BY COUNT(Country) DESC |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_7 (time VARCHAR, ground VARCHAR)
### Question ###
What is the Time with a Ground that is humber college north?
### Accurate SQL ###
| SELECT time FROM table_name_7 WHERE ground = "humber college north" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_1342218_5 (candidates VARCHAR, district VARCHAR)
### Question ###
Who is the candidate for the district Arkansas 2?
### Accurate SQL ###
| SELECT candidates FROM table_1342218_5 WHERE district = "Arkansas 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 PostNoticeTypes ( Id number, ClassId number, Name text, Body text, IsHidden boolean, Predefined boolean, PostNoticeDurationId 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 ReviewTaskResultTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE Badges ( Id number, UserId number, Name text, Date time, Class number, TagBased boolean )
TABLE: CREATE TABLE TagSynonyms ( Id number, SourceTagName text, TargetTagName text, CreationDate time, OwnerUserId number, AutoRenameCount number, LastAutoRename time, Score number, ApprovedByUserId number, ApprovalDate time )
TABLE: CREATE TABLE PostFeedback ( Id number, PostId number, IsAnonymous boolean, VoteTypeId number, CreationDate time )
TABLE: CREATE TABLE PostNotices ( Id number, PostId number, PostNoticeTypeId number, CreationDate time, DeletionDate time, ExpiryDate time, Body text, OwnerUserId number, DeletionUserId number )
TABLE: CREATE TABLE 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 Comments ( Id number, PostId number, Score number, Text text, CreationDate time, UserDisplayName text, UserId number, ContentLicense text )
TABLE: CREATE TABLE FlagTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE PostHistory ( Id number, PostHistoryTypeId number, PostId number, RevisionGUID other, CreationDate time, UserId number, UserDisplayName text, Comment text, Text text, ContentLicense text )
TABLE: CREATE TABLE Tags ( Id number, TagName text, Count number, ExcerptPostId number, WikiPostId number )
TABLE: CREATE TABLE ReviewTaskTypes ( Id number, Name text, Description text )
TABLE: CREATE TABLE SuggestedEditVotes ( Id number, SuggestedEditId number, UserId number, VoteTypeId number, CreationDate time, TargetUserId number, TargetRepChange number )
TABLE: CREATE TABLE Votes ( Id number, PostId number, VoteTypeId number, UserId number, CreationDate time, BountyAmount number )
TABLE: CREATE TABLE PostHistoryTypes ( Id number, Name text )
TABLE: CREATE TABLE CloseAsOffTopicReasonTypes ( Id number, IsUniversal boolean, InputTitle text, MarkdownInputGuidance text, MarkdownPostOwnerGuidance text, MarkdownPrivilegedUserGuidance text, MarkdownConcensusDescription text, CreationDate time, CreationModeratorId number, ApprovalDate time, ApprovalModeratorId number, DeactivationDate time, DeactivationModeratorId number )
TABLE: CREATE TABLE PendingFlags ( Id number, FlagTypeId number, PostId number, CreationDate time, CloseReasonTypeId number, CloseAsOffTopicReasonTypeId number, DuplicateOfQuestionId number, BelongsOnBaseHostAddress text )
TABLE: CREATE TABLE CloseReasonTypes ( 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 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 PostsWithDeleted ( Id number, PostTypeId number, AcceptedAnswerId number, ParentId number, CreationDate time, DeletionDate time, Score number, ViewCount number, Body text, OwnerUserId number, OwnerDisplayName text, LastEditorUserId number, LastEditorDisplayName text, LastEditDate time, LastActivityDate time, Title text, Tags text, AnswerCount number, CommentCount number, FavoriteCount number, ClosedDate time, CommunityOwnedDate time, ContentLicense text )
TABLE: CREATE TABLE ReviewTaskStates ( Id number, Name text, Description text )
TABLE: CREATE TABLE ReviewTasks ( Id number, ReviewTaskTypeId number, CreationDate time, DeletionDate time, ReviewTaskStateId number, PostId number, SuggestedEditId number, CompletedByReviewTaskId number )
TABLE: CREATE TABLE PostTags ( PostId number, TagId number )
TABLE: CREATE TABLE PostTypes ( Id number, Name text )
TABLE: CREATE TABLE PostLinks ( Id number, CreationDate time, PostId number, RelatedPostId number, LinkTypeId number )
### Question ###
Top 250 users From Bangladesh.
### Accurate SQL ###
| SELECT ROW_NUMBER() OVER (ORDER BY Users.Reputation DESC) AS "#", Users.Id AS "user_link", Users.Reputation, Users.Location, Users.UpVotes, Users.DownVotes, Users.CreationDate FROM Users WHERE LOWER(Location) LIKE '%khulna%' ORDER BY Reputation DESC LIMIT 250 |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_33581 ( "Home team" text, "Home team score" text, "Away team" text, "Away team score" text, "Venue" text, "Crowd" real, "Date" text )
### Question ###
What is melbourne's home team score?
### Accurate SQL ###
| SELECT "Home team score" FROM table_33581 WHERE "Home team" = 'melbourne' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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_61772 ( "Show" text, "Date" text, "Official ratings (millions)" real, "Weekly rank" text, "Share" text )
### Question ###
When were the shares 39.1%?
### Accurate SQL ###
| SELECT "Date" FROM table_61772 WHERE "Share" = '39.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_5789 ( "Date" text, "Tournament" text, "Surface" text, "Partnering" text, "Opponents in the final" text, "Score" text )
### Question ###
WHich Score has marcelo filippini mark koevermans?
### Accurate SQL ###
| SELECT "Score" FROM table_5789 WHERE "Opponents in the final" = 'marcelo filippini mark koevermans' |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.
### Tables ###
TABLE: CREATE TABLE table_name_45 ( tournament VARCHAR )
### Question ###
What result in 1994 has a SR as the tournament?
### Accurate SQL ###
| SELECT 1994 FROM table_name_45 WHERE tournament = "sr" |
Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only 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 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 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 )
### Question ###
provide the number of patients whose age is less than 89 and diagnoses long title is candidiasis of vulva and vagina?
### Accurate SQL ###
| SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.age < "89" AND diagnoses.long_title = "Candidiasis of vulva and vagina" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.