schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_41996 ("Date" TEXT, "Location" TEXT, "Country" TEXT, "Event" TEXT, "Winner" TEXT, "Runner-up" TEXT)
Who was the Runner-up when the game was played at Bells Beach?
SELECT "Runner-up" FROM table_41996 WHERE "Location" = 'bells beach'
SELECT "Runner-up" FROM "table_41996" WHERE "Location" = 'bells beach'
0.068359
CREATE TABLE table_74383 ("Team" TEXT, "Outgoing manager" TEXT, "Manner of departure" TEXT, "Date of vacancy" TEXT, "Position in table" TEXT, "Replaced by" TEXT, "Date of appointment" TEXT)
Who was the new Santos manager?
SELECT "Replaced by" FROM table_74383 WHERE "Team" = 'Santos'
SELECT "Replaced by" FROM "table_74383" WHERE "Team" = 'Santos'
0.061523
CREATE TABLE Ship (Ship_ID INT, Name TEXT, Type TEXT, Built_Year FLOAT, Class TEXT, Flag TEXT) CREATE TABLE captain (Captain_ID INT, Name TEXT, Ship_ID INT, age TEXT, Class TEXT, Rank TEXT)
How many captains with younger than 50 are in each rank.
SELECT Rank, COUNT(*) FROM captain WHERE age < 50 GROUP BY Rank
SELECT "Rank", COUNT(*) FROM "captain" WHERE "age" < 50 GROUP BY "Rank"
0.069336
CREATE TABLE table_53870 ("Ship" TEXT, "Built" FLOAT, "Entered service" FLOAT, "Route" TEXT, "Gross tonnage" TEXT, "Length" TEXT, "Width" TEXT, "Passengers" FLOAT, "Vessels" FLOAT, "Knots" FLOAT)
What is the most recent built year when the year of entering service was more recent than 2003, and the knots is less than 27?
SELECT MAX("Built") FROM table_53870 WHERE "Entered service" > '2003' AND "Knots" < '27'
SELECT MAX("Built") FROM "table_53870" WHERE "Entered service" > '2003' AND "Knots" < '27'
0.087891
CREATE TABLE table_42253 ("Round" TEXT, "Date" TEXT, "Home team" TEXT, "Score" TEXT, "Away team" TEXT)
On what date was the 4th round, with home team Itabuna, played?
SELECT "Date" FROM table_42253 WHERE "Round" = '4th' AND "Home team" = 'itabuna'
SELECT "Date" FROM "table_42253" WHERE "Home team" = 'itabuna' AND "Round" = '4th'
0.080078
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
Tag associated with other tags.
SELECT MAX(t2.TagName) AS LeftTag, MAX(t.TagName) AS RightTag, COUNT(pt2.TagId) AS LeftCount, MAX(t.Count) AS RightCount, (CAST(COUNT(pt2.TagId) AS FLOAT) / CAST(MAX(t.Count) AS FLOAT)) AS Per FROM PostTags AS pt JOIN PostTags AS pt2 ON pt.PostId = pt2.PostId JOIN Tags AS t ON pt.TagId = t.Id JOIN Tags AS t2 ON pt2.TagId = t2.Id WHERE ('##LeftTag?all##' = 'all' OR t2.TagName = '##LeftTag##') AND ('##RightTag?all##' = 'all' OR t.TagName = '##RightTag##') AND t.Count >= '##TagCountFilter?10##' AND t2.Count >= '##TagCountFilter##' AND pt.TagId != pt2.TagId GROUP BY pt.TagId, pt2.TagId HAVING '##PerFilter?0##' <= 0 OR (CAST(COUNT(pt2.TagId) AS FLOAT) / CAST(MAX(t.Count) AS FLOAT)) > '##PerFilter##' ORDER BY Per DESC LIMIT 250
SELECT MAX("t2"."TagName") AS "LeftTag", MAX("t"."TagName") AS "RightTag", COUNT("pt2"."TagId") AS "LeftCount", MAX("t"."Count") AS "RightCount", (CAST(COUNT("pt2"."TagId") AS FLOAT) / NULLIF(CAST(MAX("t"."Count") AS FLOAT), 0)) AS "Per" FROM "PostTags" AS "pt" JOIN "PostTags" AS "pt2" ON "pt"."PostId" = "pt2"."PostId" AND "pt"."TagId" <> "pt2"."TagId" JOIN "Tags" AS "t" ON "pt"."TagId" = "t"."Id" AND "t"."Count" >= '##TagCountFilter?10##' AND "t"."TagName" = '##RightTag##' JOIN "Tags" AS "t2" ON "pt2"."TagId" = "t2"."Id" AND "t2"."Count" >= '##TagCountFilter##' AND "t2"."TagName" = '##LeftTag##' GROUP BY "pt"."TagId", "pt2"."TagId" HAVING '##PerFilter?0##' <= 0 OR (CAST(COUNT("pt2"."TagId") AS FLOAT) / NULLIF(CAST(MAX("t"."Count") AS FLOAT), 0)) > '##PerFilter##' ORDER BY "Per" DESC NULLS LAST LIMIT 250
0.795898
CREATE TABLE table_name_99 (position VARCHAR, height VARCHAR, current_club VARCHAR)
What's the position of the player with a Height of 2.06 and club of Triumph Lyubertsy?
SELECT position FROM table_name_99 WHERE height = 2.06 AND current_club = "triumph lyubertsy"
SELECT "position" FROM "table_name_99" WHERE "current_club" = "triumph lyubertsy" AND "height" = 2.06
0.098633
CREATE TABLE table_21100348_10 (innings VARCHAR, average VARCHAR)
How man innings were there during the period with a career average of 41.43?
SELECT innings FROM table_21100348_10 WHERE average = "41.43"
SELECT "innings" FROM "table_21100348_10" WHERE "41.43" = "average"
0.06543
CREATE TABLE editor (Editor_ID INT, Name TEXT, Age FLOAT) CREATE TABLE journal_committee (Editor_ID INT, Journal_ID INT, Work_Type TEXT) CREATE TABLE journal (Journal_ID INT, Date TEXT, Theme TEXT, Sales INT)
Compare each editors' ages using a bar chart, sort by the Y in asc.
SELECT Name, Age FROM editor ORDER BY Age
SELECT "Name", "Age" FROM "editor" ORDER BY "Age" NULLS FIRST
0.05957
CREATE TABLE table_19789597_5 (date VARCHAR, score VARCHAR)
Name the total number of date for l 63-77
SELECT COUNT(date) FROM table_19789597_5 WHERE score = "L 63-77"
SELECT COUNT("date") FROM "table_19789597_5" WHERE "L 63-77" = "score"
0.068359
CREATE TABLE table_68122 ("Season" TEXT, "Overall Spectators" FLOAT, "Per game" FLOAT, "Best supported Club" TEXT, "Spectators /game" FLOAT, "Top goal scorer" TEXT, "Goals" FLOAT)
what is the best supported club with a 25 Goal and a per game larger than 1,156?
SELECT "Best supported Club" FROM table_68122 WHERE "Goals" = '25' AND "Per game" > '1,156'
SELECT "Best supported Club" FROM "table_68122" WHERE "Goals" = '25' AND "Per game" > '1,156'
0.09082
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT)
Number of unclosed questions with close votes per month.
SELECT DATE(MIN(P.CreationDate)) AS PostDay, COUNT(DISTINCT P.Id) FROM Posts AS P INNER JOIN PendingFlags AS PF ON P.Id = PF.PostId WHERE PF.FlagTypeId = 14 GROUP BY YEAR(P.CreationDate), MONTH(P.CreationDate) ORDER BY PostDay
SELECT CAST(MIN("P"."CreationDate") AS DATE) AS "PostDay", COUNT(DISTINCT "P"."Id") FROM "Posts" AS "P" JOIN "PendingFlags" AS "PF" ON "P"."Id" = "PF"."PostId" AND "PF"."FlagTypeId" = 14 GROUP BY YEAR("P"."CreationDate"), MONTH("P"."CreationDate") ORDER BY "PostDay" NULLS FIRST
0.271484
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
provide the number of patients whose marital status is single and diagnoses icd9 code is 496?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "SINGLE" AND diagnoses.icd9_code = "496"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "496" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "SINGLE" = "demographic"."marital_status"
0.214844
CREATE TABLE table_12407 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT)
Who is the player with a 70-68-74=212 score?
SELECT "Player" FROM table_12407 WHERE "Score" = '70-68-74=212'
SELECT "Player" FROM "table_12407" WHERE "Score" = '70-68-74=212'
0.063477
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
Comments on my posts containing the given phrase (case insensitive).
SELECT c.Id AS "comment_link", c.Text, c.UserId AS "user_link", c.CreationDate FROM Comments AS c INNER JOIN Posts AS p ON c.PostId = p.Id WHERE (p.OwnerUserId = '##UserId?122424##') AND (c.Text LIKE '%##WordA?possible##%' COLLATE Latin1_General_CI_AI) AND (c.Text LIKE '%##WordB?has##%' COLLATE Latin1_General_CI_AI)
SELECT "c"."Id" AS "comment_link", "c"."Text", "c"."UserId" AS "user_link", "c"."CreationDate" FROM "Comments" AS "c" JOIN "Posts" AS "p" ON "c"."PostId" = "p"."Id" AND "p"."OwnerUserId" = '##UserId?122424##' WHERE "c"."Text" LIKE COLLATE('%##WordA?possible##%', "Latin1_General_CI_AI") AND "c"."Text" LIKE COLLATE('%##WordB?has##%', "Latin1_General_CI_AI")
0.348633
CREATE TABLE table_name_92 (series VARCHAR, actor VARCHAR)
Which Series has an Actor of tom ward?
SELECT series FROM table_name_92 WHERE actor = "tom ward"
SELECT "series" FROM "table_name_92" WHERE "actor" = "tom ward"
0.061523
CREATE TABLE table_77466 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
What is the Date of the game in Vancouver?
SELECT "Date" FROM table_77466 WHERE "Home" = 'vancouver'
SELECT "Date" FROM "table_77466" WHERE "Home" = 'vancouver'
0.057617
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
give me the number of patients whose admission year is less than 2115 and lab test name is quantitative g6pd?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2115" AND lab.label = "Quantitative G6PD"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Quantitative G6PD" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2115" > "demographic"."admityear"
0.200195
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
Number of entries in PostHistory.
SELECT COUNT(*) FROM PostHistory
SELECT COUNT(*) FROM "PostHistory"
0.033203
CREATE TABLE table_16886076_1 (para VARCHAR, commewijne VARCHAR)
Name the para for 1.5% commewijne
SELECT para FROM table_16886076_1 WHERE commewijne = "1.5%"
SELECT "para" FROM "table_16886076_1" WHERE "1.5%" = "commewijne"
0.063477
CREATE TABLE table_name_32 (laps VARCHAR, time_retired VARCHAR, grid VARCHAR)
I want the total number of Laps for time/retired for + 4 Laps and grid more than 20
SELECT COUNT(laps) FROM table_name_32 WHERE time_retired = "+ 4 laps" AND grid > 20
SELECT COUNT("laps") FROM "table_name_32" WHERE "+ 4 laps" = "time_retired" AND "grid" > 20
0.088867
CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) 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) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) 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) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) 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) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) 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) 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) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) 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) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) 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) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT)
NEWARK to MINNEAPOLIS on sunday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'MINNEAPOLIS' AND date_day.day_number = 27 AND date_day.month_number = 8 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'NEWARK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 27 AND "date_day"."month_number" = 8 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'NEWARK' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'MINNEAPOLIS'
0.708008
CREATE TABLE table_24798489_1 (episode_number VARCHAR, location VARCHAR)
How many episodes had New York, New York as the location?
SELECT COUNT(episode_number) FROM table_24798489_1 WHERE location = "New York, New York"
SELECT COUNT("episode_number") FROM "table_24798489_1" WHERE "New York, New York" = "location"
0.091797
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
when patient 17667 got his arterial bp mean measured for the last time since 08/20/2105?
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 17667)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp mean' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) >= '2105-08-20' ORDER BY chartevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 17667 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'arterial bp mean' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."charttime" FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "chartevents"."charttime") >= '2105-08-20' ORDER BY "chartevents"."charttime" DESC NULLS LAST LIMIT 1
0.800781
CREATE TABLE table_69291 ("Name" TEXT, "Years" TEXT, "Gender" TEXT, "Area" TEXT, "Authority" TEXT, "Decile" FLOAT, "Roll" FLOAT)
What school in Dalefield has a roll less than 81?
SELECT "Name" FROM table_69291 WHERE "Roll" < '81' AND "Area" = 'dalefield'
SELECT "Name" FROM "table_69291" WHERE "Area" = 'dalefield' AND "Roll" < '81'
0.075195
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
did patient 15754's respiratory rate ever greater than 26.0 since 89 months ago.
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 15754)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 26.0 AND DATETIME(chartevents.charttime) >= DATETIME(CURRENT_TIME(), '-89 month')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 15754 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'respiratory rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE "chartevents"."valuenum" > 26.0 AND DATETIME("chartevents"."charttime") >= DATETIME(CURRENT_TIME(), '-89 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.77832
CREATE TABLE table_8383 ("Pick" FLOAT, "Player" TEXT, "Pos." TEXT, "Nationality" TEXT, "Team" TEXT, "Previous team" TEXT, "NBA years [a ]" TEXT, "Career with the franchise [b ]" TEXT)
What is Career with the franchise [b ], when Previous Team is 'New Jersey Nets'?
SELECT "Career with the franchise [b ]" FROM table_8383 WHERE "Previous team" = 'new jersey nets'
SELECT "Career with the franchise [b ]" FROM "table_8383" WHERE "Previous team" = 'new jersey nets'
0.09668
CREATE TABLE table_68164 ("Year" FLOAT, "Entrant" TEXT, "Chassis" TEXT, "Engine" TEXT, "Points" FLOAT)
How many points did Team Rothmans International have after 1975 when their Chassis was a March 771?
SELECT "Points" FROM table_68164 WHERE "Year" > '1975' AND "Entrant" = 'team rothmans international' AND "Chassis" = 'march 771'
SELECT "Points" FROM "table_68164" WHERE "Chassis" = 'march 771' AND "Entrant" = 'team rothmans international' AND "Year" > '1975'
0.126953
CREATE TABLE table_44192 ("Season" TEXT, "Competition" TEXT, "Round" TEXT, "Club" TEXT, "1st Leg" TEXT, "2nd Leg" TEXT)
What is the 1st leg of the UEFA Champions League Compeition in the Skonto Riga Club?
SELECT "1st Leg" FROM table_44192 WHERE "Competition" = 'uefa champions league' AND "Club" = 'skonto riga'
SELECT "1st Leg" FROM "table_44192" WHERE "Club" = 'skonto riga' AND "Competition" = 'uefa champions league'
0.105469
CREATE TABLE table_name_89 (bodyweight INT, snatch VARCHAR)
what is the average bodyweight when snatch is 80?
SELECT AVG(bodyweight) FROM table_name_89 WHERE snatch = 80
SELECT AVG("bodyweight") FROM "table_name_89" WHERE "snatch" = 80
0.063477
CREATE TABLE table_44909 ("Team" TEXT, "Manager" TEXT, "Home city" TEXT, "Stadium" TEXT, "Capacity" FLOAT)
what is the capacity for the team ibenik?
SELECT MIN("Capacity") FROM table_44909 WHERE "Team" = 'šibenik'
SELECT MIN("Capacity") FROM "table_44909" WHERE "Team" = 'šibenik'
0.064453
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) 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) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE month (month_number INT, month_name TEXT) 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) 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) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) 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) 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) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) 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) 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) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
is ground transportation available in PHILADELPHIA
SELECT DISTINCT ground_service.transport_type FROM city, ground_service WHERE city.city_name = 'PHILADELPHIA' AND ground_service.city_code = city.city_code
SELECT DISTINCT "ground_service"."transport_type" FROM "city" JOIN "ground_service" ON "city"."city_code" = "ground_service"."city_code" WHERE "city"."city_name" = 'PHILADELPHIA'
0.173828
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
Most controversial users of a site, v2.
WITH UserVotes AS (SELECT Users.Id AS UserId, MIN(Users.Reputation) AS Reputation, Votes.VoteTypeId, COUNT(*) AS N FROM Users LEFT JOIN Posts ON Posts.OwnerUserId = Users.Id LEFT JOIN Votes ON Votes.PostId = Posts.Id WHERE Votes.VoteTypeId IN (2, 3) GROUP BY Users.Id, Votes.VoteTypeId), UserUpDown AS (SELECT Up.UserId, Up.Reputation, Up.N AS UpVotes, Down.N AS DownVotes, 1.0 * Down.N / (Up.N + Down.N) AS DownRatio FROM UserVotes AS Up, UserVotes AS Down WHERE Up.UserId = Down.UserId AND Up.VoteTypeId = 2 AND Down.VoteTypeId = 3 AND Down.N > 0 AND Up.N > 0) SELECT * FROM UserUpDown LIMIT 100
WITH "UserVotes" AS (SELECT "Users"."Id" AS "UserId", MIN("Users"."Reputation") AS "Reputation", "Votes"."VoteTypeId", COUNT(*) AS "N" FROM "Users" LEFT JOIN "Posts" ON "Posts"."OwnerUserId" = "Users"."Id" LEFT JOIN "Votes" ON "Posts"."Id" = "Votes"."PostId" WHERE "Votes"."VoteTypeId" IN (2, 3) GROUP BY "Users"."Id", "Votes"."VoteTypeId"), "UserUpDown" AS (SELECT "Up"."UserId", "Up"."Reputation", "Up"."N" AS "UpVotes", "Down"."N" AS "DownVotes", 1.0 * "Down"."N" / NULLIF(("Up"."N" + "Down"."N"), 0) AS "DownRatio" FROM "UserVotes" AS "Up" JOIN "UserVotes" AS "Down" ON "Down"."N" > 0 AND "Down"."UserId" = "Up"."UserId" AND "Down"."VoteTypeId" = 3 WHERE "Up"."N" > 0 AND "Up"."VoteTypeId" = 2) SELECT * FROM "UserUpDown" LIMIT 100
0.717773
CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT) CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT) CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR) CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR) CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR) CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME)
How many courses for each course description? Show me a bar chart, and show in descending by the Y-axis.
SELECT CRS_DESCRIPTION, COUNT(CRS_DESCRIPTION) FROM CLASS AS T1 JOIN EMPLOYEE AS T2 ON T1.PROF_NUM = T2.EMP_NUM JOIN COURSE AS T3 ON T1.CRS_CODE = T3.CRS_CODE JOIN PROFESSOR AS T4 ON T2.EMP_NUM = T4.EMP_NUM GROUP BY CRS_DESCRIPTION ORDER BY COUNT(CRS_DESCRIPTION) DESC
SELECT "CRS_DESCRIPTION", COUNT("CRS_DESCRIPTION") FROM "CLASS" AS "T1" JOIN "EMPLOYEE" AS "T2" ON "T1"."PROF_NUM" = "T2"."EMP_NUM" JOIN "COURSE" AS "T3" ON "T1"."CRS_CODE" = "T3"."CRS_CODE" JOIN "PROFESSOR" AS "T4" ON "T2"."EMP_NUM" = "T4"."EMP_NUM" GROUP BY "CRS_DESCRIPTION" ORDER BY COUNT("CRS_DESCRIPTION") DESC NULLS LAST
0.319336
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients born in or before 2155 have procedure icd9 code 3806?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2155.0" AND procedures.icd9_code = "3806"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "3806" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2155.0" >= "demographic"."dod_year"
0.213867
CREATE TABLE table_73600 ("Name" TEXT, "Location" TEXT, "Act. Units" FLOAT, "Stacks" TEXT, "In Service Dates" TEXT, "Unit Capacity ( 2009 ) " TEXT, "Nameplate Capacity ( 2009 MW ) " TEXT, "Owner Type" TEXT, "Owner ( s ) ( 2009 ) " TEXT)
Name the number of stacks for 1 & 2 235 mw 3 & 4 88.2 mw
SELECT COUNT("Stacks") FROM table_73600 WHERE "Unit Capacity (2009)" = '1 & 2 235 MW 3 & 4 88.2 MW'
SELECT COUNT("Stacks") FROM "table_73600" WHERE "Unit Capacity (2009)" = '1 & 2 235 MW 3 & 4 88.2 MW'
0.098633
CREATE TABLE table_name_52 (bronze INT, total VARCHAR, silver VARCHAR, rank VARCHAR)
What is the average number of bronze medals of the team with 0 silvers, ranked 3, and less than 1 total medal?
SELECT AVG(bronze) FROM table_name_52 WHERE silver = 0 AND rank = "3" AND total < 1
SELECT AVG("bronze") FROM "table_name_52" WHERE "3" = "rank" AND "silver" = 0 AND "total" < 1
0.09082
CREATE TABLE table_13636_1 (first_operational VARCHAR, programming VARCHAR)
what's the first operational with programming being not programmable single purpose
SELECT first_operational FROM table_13636_1 WHERE programming = "Not programmable—single purpose"
SELECT "first_operational" FROM "table_13636_1" WHERE "Not programmable—single purpose" = "programming"
0.100586
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
Count the number of living patients who had a calculated hematocrit lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.expire_flag = "0" AND lab.label = "Hematocrit, Calculated"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Hematocrit, Calculated" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "0" = "demographic"."expire_flag"
0.204102
CREATE TABLE candidate (Candidate_ID INT, People_ID INT, Poll_Source TEXT, Date TEXT, Support_rate FLOAT, Consider_rate FLOAT, Oppose_rate FLOAT, Unsure_rate FLOAT) CREATE TABLE people (People_ID INT, Sex TEXT, Name TEXT, Date_of_Birth TEXT, Height FLOAT, Weight FLOAT)
Show me about the distribution of Sex and the amount of Sex , and group by attribute Sex in a bar chart, and sort by the bars from high to low please.
SELECT Sex, COUNT(Sex) FROM people GROUP BY Sex ORDER BY Sex DESC
SELECT "Sex", COUNT("Sex") FROM "people" GROUP BY "Sex" ORDER BY "Sex" DESC NULLS LAST
0.083984
CREATE TABLE table_204_862 (id DECIMAL, "rank" DECIMAL, "bib" DECIMAL, "athlete" TEXT, "country" TEXT, "run 1" TEXT, "run 2" TEXT, "total" TEXT, "behind" DECIMAL)
how long was daniel pfister behind first place /
SELECT "behind" FROM table_204_862 WHERE "athlete" = 'daniel pfister'
SELECT "behind" FROM "table_204_862" WHERE "athlete" = 'daniel pfister'
0.069336
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
tell the number of male patients who have been prescribed heparin flush (10 units/ml).
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.drug = "Heparin Flush (10 units/ml)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Heparin Flush (10 units/ml)" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "M" = "demographic"."gender"
0.232422
CREATE TABLE table_name_22 (city VARCHAR, name VARCHAR)
Name the city for athous lavrensis
SELECT city FROM table_name_22 WHERE name = "athous lavrensis"
SELECT "city" FROM "table_name_22" WHERE "athous lavrensis" = "name"
0.066406
CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
What are the total enrollments of universities of each affiliation type. Plot them as bar chart.
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation
SELECT "Affiliation", SUM("Enrollment") FROM "university" GROUP BY "Affiliation"
0.078125
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
Posts tagged with only [tag] with no answers and low [views].
SELECT Posts.Id AS "post_link", Posts.CommentCount AS "#_comments", Posts.ViewCount AS "#_views" FROM Tags RIGHT JOIN Posts ON Posts.Tags = '<' + TagName + '>' WHERE Posts.AnswerCount = 0 AND Posts.Score >= 0 AND Posts.ViewCount <= @views AND TagName LIKE ('%' + CASE WHEN @tagToSearch != 'all' THEN @tagToSearch ELSE '' END + '%') AND Posts.CommentCount <= CASE WHEN @comments < 0 THEN Posts.CommentCount ELSE @comments END ORDER BY '#_views'
SELECT "Posts"."Id" AS "post_link", "Posts"."CommentCount" AS "#_comments", "Posts"."ViewCount" AS "#_views" FROM "Tags" RIGHT JOIN "Posts" ON "Posts"."AnswerCount" = 0 AND "Posts"."CommentCount" <= CASE WHEN $comments < 0 THEN "Posts"."CommentCount" ELSE $comments END AND "Posts"."Score" >= 0 AND "Posts"."Tags" = '<' + "TagName" + '>' AND "Posts"."ViewCount" <= $views WHERE "TagName" LIKE ('%' + CASE WHEN $tagToSearch <> 'all' THEN $tagToSearch ELSE '' END + '%') ORDER BY '#_views' NULLS FIRST
0.487305
CREATE TABLE Rooms (RoomId TEXT, roomName TEXT, beds INT, bedType TEXT, maxOccupancy INT, basePrice INT, decor TEXT) CREATE TABLE Reservations (Code INT, Room TEXT, CheckIn TEXT, CheckOut TEXT, Rate FLOAT, LastName TEXT, FirstName TEXT, Adults INT, Kids INT)
What are the number of rooms for each bed type. Show a pie chart.
SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType
SELECT "bedType", COUNT(*) FROM "Rooms" GROUP BY "bedType"
0.056641
CREATE TABLE table_36350 ("Outcome" TEXT, "Date" TEXT, "Surface" TEXT, "Partner" TEXT, "Opponents" TEXT, "Score" TEXT)
Which Surface has a Partner of galina voskoboeva?
SELECT "Surface" FROM table_36350 WHERE "Partner" = 'galina voskoboeva'
SELECT "Surface" FROM "table_36350" WHERE "Partner" = 'galina voskoboeva'
0.071289
CREATE TABLE table_1745843_10 (part_3 VARCHAR, class VARCHAR)
What is part 1 of the verb in class 4
SELECT part_3 FROM table_1745843_10 WHERE class = "4"
SELECT "part_3" FROM "table_1745843_10" WHERE "4" = "class"
0.057617
CREATE TABLE table_12960 ("Year" FLOAT, "Delegate" TEXT, "Hometown" TEXT, "Placement in Miss World" TEXT, "Other awards" TEXT)
What's the latest year with a hometown of san carlos, pangasinan?
SELECT MAX("Year") FROM table_12960 WHERE "Hometown" = 'san carlos, pangasinan'
SELECT MAX("Year") FROM "table_12960" WHERE "Hometown" = 'san carlos, pangasinan'
0.079102
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
how did patient 76886 last be admitted to the hospital until 4 years ago?
SELECT admissions.admission_type FROM admissions WHERE admissions.subject_id = 76886 AND DATETIME(admissions.admittime) <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY admissions.admittime DESC LIMIT 1
SELECT "admissions"."admission_type" FROM "admissions" WHERE "admissions"."subject_id" = 76886 AND DATETIME("admissions"."admittime") <= DATETIME(CURRENT_TIME(), '-4 year') ORDER BY "admissions"."admittime" DESC NULLS LAST LIMIT 1
0.224609
CREATE TABLE table_train_262 ("id" INT, "gender" TEXT, "hemoglobin_a1c_hba1c" FLOAT, "obesity" BOOLEAN, "diabetic" TEXT, "hba1c" FLOAT, "body_mass_index_bmi" FLOAT, "age" FLOAT, "NOUSE" FLOAT)
diagnosed with type ii diabetes for at least one year
SELECT * FROM table_train_262 WHERE diabetic = 'ii'
SELECT * FROM "table_train_262" WHERE "diabetic" = 'ii'
0.053711
CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
Create a bar chart showing all_games_percent across all neutral, I want to display by the Y-axis from low to high.
SELECT All_Neutral, All_Games_Percent FROM basketball_match ORDER BY All_Games_Percent
SELECT "All_Neutral", "All_Games_Percent" FROM "basketball_match" ORDER BY "All_Games_Percent" NULLS FIRST
0.103516
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
how many patients is warfarin sodium 2.5 mg po tabs prescribed to?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'warfarin sodium 2.5 mg po tabs')
WITH "_u_0" AS (SELECT "medication"."patientunitstayid" FROM "medication" WHERE "medication"."drugname" = 'warfarin sodium 2.5 mg po tabs' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL
0.320313
CREATE TABLE table_29275 ("District" TEXT, "Counties Represented" TEXT, "Delegate" TEXT, "Party" TEXT, "First Elected" FLOAT, "Committee" TEXT)
For delegate is mcdonough, patrick l. pat mcdonough, specify all the district.
SELECT "District" FROM table_29275 WHERE "Delegate" = 'McDonough, Patrick L. Pat McDonough'
SELECT "District" FROM "table_29275" WHERE "Delegate" = 'McDonough, Patrick L. Pat McDonough'
0.09082
CREATE TABLE table_name_18 (place VARCHAR, country VARCHAR)
What is the Place of the Player from New Zealand?
SELECT place FROM table_name_18 WHERE country = "new zealand"
SELECT "place" FROM "table_name_18" WHERE "country" = "new zealand"
0.06543
CREATE TABLE ref_address_types (address_type_code TEXT, address_type_description TEXT) CREATE TABLE ref_detention_type (detention_type_code TEXT, detention_type_description TEXT) CREATE TABLE behavior_incident (incident_id DECIMAL, incident_type_code TEXT, student_id DECIMAL, date_incident_start TIME, date_incident_end TIME, incident_summary TEXT, recommendations TEXT, other_details TEXT) CREATE TABLE students (student_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, cell_mobile_number TEXT, email_address TEXT, date_first_rental TIME, date_left_university TIME, other_student_details TEXT) CREATE TABLE students_in_detention (student_id DECIMAL, detention_id DECIMAL, incident_id DECIMAL) CREATE TABLE student_addresses (student_id DECIMAL, address_id DECIMAL, date_address_from TIME, date_address_to TIME, monthly_rental DECIMAL, other_details TEXT) CREATE TABLE ref_incident_type (incident_type_code TEXT, incident_type_description TEXT) CREATE TABLE addresses (address_id DECIMAL, line_1 TEXT, line_2 TEXT, line_3 TEXT, city TEXT, zip_postcode TEXT, state_province_county TEXT, country TEXT, other_address_details TEXT) CREATE TABLE assessment_notes (notes_id DECIMAL, student_id DECIMAL, teacher_id DECIMAL, date_of_notes TIME, text_of_notes TEXT, other_details TEXT) CREATE TABLE detention (detention_id DECIMAL, detention_type_code TEXT, teacher_id DECIMAL, datetime_detention_start TIME, datetime_detention_end TIME, detention_summary TEXT, other_details TEXT) CREATE TABLE teachers (teacher_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, gender TEXT, cell_mobile_number TEXT, email_address TEXT, other_details TEXT)
Find the id and last name of the student that has the most behavior incidents?
SELECT T1.student_id, T2.last_name FROM behavior_incident AS T1 JOIN students AS T2 ON T1.student_id = T2.student_id GROUP BY T1.student_id ORDER BY COUNT(*) DESC LIMIT 1
SELECT "T1"."student_id", "T2"."last_name" FROM "behavior_incident" AS "T1" JOIN "students" AS "T2" ON "T1"."student_id" = "T2"."student_id" GROUP BY "T1"."student_id" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.204102
CREATE TABLE table_name_36 (year INT, trainer VARCHAR)
What year was Jeff Mullins?
SELECT MIN(year) FROM table_name_36 WHERE trainer = "jeff mullins"
SELECT MIN("year") FROM "table_name_36" WHERE "jeff mullins" = "trainer"
0.070313
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
give me the number of patients younger than 36 years who had theophylline lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "36" AND lab.label = "Theophylline"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Theophylline" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "36" > "demographic"."age"
0.1875
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
how many times did patient 005-46456 receive surgery consultation in 2104?
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '005-46456')) AND treatment.treatmentname = 'surgery consultation' AND STRFTIME('%y', treatment.treatmenttime) = '2104'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-46456' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE "treatment"."treatmentname" = 'surgery consultation' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y', "treatment"."treatmenttime") = '2104'
0.591797
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what's the top four diagnosis that had the highest four year mortality rate?
SELECT t4.diagnosisname FROM (SELECT t3.diagnosisname, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.diagnosisname, 100 - SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t2.diagnosistime) > 4 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.uniquepid, t1.diagnosisname, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid GROUP BY patient.uniquepid, diagnosis.diagnosisname HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.diagnosistime) > 4 * 365) AS t2 JOIN patient ON t2.uniquepid = patient.uniquepid GROUP BY t2.diagnosisname) AS t3) AS t4 WHERE t4.c2 <= 4
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" GROUP BY "patient"."uniquepid", "diagnosis"."diagnosisname" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")), "t3" AS (SELECT "t1"."diagnosisname", 100 - SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 1460 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "c1" FROM "t1" AS "t1" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."diagnosistime") > 1460 GROUP BY "t1"."diagnosisname"), "t4" AS (SELECT "t3"."diagnosisname", DENSE_RANK() OVER (ORDER BY "t3"."c1" DESC NULLS LAST) AS "c2" FROM "t3" AS "t3") SELECT "t4"."diagnosisname" FROM "t4" AS "t4" WHERE "t4"."c2" <= 4
0.954102
CREATE TABLE table_45315 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" FLOAT, "Money ( $ ) " TEXT)
How much To par has a Place of t1, and a Score of 70-70-71-71=282?
SELECT COUNT("To par") FROM table_45315 WHERE "Place" = 't1' AND "Score" = '70-70-71-71=282'
SELECT COUNT("To par") FROM "table_45315" WHERE "Place" = 't1' AND "Score" = '70-70-71-71=282'
0.091797
CREATE TABLE table_29806 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What was the score for game 3?
SELECT "Score" FROM table_29806 WHERE "Game" = '3'
SELECT "Score" FROM "table_29806" WHERE "Game" = '3'
0.050781
CREATE TABLE table_18324 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
When was the earliest first election?
SELECT MIN("First elected") FROM table_18324
SELECT MIN("First elected") FROM "table_18324"
0.044922
CREATE TABLE table_42076 ("Category" TEXT, "Frequency" TEXT, "White" TEXT, "Brown" TEXT, "Black" TEXT, "Amerindian" TEXT, "Yellow" TEXT, "Total" TEXT, "difference between White and Black" FLOAT)
Which Category in Black has a Brown of 6,54%?
SELECT "Black" FROM table_42076 WHERE "Brown" = '6,54%'
SELECT "Black" FROM "table_42076" WHERE "Brown" = '6,54%'
0.055664
CREATE TABLE table_63337 ("Rank" TEXT, "Rider" TEXT, "Horse" TEXT, "Nation" TEXT, "Judge E" TEXT, "Judge C" TEXT, "Judge M" TEXT, "Penalty Points" FLOAT)
what is the judge e when judge c is 56.67 and the rider is dag albert?
SELECT "Judge E" FROM table_63337 WHERE "Judge C" = '56.67' AND "Rider" = 'dag albert'
SELECT "Judge E" FROM "table_63337" WHERE "Judge C" = '56.67' AND "Rider" = 'dag albert'
0.085938
CREATE TABLE table_13405 ("Year" FLOAT, "Champion ( average in final ) " TEXT, "Legs" TEXT, "Runner-up ( average in final ) " TEXT, "Sponsor" TEXT, "Prize Fund" TEXT, "Champion" TEXT, "Runner-up" TEXT, "Venue" TEXT)
what is the venue when the runner-up is 20,000, the champion (average in final) is phil taylor (109.35)?
SELECT "Venue" FROM table_13405 WHERE "Runner-up" = '£20,000' AND "Champion (average in final)" = 'phil taylor (109.35)'
SELECT "Venue" FROM "table_13405" WHERE "Champion (average in final)" = 'phil taylor (109.35)' AND "Runner-up" = '£20,000'
0.119141
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients whose drug route is td?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.route = "TD"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "TD" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.174805
CREATE TABLE table_65588 ("Actor" TEXT, "Character" TEXT, "Soap Opera" TEXT, "Years" TEXT, "Duration" TEXT)
What years have claudia ruffo as the actor?
SELECT "Years" FROM table_65588 WHERE "Actor" = 'claudia ruffo'
SELECT "Years" FROM "table_65588" WHERE "Actor" = 'claudia ruffo'
0.063477
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT)
Return a bar chart about the distribution of meter_200 and the sum of meter_100 , and group by attribute meter_200, order bar from high to low order.
SELECT meter_200, SUM(meter_100) FROM swimmer GROUP BY meter_200 ORDER BY meter_200 DESC
SELECT "meter_200", SUM("meter_100") FROM "swimmer" GROUP BY "meter_200" ORDER BY "meter_200" DESC NULLS LAST
0.106445
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
what number of patients whose ethnicity is hispanic/latino-puerto rican were given the drug d5ns?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "HISPANIC/LATINO - PUERTO RICAN" AND prescriptions.drug = "D5NS"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "D5NS" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "HISPANIC/LATINO - PUERTO RICAN" = "demographic"."ethnicity"
0.241211
CREATE TABLE table_name_6 (date VARCHAR, opponent VARCHAR)
What is Date, when Opponent is 'Philadelphia 76ers'?
SELECT date FROM table_name_6 WHERE opponent = "philadelphia 76ers"
SELECT "date" FROM "table_name_6" WHERE "opponent" = "philadelphia 76ers"
0.071289
CREATE TABLE table_46800 ("Year" FLOAT, "Starts" FLOAT, "Wins" FLOAT, "Top 5" FLOAT, "Top 10" FLOAT, "Poles" FLOAT, "Avg. Start" FLOAT, "Avg. Finish" FLOAT, "Winnings" TEXT, "Position" TEXT, "Team ( s ) " TEXT)
What is the average start with wins larger than 0 and 32nd position?
SELECT AVG("Starts") FROM table_46800 WHERE "Wins" > '0' AND "Position" = '32nd'
SELECT AVG("Starts") FROM "table_46800" WHERE "Position" = '32nd' AND "Wins" > '0'
0.080078
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
how many patients were prescribed 1000 ml flex cont : sodium chloride 0.9 % iv soln in the same hospital encounter after receiving tissue biopsy - lung treatment?
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, treatment.treatmenttime, patient.patienthealthsystemstayid FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE treatment.treatmentname = 'tissue biopsy - lung') AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = '1000 ml flex cont : sodium chloride 0.9 % iv soln') AS t2 WHERE t1.treatmenttime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
WITH "t2" AS (SELECT "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" WHERE "medication"."drugname" = '1000 ml flex cont : sodium chloride 0.9 % iv soln') SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "t2"."drugstarttime" > "treatment"."treatmenttime" WHERE "treatment"."treatmentname" = 'tissue biopsy - lung'
0.611328
CREATE TABLE table_69713 ("Player" TEXT, "Games" TEXT, "Tries" TEXT, "Goals" TEXT, "F. Goals" TEXT, "Points" TEXT)
Name the points for games of 16 16
SELECT "Points" FROM table_69713 WHERE "Games" = '16 16'
SELECT "Points" FROM "table_69713" WHERE "Games" = '16 16'
0.056641
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) 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)
Provide me the number of patients who underwent abdominal wall incision and died in or before 2174.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dod_year <= "2174.0" AND procedures.long_title = "Incision of abdominal wall"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Incision of abdominal wall" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2174.0" >= "demographic"."dod_year"
0.236328
CREATE TABLE table_37177 ("Date" TEXT, "Winning Team" TEXT, "Score" TEXT, "Winning Pitcher" TEXT, "Losing Pitcher" TEXT, "Attendance" FLOAT, "Location" TEXT)
What winning team has a losing pitcher of Juan Dominguez?
SELECT "Winning Team" FROM table_37177 WHERE "Losing Pitcher" = 'juan dominguez'
SELECT "Winning Team" FROM "table_37177" WHERE "Losing Pitcher" = 'juan dominguez'
0.080078
CREATE TABLE table_51320 ("Draw" FLOAT, "Song" TEXT, "Artist" TEXT, "Jury ( Points ) " TEXT, "Televotes ( Points ) " TEXT, "Total Points" FLOAT, "Place" FLOAT)
What is the lowest total points Karine Tr cy has with less than 4 draws?
SELECT MIN("Total Points") FROM table_51320 WHERE "Draw" < '4' AND "Artist" = 'karine trécy'
SELECT MIN("Total Points") FROM "table_51320" WHERE "Artist" = 'karine trécy' AND "Draw" < '4'
0.091797
CREATE TABLE table_56857 ("Name" TEXT, "City" TEXT, "Height ( m ) " FLOAT, "Height ( ft ) " FLOAT, "Floors" FLOAT, "Years as tallest" TEXT)
For a height less than 122 meters, what is the greatest height in feet?
SELECT MAX("Height (ft)") FROM table_56857 WHERE "Height (m)" < '122'
SELECT MAX("Height (ft)") FROM "table_56857" WHERE "Height (m)" < '122'
0.069336
CREATE TABLE cinema (Cinema_ID INT, Name TEXT, Openning_year INT, Capacity INT, Location TEXT) CREATE TABLE film (Film_ID INT, Rank_in_series INT, Number_in_season INT, Title TEXT, Directed_by TEXT, Original_air_date TEXT, Production_code TEXT) CREATE TABLE schedule (Cinema_ID INT, Film_ID INT, Date TEXT, Show_times_per_day INT, Price FLOAT)
Give me the title and highest price for each film in a bar chart, and display x-axis in asc order.
SELECT Title, MAX(T1.Price) FROM schedule AS T1 JOIN film AS T2 ON T1.Film_ID = T2.Film_ID GROUP BY Title ORDER BY Title
SELECT "Title", MAX("T1"."Price") FROM "schedule" AS "T1" JOIN "film" AS "T2" ON "T1"."Film_ID" = "T2"."Film_ID" GROUP BY "Title" ORDER BY "Title" NULLS FIRST
0.154297
CREATE TABLE table_name_81 (year VARCHAR, opening VARCHAR)
Which year had e34 Nimzo-Indian defence is the opening?
SELECT year FROM table_name_81 WHERE opening = "e34 nimzo-indian defence"
SELECT "year" FROM "table_name_81" WHERE "e34 nimzo-indian defence" = "opening"
0.077148
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
provide the number of patients whose admission location is transfer from hosp/extram and admission year is less than 2131?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "TRANSFER FROM HOSP/EXTRAM" AND demographic.admityear < "2131"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2131" > "demographic"."admityear" AND "TRANSFER FROM HOSP/EXTRAM" = "demographic"."admission_location"
0.173828
CREATE TABLE table_name_63 (method VARCHAR, record VARCHAR)
What is the method when the record was 3-2?
SELECT method FROM table_name_63 WHERE record = "3-2"
SELECT "method" FROM "table_name_63" WHERE "3-2" = "record"
0.057617
CREATE TABLE table_1637 ("Municipality" TEXT, "Shire" TEXT, "Population" FLOAT, "Area in km 2" TEXT, "Density in inhab\\\\km 2" TEXT, "Distance to San Sebastians city centre in km" TEXT)
how many shire in the land of area in km 2 is 27.17
SELECT COUNT("Shire") FROM table_1637 WHERE "Area in km 2" = '27.17'
SELECT COUNT("Shire") FROM "table_1637" WHERE "Area in km 2" = '27.17'
0.068359
CREATE TABLE table_8844 ("Year" FLOAT, "Ship" TEXT, "Departed From" TEXT, "Departed On" TEXT, "Returned On" TEXT)
When did TDB depart?
SELECT MAX("Year") FROM table_8844 WHERE "Departed From" = 'tdb'
SELECT MAX("Year") FROM "table_8844" WHERE "Departed From" = 'tdb'
0.064453
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
what is the number of patients who were discharged from the hospital until 2104?
SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE NOT patient.hospitaldischargetime IS NULL AND STRFTIME('%y', patient.hospitaldischargetime) <= '2104'
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" WHERE NOT "patient"."hospitaldischargetime" IS NULL AND STRFTIME('%y', "patient"."hospitaldischargetime") <= '2104'
0.170898
CREATE TABLE lives_in (stuid DECIMAL, dormid DECIMAL, room_number DECIMAL) CREATE TABLE dorm (dormid DECIMAL, dorm_name TEXT, student_capacity DECIMAL, gender TEXT) CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT) CREATE TABLE has_amenity (dormid DECIMAL, amenid DECIMAL) CREATE TABLE dorm_amenity (amenid DECIMAL, amenity_name TEXT)
Find the number of students in each major.
SELECT COUNT(*), major FROM student GROUP BY major
SELECT COUNT(*), "major" FROM "student" GROUP BY "major"
0.054688
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
provide the number of patients whose days of hospital stay is greater than 5 and diagnoses icd9 code is 30400?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "5" AND diagnoses.icd9_code = "30400"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "30400" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "5" < "demographic"."days_stay"
0.207031
CREATE TABLE table_name_66 (poles VARCHAR, points VARCHAR)
What is the total number of poles and 63 points?
SELECT COUNT(poles) FROM table_name_66 WHERE points = "63"
SELECT COUNT("poles") FROM "table_name_66" WHERE "63" = "points"
0.0625
CREATE TABLE table_24702 ("Series #" FLOAT, "Season #" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Prod. code" TEXT)
reginald hudlin directed how many written by.
SELECT "Written by" FROM table_24702 WHERE "Directed by" = 'Reginald Hudlin'
SELECT "Written by" FROM "table_24702" WHERE "Directed by" = 'Reginald Hudlin'
0.076172
CREATE TABLE table_203_836 (id DECIMAL, "title" TEXT, "year" DECIMAL, "platforms" TEXT, "developer" TEXT, "publisher" TEXT, "notes" TEXT)
how many platforms did american mcgee 's grimm run on ?
SELECT "platforms" FROM table_203_836 WHERE "title" = "american mcgee's grimm"
SELECT "platforms" FROM "table_203_836" WHERE "american mcgee's grimm" = "title"
0.078125
CREATE TABLE table_name_98 (owner VARCHAR, built VARCHAR)
Who is the owner that built in 2009-2011?
SELECT owner FROM table_name_98 WHERE built = "2009-2011"
SELECT "owner" FROM "table_name_98" WHERE "2009-2011" = "built"
0.061523
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
has patient 25365 been admitted to the hospital in 2105?
SELECT COUNT(*) > 0 FROM admissions WHERE admissions.subject_id = 25365 AND STRFTIME('%y', admissions.admittime) = '2105'
SELECT COUNT(*) > 0 FROM "admissions" WHERE "admissions"."subject_id" = 25365 AND STRFTIME('%y', "admissions"."admittime") = '2105'
0.12793
CREATE TABLE table_name_89 (time_retired VARCHAR, constructor VARCHAR, grid VARCHAR)
What is the Time/Retired for brabham - climax, on Grid of 10?
SELECT time_retired FROM table_name_89 WHERE constructor = "brabham - climax" AND grid = 10
SELECT "time_retired" FROM "table_name_89" WHERE "brabham - climax" = "constructor" AND "grid" = 10
0.09668
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
since 2105 what is the first hospital admission type of patient 022-134034?
SELECT patient.hospitaladmitsource FROM patient WHERE patient.uniquepid = '022-134034' AND STRFTIME('%y', patient.hospitaladmittime) >= '2105' ORDER BY patient.hospitaladmittime LIMIT 1
SELECT "patient"."hospitaladmitsource" FROM "patient" WHERE "patient"."uniquepid" = '022-134034' AND STRFTIME('%y', "patient"."hospitaladmittime") >= '2105' ORDER BY "patient"."hospitaladmittime" NULLS FIRST LIMIT 1
0.209961
CREATE TABLE table_19816 ("Ido" TEXT, "English" TEXT, "Italian" TEXT, "French" TEXT, "German" TEXT, "Russian" TEXT, "Spanish" TEXT)
What is the Spanish word for the French word filtrer?
SELECT "Spanish" FROM table_19816 WHERE "French" = 'filtrer'
SELECT "Spanish" FROM "table_19816" WHERE "French" = 'filtrer'
0.060547
CREATE TABLE table_name_96 (format VARCHAR, catalog VARCHAR)
What is the format for Catalog CL 2372?
SELECT format FROM table_name_96 WHERE catalog = "cl 2372"
SELECT "format" FROM "table_name_96" WHERE "catalog" = "cl 2372"
0.0625
CREATE TABLE table_name_18 (score VARCHAR, loss VARCHAR)
What was the score when the game has a loss of Lary (10-12)?
SELECT score FROM table_name_18 WHERE loss = "lary (10-12)"
SELECT "score" FROM "table_name_18" WHERE "lary (10-12)" = "loss"
0.063477
CREATE TABLE table_name_13 (rank VARCHAR, alliance VARCHAR, country VARCHAR)
How many airlines have the star alliance and are in brazil?
SELECT COUNT(rank) FROM table_name_13 WHERE alliance = "star alliance" AND country = "brazil"
SELECT COUNT("rank") FROM "table_name_13" WHERE "alliance" = "star alliance" AND "brazil" = "country"
0.098633
CREATE TABLE table_64076 ("School" TEXT, "Location" TEXT, "Mascot" TEXT, "County" TEXT, "Year Joined" TEXT, "Previous Conference" TEXT, "Year Left" TEXT)
what is the mascot when the school is warsaw?
SELECT "Mascot" FROM table_64076 WHERE "School" = 'warsaw'
SELECT "Mascot" FROM "table_64076" WHERE "School" = 'warsaw'
0.058594
CREATE TABLE table_name_71 (rank INT, player VARCHAR, wickets VARCHAR)
What is the total rank for player Delyone Borden with more than 15 wickets?
SELECT SUM(rank) FROM table_name_71 WHERE player = "delyone borden" AND wickets > 15
SELECT SUM("rank") FROM "table_name_71" WHERE "delyone borden" = "player" AND "wickets" > 15
0.089844