schema
stringlengths
29
5.42k
question
stringlengths
0
752
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
8.94k
weight
float64
0
8.73
CREATE TABLE record (ID NUMBER, Result CLOB, Swimmer_ID NUMBER, Event_ID NUMBER) CREATE TABLE stadium (ID NUMBER, name CLOB, Capacity NUMBER, City CLOB, Country CLOB, Opening_year NUMBER) CREATE TABLE swimmer (ID NUMBER, name CLOB, Nationality CLOB, meter_100 FLOAT, meter_200 CLOB, meter_300 CLOB, meter_400 CLOB, meter_500 CLOB, meter_600 CLOB, meter_700 CLOB, Time CLOB) CREATE TABLE event (ID NUMBER, Name CLOB, Stadium_ID NUMBER, Year CLOB)
A bar chart for finding the number of the names of stadiums that some Australian swimmers have been to, list from high to low by the names.
SELECT T4.Name, COUNT(T4.Name) FROM swimmer AS t1 JOIN record AS t2 ON t1.ID = t2.Swimmer_ID JOIN event AS t3 ON t2.Event_ID = t3.ID JOIN stadium AS t4 ON t4.ID = t3.Stadium_ID WHERE t1.Nationality = 'Australia' GROUP BY T4.Name ORDER BY T4.Name DESC
SELECT "T4"."Name", COUNT("T4"."Name") FROM "swimmer" "t1" JOIN "record" "t2" ON "t1"."ID" = "t2"."Swimmer_ID" JOIN "event" "t3" ON "t2"."Event_ID" = "t3"."ID" JOIN "stadium" "t4" ON "t3"."Stadium_ID" = "t4"."ID" WHERE "t1"."Nationality" = 'Australia' GROUP BY "T4"."Name" ORDER BY "T4"."Name" DESC
0.291016
CREATE TABLE table_14345690_15 (main_presenter VARCHAR2, series VARCHAR2)
Who is the main presenter of the series Twelve (2012)?
SELECT main_presenter FROM table_14345690_15 WHERE series = "Twelve (2012)"
SELECT "main_presenter" FROM "table_14345690_15" WHERE "Twelve (2012)" = "series"
0.079102
CREATE TABLE table_204_193 (id NUMBER, "year" NUMBER, "artist" CLOB, "album" CLOB, "chart position" CLOB, "role" CLOB)
what other album did eddie harris & les mccain had besides swiss movement
SELECT "album" FROM table_204_193 WHERE "artist" = 'eddie harris & les mccann' AND "album" <> 'swiss movement'
SELECT "album" FROM "table_204_193" WHERE "album" <> 'swiss movement' AND "artist" = 'eddie harris & les mccann'
0.109375
CREATE TABLE table_name_87 (home__2nd_leg_ VARCHAR2, aggregate VARCHAR2)
What is the home of aggregate's 3-4?
SELECT home__2nd_leg_ FROM table_name_87 WHERE aggregate = "3-4"
SELECT "home__2nd_leg_" FROM "table_name_87" WHERE "3-4" = "aggregate"
0.068359
CREATE TABLE table_80413 ("Team 1" CLOB, "Agg." CLOB, "Team 2" CLOB, "1st leg" CLOB, "2nd leg" CLOB)
When Kabwe Warriors (team 1) played, what was the result of the 1st leg?
SELECT "1st leg" FROM table_80413 WHERE "Team 1" = 'kabwe warriors'
SELECT "1st leg" FROM "table_80413" WHERE "Team 1" = 'kabwe warriors'
0.067383
CREATE TABLE writes (paperid NUMBER, authorid NUMBER) CREATE TABLE journal (journalid NUMBER, journalname VARCHAR2) CREATE TABLE paperfield (fieldid NUMBER, paperid NUMBER) CREATE TABLE author (authorid NUMBER, authorname VARCHAR2) CREATE TABLE cite (citingpaperid NUMBER, citedpaperid NUMBER) CREATE TABLE paperkeyphrase (paperid NUMBER, keyphraseid NUMBER) CREATE TABLE venue (venueid NUMBER, venuename VARCHAR2) CREATE TABLE keyphrase (keyphraseid NUMBER, keyphrasename VARCHAR2) CREATE TABLE field (fieldid NUMBER) CREATE TABLE paperdataset (paperid NUMBER, datasetid NUMBER) CREATE TABLE dataset (datasetid NUMBER, datasetname VARCHAR2) CREATE TABLE paper (paperid NUMBER, title VARCHAR2, venueid NUMBER, year NUMBER, numciting NUMBER, numcitedby NUMBER, journalid NUMBER)
how is the most cited author in ACL ?
SELECT DISTINCT COUNT(DISTINCT cite.citingpaperid), writes.authorid FROM cite, paper, venue, writes WHERE venue.venueid = paper.venueid AND venue.venuename = 'ACL' AND writes.paperid = cite.citedpaperid AND writes.paperid = paper.paperid GROUP BY writes.authorid ORDER BY COUNT(DISTINCT cite.citingpaperid) DESC
SELECT DISTINCT COUNT(DISTINCT "cite"."citingpaperid"), "writes"."authorid" FROM "cite" JOIN "writes" ON "cite"."citedpaperid" = "writes"."paperid" JOIN "paper" ON "paper"."paperid" = "writes"."paperid" JOIN "venue" ON "paper"."venueid" = "venue"."venueid" AND "venue"."venuename" = 'ACL' GROUP BY "writes"."authorid" ORDER BY COUNT(DISTINCT "cite"."citingpaperid") DESC
0.361328
CREATE TABLE Institution (Institution_id CLOB, Institution CLOB, Location CLOB, Founded FLOAT, Type CLOB, Enrollment NUMBER, Team CLOB, Primary_Conference CLOB, building_id CLOB) CREATE TABLE protein (common_name CLOB, protein_name CLOB, divergence_from_human_lineage FLOAT, accession_number CLOB, sequence_length FLOAT, sequence_identity_to_human_protein CLOB, Institution_id CLOB) CREATE TABLE building (building_id CLOB, Name CLOB, Street_address CLOB, Years_as_tallest CLOB, Height_feet NUMBER, Floors NUMBER)
Scatter plot to show count(*) on x axis and total number of enrollment on y axis.
SELECT COUNT(*), SUM(Enrollment) FROM Institution GROUP BY Type
SELECT COUNT(*), SUM("Enrollment") FROM "Institution" GROUP BY "Type"
0.067383
CREATE TABLE table_name_58 (result VARCHAR2, year VARCHAR2, nominated_work VARCHAR2)
What is the result for the king and I after 2006?
SELECT result FROM table_name_58 WHERE year > 2006 AND nominated_work = "the king and i"
SELECT "result" FROM "table_name_58" WHERE "nominated_work" = "the king and i" AND "year" > 2006
0.09375
CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER)
Posts by a given user by displayname.
SELECT Posts.Id, Posts.Id AS "post_link" FROM Posts WHERE OwnerDisplayName = '##DisplayName##' AND PostTypeId = '##PostType##' ORDER BY Posts.CreationDate DESC
SELECT "Posts"."Id", "Posts"."Id" AS "post_link" FROM "Posts" WHERE "OwnerDisplayName" = '##DisplayName##' AND "PostTypeId" = '##PostType##' ORDER BY "Posts"."CreationDate" DESC
0.172852
CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER)
Name the Clinical Dental Hygiene courses that require no pre-qualification ?
SELECT DISTINCT course.department, course.name, course.number FROM course INNER JOIN area ON course.course_id = area.course_id WHERE (area.area LIKE '%Clinical Dental Hygiene%' OR course.description LIKE '%Clinical Dental Hygiene%' OR course.name LIKE '%Clinical Dental Hygiene%') AND course.enforced_requirement = 'N / A'
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "area" ON ("area"."area" LIKE '%Clinical Dental Hygiene%' OR "course"."description" LIKE '%Clinical Dental Hygiene%' OR "course"."name" LIKE '%Clinical Dental Hygiene%') AND "area"."course_id" = "course"."course_id" WHERE "course"."enforced_requirement" = 'N / A'
0.347656
CREATE TABLE table_37288 ("Title" CLOB, "Publisher" CLOB, "Developer" CLOB, "Release date" CLOB, "ESRB" CLOB)
When Did Microsoft Game Studios release Amped: Freestyle Snowboarding?
SELECT "Release date" FROM table_37288 WHERE "Publisher" = 'microsoft game studios' AND "Title" = 'amped: freestyle snowboarding'
SELECT "Release date" FROM "table_37288" WHERE "Publisher" = 'microsoft game studios' AND "Title" = 'amped: freestyle snowboarding'
0.12793
CREATE TABLE table_name_91 (round NUMBER, nationality VARCHAR2, pick VARCHAR2)
What is the sum of Round, when Nationality is 'United States', and when Pick is '125'?
SELECT SUM(round) FROM table_name_91 WHERE nationality = "united states" AND pick = 125
SELECT SUM("round") FROM "table_name_91" WHERE "nationality" = "united states" AND "pick" = 125
0.092773
CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER)
Highest answer rate of popular tags.
SELECT Tags.TagName, COUNT(*) AS NumQuestions, SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) AS NumAnswered, (SUM(CASE WHEN NOT AcceptedAnswerId IS NULL THEN 1 ELSE 0 END) * 100 / COUNT(*)) AS PercentageAnswered FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.Id = PostTags.PostId AND PostTypeId = 1 GROUP BY Tags.TagName HAVING COUNT(*) > 100000 ORDER BY PercentageAnswered DESC, NumQuestions DESC
SELECT "Tags"."TagName", COUNT(*) AS "NumQuestions", SUM(CASE WHEN NOT "AcceptedAnswerId" IS NULL THEN 1 ELSE 0 END) AS "NumAnswered", SUM(CASE WHEN NOT "AcceptedAnswerId" IS NULL THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "PercentageAnswered" FROM "Tags" JOIN "PostTags" ON "PostTags"."TagId" = "Tags"."Id" JOIN "Posts" ON "PostTags"."PostId" = "Posts"."Id" AND "PostTypeId" = 1 GROUP BY "Tags"."TagName" HAVING COUNT(*) > 100000 ORDER BY "PercentageAnswered" DESC, "NumQuestions" DESC
0.481445
CREATE TABLE table_35097 ("Date" CLOB, "Result" CLOB, "Score" CLOB, "Venue" CLOB, "Competition" CLOB)
Result of l, and a Date of 15-oct-64 had what score?
SELECT "Score" FROM table_35097 WHERE "Result" = 'l' AND "Date" = '15-oct-64'
SELECT "Score" FROM "table_35097" WHERE "Date" = '15-oct-64' AND "Result" = 'l'
0.077148
CREATE TABLE customers (customer_id NUMBER, customer_first_name CLOB, customer_last_name CLOB, customer_address CLOB, customer_phone CLOB, customer_email CLOB, other_customer_details CLOB) CREATE TABLE financial_transactions (transaction_id NUMBER, previous_transaction_id NUMBER, account_id NUMBER, card_id NUMBER, transaction_type CLOB, transaction_date TIME, transaction_amount NUMBER, transaction_comment CLOB, other_transaction_details CLOB) CREATE TABLE accounts (account_id NUMBER, customer_id NUMBER, account_name CLOB, other_account_details CLOB) CREATE TABLE customers_cards (card_id NUMBER, customer_id NUMBER, card_type_code CLOB, card_number CLOB, date_valid_from TIME, date_valid_to TIME, other_card_details CLOB)
What is the average and total transaction amount?
SELECT AVG(transaction_amount), SUM(transaction_amount) FROM financial_transactions
SELECT AVG("transaction_amount"), SUM("transaction_amount") FROM "financial_transactions"
0.086914
CREATE TABLE table_56204 ("Year" CLOB, "Date" CLOB, "Venue" CLOB, "Winner" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB, "Margin of victory" CLOB, "Runner ( s ) -up" CLOB, "Winner's share ( \\u20ac ) " CLOB)
What is the margin of victory for nikki garrett?
SELECT "Margin of victory" FROM table_56204 WHERE "Winner" = 'nikki garrett'
SELECT "Margin of victory" FROM "table_56204" WHERE "Winner" = 'nikki garrett'
0.076172
CREATE TABLE table_203_590 (id NUMBER, "date" CLOB, "venue" CLOB, "opponents" CLOB, "score" CLOB, "competition" CLOB, "scotland scorer ( s ) " CLOB)
against which opponent did scotland have no scorers ?
SELECT "opponents" FROM table_203_590 WHERE "score" = 0
SELECT "opponents" FROM "table_203_590" WHERE "score" = 0
0.055664
CREATE TABLE farm (Working_Horses NUMBER, Total_Horses NUMBER)
What is the average number of working horses of farms with more than 5000 total number of horses?
SELECT AVG(Working_Horses) FROM farm WHERE Total_Horses > 5000
SELECT AVG("Working_Horses") FROM "farm" WHERE "Total_Horses" > 5000
0.066406
CREATE TABLE table_203_299 (id NUMBER, "year" NUMBER, "competition" CLOB, "venue" CLOB, "position" CLOB, "notes" CLOB)
how many total years did golding compete ?
SELECT COUNT(DISTINCT "year") FROM table_203_299
SELECT COUNT(DISTINCT "year") FROM "table_203_299"
0.048828
CREATE TABLE table_204_160 (id NUMBER, "rank" NUMBER, "name" CLOB, "nationality" CLOB, "time" CLOB, "notes" CLOB)
the top 3 runners were from what country ?
SELECT "nationality" FROM table_204_160 WHERE id <= 3
SELECT "nationality" FROM "table_204_160" WHERE "id" <= 3
0.055664
CREATE TABLE student_record (student_id NUMBER, course_id NUMBER, semester NUMBER, grade VARCHAR2, how VARCHAR2, transfer_source VARCHAR2, earn_credit VARCHAR2, repeat_term VARCHAR2, test_id VARCHAR2) CREATE TABLE gsi (course_offering_id NUMBER, student_id NUMBER) CREATE TABLE instructor (instructor_id NUMBER, name VARCHAR2, uniqname VARCHAR2) CREATE TABLE program_course (program_id NUMBER, course_id NUMBER, workload NUMBER, category VARCHAR2) CREATE TABLE program (program_id NUMBER, name VARCHAR2, college VARCHAR2, introduction VARCHAR2) CREATE TABLE course (course_id NUMBER, name VARCHAR2, department VARCHAR2, number VARCHAR2, credits VARCHAR2, advisory_requirement VARCHAR2, enforced_requirement VARCHAR2, description VARCHAR2, num_semesters NUMBER, num_enrolled NUMBER, has_discussion VARCHAR2, has_lab VARCHAR2, has_projects VARCHAR2, has_exams VARCHAR2, num_reviews NUMBER, clarity_score NUMBER, easiness_score NUMBER, helpfulness_score NUMBER) CREATE TABLE program_requirement (program_id NUMBER, category VARCHAR2, min_credit NUMBER, additional_req VARCHAR2) CREATE TABLE area (course_id NUMBER, area VARCHAR2) CREATE TABLE ta (campus_job_id NUMBER, student_id NUMBER, location VARCHAR2) CREATE TABLE comment_instructor (instructor_id NUMBER, student_id NUMBER, score NUMBER, comment_text VARCHAR2) CREATE TABLE student (student_id NUMBER, lastname VARCHAR2, firstname VARCHAR2, program_id NUMBER, declare_major VARCHAR2, total_credit NUMBER, total_gpa FLOAT, entered_as VARCHAR2, admit_term NUMBER, predicted_graduation_semester NUMBER, degree VARCHAR2, minor VARCHAR2, internship VARCHAR2) CREATE TABLE offering_instructor (offering_instructor_id NUMBER, offering_id NUMBER, instructor_id NUMBER) CREATE TABLE course_prerequisite (pre_course_id NUMBER, course_id NUMBER) CREATE TABLE jobs (job_id NUMBER, job_title VARCHAR2, description VARCHAR2, requirement VARCHAR2, city VARCHAR2, state VARCHAR2, country VARCHAR2, zip NUMBER) CREATE TABLE semester (semester_id NUMBER, semester VARCHAR2, year NUMBER) CREATE TABLE course_tags_count (course_id NUMBER, clear_grading NUMBER, pop_quiz NUMBER, group_projects NUMBER, inspirational NUMBER, long_lectures NUMBER, extra_credit NUMBER, few_tests NUMBER, good_feedback NUMBER, tough_tests NUMBER, heavy_papers NUMBER, cares_for_students NUMBER, heavy_assignments NUMBER, respected NUMBER, participation NUMBER, heavy_reading NUMBER, tough_grader NUMBER, hilarious NUMBER, would_take_again NUMBER, good_lecture NUMBER, no_skip NUMBER) CREATE TABLE course_offering (offering_id NUMBER, course_id NUMBER, semester NUMBER, section_number NUMBER, start_time TIME, end_time TIME, monday VARCHAR2, tuesday VARCHAR2, wednesday VARCHAR2, thursday VARCHAR2, friday VARCHAR2, saturday VARCHAR2, sunday VARCHAR2, has_final_project VARCHAR2, has_final_exam VARCHAR2, textbook VARCHAR2, class_address VARCHAR2, allow_audit VARCHAR2) CREATE TABLE requirement (requirement_id NUMBER, requirement VARCHAR2, college VARCHAR2)
How many sections does CDB 502 include ?
SELECT COUNT(DISTINCT course_offering.section_number) FROM course INNER JOIN program_course ON program_course.course_id = course.course_id INNER JOIN course_offering ON course.course_id = course_offering.course_id WHERE course.department = 'CDB' AND course.number = 502
SELECT COUNT(DISTINCT "course_offering"."section_number") FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" WHERE "course"."department" = 'CDB' AND "course"."number" = 502
0.28418
CREATE TABLE table_203_151 (id NUMBER, "no." NUMBER, "date" CLOB, "tournament" CLOB, "winning score" CLOB, "margin of\ victory" CLOB, "runner ( s ) -up" CLOB)
who had the top score in the pga championship ?
SELECT "runner(s)-up" FROM table_203_151 WHERE "tournament" = 'pga championship'
SELECT "runner(s)-up" FROM "table_203_151" WHERE "tournament" = 'pga championship'
0.080078
CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME)
count the number of times patient 005-11182 has had a mechanical ventilation - synchronized intermittent.
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-11182')) AND treatment.treatmentname = 'mechanical ventilation - synchronized intermittent'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '005-11182' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "treatment" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE "treatment"."treatmentname" = 'mechanical ventilation - synchronized intermittent' AND NOT "_u_1"."" IS NULL
0.55957
CREATE TABLE company (company_id NUMBER, rank NUMBER, company CLOB, headquarters CLOB, main_industry CLOB, sales_billion NUMBER, profits_billion NUMBER, assets_billion NUMBER, market_value NUMBER) CREATE TABLE gas_station (station_id NUMBER, open_year NUMBER, location CLOB, manager_name CLOB, vice_manager_name CLOB, representative_name CLOB) CREATE TABLE station_company (station_id NUMBER, company_id NUMBER, rank_of_the_year NUMBER)
What are the different main industries for all companies?
SELECT DISTINCT main_industry FROM company
SELECT DISTINCT "main_industry" FROM "company"
0.044922
CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
count the number of times that during the last year patient 24547 received a insert endotracheal tube procedure.
SELECT COUNT(*) FROM procedures_icd WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'insert endotracheal tube') AND procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24547) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
WITH "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 24547 GROUP BY "hadm_id") SELECT COUNT(*) FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'insert endotracheal tube' LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL
0.512695
CREATE TABLE grapes (id NUMBER, grape CLOB, color CLOB) CREATE TABLE wine (no NUMBER, grape CLOB, winery CLOB, appelation CLOB, state CLOB, name CLOB, year NUMBER, price NUMBER, score NUMBER, cases NUMBER, drink CLOB) CREATE TABLE appellations (no NUMBER, appelation CLOB, county CLOB, state CLOB, area CLOB, isava CLOB)
Give me the average prices of wines that are produced by appelations in Sonoma County.
SELECT AVG(T2.price) FROM appellations AS T1 JOIN wine AS T2 ON T1.appelation = T2.appelation WHERE T1.county = "Sonoma"
SELECT AVG("T2"."price") FROM "appellations" "T1" JOIN "wine" "T2" ON "T1"."appelation" = "T2"."appelation" WHERE "Sonoma" = "T1"."county"
0.134766
CREATE TABLE table_name_26 (ukraine_career VARCHAR2, lost VARCHAR2, drawn VARCHAR2)
What years had a manager who lost more than 1 and drawn more than 11?
SELECT ukraine_career FROM table_name_26 WHERE lost > 1 AND drawn > 11
SELECT "ukraine_career" FROM "table_name_26" WHERE "drawn" > 11 AND "lost" > 1
0.076172
CREATE TABLE table_name_2 (award_ceremony VARCHAR2, role VARCHAR2, year VARCHAR2)
Which Award Ceremony in 2009 has a Role of Glinda?
SELECT award_ceremony FROM table_name_2 WHERE role = "glinda" AND year = 2009
SELECT "award_ceremony" FROM "table_name_2" WHERE "glinda" = "role" AND "year" = 2009
0.083008
CREATE TABLE table_61066 ("State" CLOB, "City" CLOB, "Population" FLOAT, "Violent Crime" CLOB, "Murder and Non-Negligent Manslaughter" FLOAT, "Forcible Rape" CLOB, "Robbery" FLOAT, "Aggravated Assault" FLOAT, "Property Crime" CLOB, "Burglary" FLOAT, "Larceny-Theft" CLOB, "Motor Vehicle Theft" FLOAT)
When population is greater than 832,901 and murder and non-negligent manslaughter is 11.6, what is the smallest burglary?
SELECT MIN("Burglary") FROM table_61066 WHERE "Population" > '832,901' AND "Murder and Non-Negligent Manslaughter" = '11.6'
SELECT MIN("Burglary") FROM "table_61066" WHERE "Murder and Non-Negligent Manslaughter" = '11.6' AND "Population" > '832,901'
0.12207
CREATE TABLE table_name_30 (home_team VARCHAR2, away_team VARCHAR2)
Who is North Melbourne's home team?
SELECT home_team FROM table_name_30 WHERE away_team = "north melbourne"
SELECT "home_team" FROM "table_name_30" WHERE "away_team" = "north melbourne"
0.075195
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many divorced patients take drug via inhalation?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.marital_status = "DIVORCED" AND prescriptions.route = "INHALATION"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "INHALATION" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "DIVORCED" = "demographic"."marital_status"
0.231445
CREATE TABLE table_name_97 (grid VARCHAR2, laps VARCHAR2)
I want the Grid for Laps of 35
SELECT grid FROM table_name_97 WHERE laps = 35
SELECT "grid" FROM "table_name_97" WHERE "laps" = 35
0.050781
CREATE TABLE table_6682 ("Artist" CLOB, "Title" CLOB, "Label" CLOB, "Type" CLOB, "Year" FLOAT)
What title does Overkill have before 1984?
SELECT "Title" FROM table_6682 WHERE "Artist" = 'overkill' AND "Year" < '1984'
SELECT "Title" FROM "table_6682" WHERE "Artist" = 'overkill' AND "Year" < '1984'
0.078125
CREATE TABLE table_46244 ("Date" CLOB, "Visitor" CLOB, "Score" CLOB, "Home" CLOB, "Record" CLOB)
On what Date was the Home team Detroit Red Wings with a Record of 10 41 6?
SELECT "Date" FROM table_46244 WHERE "Home" = 'detroit red wings' AND "Record" = '10–41–6'
SELECT "Date" FROM "table_46244" WHERE "Home" = 'detroit red wings' AND "Record" = '10–41–6'
0.089844
CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER)
what is patient 55281's first urine out foley output time on the current intensive care unit visit?
SELECT outputevents.charttime FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 55281) AND icustays.outtime IS NULL) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine out foley' AND d_items.linksto = 'outputevents') ORDER BY outputevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 55281 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE "icustays"."outtime" IS NULL AND NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'urine out foley' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT "outputevents"."charttime" FROM "outputevents" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL ORDER BY "outputevents"."charttime" FETCH FIRST 1 ROWS ONLY
0.762695
CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER) CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT)
For those records from the products and each product's manufacturer, return a bar chart about the distribution of founder and the average of manufacturer , and group by attribute founder.
SELECT Founder, AVG(Manufacturer) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder
SELECT "Founder", AVG("Manufacturer") FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder"
0.136719
CREATE TABLE table_18752986_1 (captain VARCHAR2, location VARCHAR2)
For location Caversham, what is the name of the captain?
SELECT captain FROM table_18752986_1 WHERE location = "Caversham"
SELECT "captain" FROM "table_18752986_1" WHERE "Caversham" = "location"
0.069336
CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients with drug code cafcit stayed in the hospital for more than 27 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "27" AND prescriptions.formulary_drug_cd = "CAFCIT"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "CAFCIT" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "27" < "demographic"."days_stay"
0.228516
CREATE TABLE table_16817 ("model" CLOB, "max. motive power" CLOB, "max. torque at rpm" CLOB, "engine displacement" CLOB, "engine type" CLOB, "engine configuration & notes 0-100km/h" CLOB)
How many engine b5204 t3?
SELECT COUNT("engine displacement") FROM table_16817 WHERE "engine type" = 'B5204 T3'
SELECT COUNT("engine displacement") FROM "table_16817" WHERE "engine type" = 'B5204 T3'
0.084961
CREATE TABLE locations (LOCATION_ID NUMBER, STREET_ADDRESS VARCHAR2, POSTAL_CODE VARCHAR2, CITY VARCHAR2, STATE_PROVINCE VARCHAR2, COUNTRY_ID VARCHAR2) CREATE TABLE job_history (EMPLOYEE_ID NUMBER, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR2, DEPARTMENT_ID NUMBER) CREATE TABLE regions (REGION_ID NUMBER, REGION_NAME VARCHAR2) CREATE TABLE departments (DEPARTMENT_ID NUMBER, DEPARTMENT_NAME VARCHAR2, MANAGER_ID NUMBER, LOCATION_ID NUMBER) CREATE TABLE employees (EMPLOYEE_ID NUMBER, FIRST_NAME VARCHAR2, LAST_NAME VARCHAR2, EMAIL VARCHAR2, PHONE_NUMBER VARCHAR2, HIRE_DATE DATE, JOB_ID VARCHAR2, SALARY NUMBER, COMMISSION_PCT NUMBER, MANAGER_ID NUMBER, DEPARTMENT_ID NUMBER) CREATE TABLE jobs (JOB_ID VARCHAR2, JOB_TITLE VARCHAR2, MIN_SALARY NUMBER, MAX_SALARY NUMBER) CREATE TABLE countries (COUNTRY_ID VARCHAR2, COUNTRY_NAME VARCHAR2, REGION_ID NUMBER)
For those employees who did not have any job in the past, find hire_date and the average of manager_id bin hire_date by weekday, and visualize them by a bar chart.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history)
SELECT "HIRE_DATE", AVG("MANAGER_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history")
0.120117
CREATE TABLE table_25760427_2 (weeks_at_number_1 NUMBER)
error (see notes)
SELECT MIN(weeks_at_number_1) FROM table_25760427_2
SELECT MIN("weeks_at_number_1") FROM "table_25760427_2"
0.053711
CREATE TABLE table_22541 ("Rank" CLOB, "Country" CLOB, "Jerseys" FLOAT, "Vuelta Wins" FLOAT, "Points" FLOAT, "KoM" FLOAT, "Combo" FLOAT, "Most recent cyclist" CLOB, "Most recent date" CLOB, "Different holders" FLOAT)
When united kingdom is the country what is the most recent date?
SELECT "Most recent date" FROM table_22541 WHERE "Country" = 'United Kingdom'
SELECT "Most recent date" FROM "table_22541" WHERE "Country" = 'United Kingdom'
0.077148
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
give the number of patients whose drug code is chlo180s.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "CHLO180S"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "CHLO180S" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.192383
CREATE TABLE table_22812 ("Year" FLOAT, "Starts" FLOAT, "Wins" FLOAT, "Top 5" FLOAT, "Top 10" FLOAT, "Poles" FLOAT, "Avg. Start" CLOB, "Avg. Finish" CLOB, "Winnings" CLOB, "Position" CLOB, "Team ( s ) " CLOB)
In what year did the #14 FitzBradshaw Racing compete?
SELECT "Year" FROM table_22812 WHERE "Team(s)" = '#14 FitzBradshaw Racing'
SELECT "Year" FROM "table_22812" WHERE "Team(s)" = '#14 FitzBradshaw Racing'
0.074219
CREATE TABLE table_name_43 (round VARCHAR2, year VARCHAR2)
What was the round in 1968?
SELECT round FROM table_name_43 WHERE year = 1968
SELECT "round" FROM "table_name_43" WHERE "year" = 1968
0.053711
CREATE TABLE MediaType (MediaTypeId NUMBER, Name VARCHAR2) CREATE TABLE Genre (GenreId NUMBER, Name VARCHAR2) CREATE TABLE Playlist (PlaylistId NUMBER, Name VARCHAR2) CREATE TABLE Customer (CustomerId NUMBER, FirstName VARCHAR2, LastName VARCHAR2, Company VARCHAR2, Address VARCHAR2, City VARCHAR2, State VARCHAR2, Country VARCHAR2, PostalCode VARCHAR2, Phone VARCHAR2, Fax VARCHAR2, Email VARCHAR2, SupportRepId NUMBER) CREATE TABLE Artist (ArtistId NUMBER, Name VARCHAR2) CREATE TABLE Album (AlbumId NUMBER, Title VARCHAR2, ArtistId NUMBER) CREATE TABLE Track (TrackId NUMBER, Name VARCHAR2, AlbumId NUMBER, MediaTypeId NUMBER, GenreId NUMBER, Composer VARCHAR2, Milliseconds NUMBER, Bytes NUMBER, UnitPrice NUMBER) CREATE TABLE PlaylistTrack (PlaylistId NUMBER, TrackId NUMBER) CREATE TABLE Employee (EmployeeId NUMBER, LastName VARCHAR2, FirstName VARCHAR2, Title VARCHAR2, ReportsTo NUMBER, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR2, City VARCHAR2, State VARCHAR2, Country VARCHAR2, PostalCode VARCHAR2, Phone VARCHAR2, Fax VARCHAR2, Email VARCHAR2) CREATE TABLE Invoice (InvoiceId NUMBER, CustomerId NUMBER, InvoiceDate DATETIME, BillingAddress VARCHAR2, BillingCity VARCHAR2, BillingState VARCHAR2, BillingCountry VARCHAR2, BillingPostalCode VARCHAR2, Total NUMBER) CREATE TABLE InvoiceLine (InvoiceLineId NUMBER, InvoiceId NUMBER, TrackId NUMBER, UnitPrice NUMBER, Quantity NUMBER)
What are the number of the invoice dates for customers with the first name Astrid and the last name Gruber?, and order from high to low by the Y-axis.
SELECT InvoiceDate, COUNT(InvoiceDate) FROM Customer AS T1 JOIN Invoice AS T2 ON T1.CustomerId = T2.CustomerId WHERE T1.FirstName = "Astrid" AND LastName = "Gruber" ORDER BY COUNT(InvoiceDate) DESC
SELECT "InvoiceDate", COUNT("InvoiceDate") FROM "Customer" "T1" JOIN "Invoice" "T2" ON "T1"."CustomerId" = "T2"."CustomerId" WHERE "Astrid" = "T1"."FirstName" AND "Gruber" = "LastName" ORDER BY COUNT("InvoiceDate") DESC
0.213867
CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME)
among patients that were prescribed with sterile water for irrigation since 5 years ago, what are the top five most common drugs that followed afterwards during the same month?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'sterile water for irrigation' AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-5 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-5 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.startdate < t2.startdate AND DATETIME(t1.startdate, 'start of month') = DATETIME(t2.startdate, 'start of month') GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."drug", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-5 year')), "t3" AS (SELECT "t2"."drug", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS "c1" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" JOIN "t2" "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "prescriptions"."startdate" < "t2"."startdate" AND DATETIME("prescriptions"."startdate", 'start of month') = DATETIME("t2"."startdate", 'start of month') WHERE "prescriptions"."drug" = 'sterile water for irrigation' AND DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-5 year') GROUP BY "t2"."drug") SELECT "t3"."drug" FROM "t3" "t3" WHERE "t3"."c1" <= 5
0.871094
CREATE TABLE table_name_22 (number_of_episodes NUMBER, airing_date VARCHAR2)
What is the lowest number of episodes in a series with an airing date of 12 jan- 6 feb?
SELECT MIN(number_of_episodes) FROM table_name_22 WHERE airing_date = "12 jan- 6 feb"
SELECT MIN("number_of_episodes") FROM "table_name_22" WHERE "12 jan- 6 feb" = "airing_date"
0.088867
CREATE TABLE table_name_86 (home VARCHAR2, date VARCHAR2)
Date of march 30 involves what home?
SELECT home FROM table_name_86 WHERE date = "march 30"
SELECT "home" FROM "table_name_86" WHERE "date" = "march 30"
0.058594
CREATE TABLE cost (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, event_type CLOB, event_id NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE labevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE admissions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, admittime TIME, dischtime TIME, admission_type CLOB, admission_location CLOB, discharge_location CLOB, insurance CLOB, language CLOB, marital_status CLOB, ethnicity CLOB, age NUMBER) CREATE TABLE prescriptions (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, startdate TIME, enddate TIME, drug CLOB, dose_val_rx CLOB, dose_unit_rx CLOB, route CLOB) CREATE TABLE inputevents_cv (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, amount NUMBER) CREATE TABLE d_icd_procedures (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id NUMBER, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE transfers (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, eventtype CLOB, careunit CLOB, wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE icustays (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, first_careunit CLOB, last_careunit CLOB, first_wardid NUMBER, last_wardid NUMBER, intime TIME, outtime TIME) CREATE TABLE patients (row_id NUMBER, subject_id NUMBER, gender CLOB, dob TIME, dod TIME) CREATE TABLE chartevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, itemid NUMBER, charttime TIME, valuenum NUMBER, valueuom CLOB) CREATE TABLE outputevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icustay_id NUMBER, charttime TIME, itemid NUMBER, value NUMBER) CREATE TABLE microbiologyevents (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, charttime TIME, spec_type_desc CLOB, org_name CLOB) CREATE TABLE diagnoses_icd (row_id NUMBER, subject_id NUMBER, hadm_id NUMBER, icd9_code CLOB, charttime TIME) CREATE TABLE d_labitems (row_id NUMBER, itemid NUMBER, label CLOB) CREATE TABLE d_items (row_id NUMBER, itemid NUMBER, label CLOB, linksto CLOB)
what was the first careunit for patient 1862 until 2102?
SELECT transfers.careunit FROM transfers WHERE transfers.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1862) AND NOT transfers.careunit IS NULL AND STRFTIME('%y', transfers.intime) <= '2102' ORDER BY transfers.intime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 1862 GROUP BY "hadm_id") SELECT "transfers"."careunit" FROM "transfers" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "transfers"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "transfers"."careunit" IS NULL AND STRFTIME('%y', "transfers"."intime") <= '2102' ORDER BY "transfers"."intime" FETCH FIRST 1 ROWS ONLY
0.392578
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
how many patients are diagnosed with human immuno virus dis and had their lab test show abnormal status?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Human immuno virus dis" AND lab.flag = "abnormal"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Human immuno virus dis" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.272461
CREATE TABLE table_name_53 (record VARCHAR2, arena VARCHAR2, loss VARCHAR2)
What is the record at Arrowhead Pond of Anaheim, when the loss was Bryzgalov (10 11 1)?
SELECT record FROM table_name_53 WHERE arena = "arrowhead pond of anaheim" AND loss = "bryzgalov (10–11–1)"
SELECT "record" FROM "table_name_53" WHERE "arena" = "arrowhead pond of anaheim" AND "bryzgalov (10–11–1)" = "loss"
0.112305
CREATE TABLE table_14105 ("Season" CLOB, "Division" CLOB, "Tms." CLOB, "Pos." CLOB, "PFF NMCC" CLOB, "UFL Cup" CLOB, "AFC PC" CLOB)
Which PFF NMCC has a AFC PC of dnq?
SELECT "PFF NMCC" FROM table_14105 WHERE "AFC PC" = 'dnq'
SELECT "PFF NMCC" FROM "table_14105" WHERE "AFC PC" = 'dnq'
0.057617
CREATE TABLE table_66342 ("Rank" FLOAT, "Heat" FLOAT, "Lane" FLOAT, "Name" CLOB, "Nationality" CLOB, "Time" CLOB)
Who is from the united states, has a rank less than 9, and heat more than 5?
SELECT "Name" FROM table_66342 WHERE "Rank" < '9' AND "Heat" > '5' AND "Nationality" = 'united states'
SELECT "Name" FROM "table_66342" WHERE "Heat" > '5' AND "Nationality" = 'united states' AND "Rank" < '9'
0.101563
CREATE TABLE table_1213511_7 (pick__number VARCHAR2, nhl_team VARCHAR2)
what is the total number of pick # where nhl team is philadelphia flyers
SELECT COUNT(pick__number) FROM table_1213511_7 WHERE nhl_team = "Philadelphia Flyers"
SELECT COUNT("pick__number") FROM "table_1213511_7" WHERE "Philadelphia Flyers" = "nhl_team"
0.089844
CREATE TABLE table_67101 ("Pure Tamil" CLOB, "How Ashtagrama Iyers say it" CLOB, "How other Iyers say it" CLOB, "How other Tamils say it" CLOB, "English Meaning" CLOB)
Name the english meaning for engey poringo
SELECT "English Meaning" FROM table_67101 WHERE "How other Tamils say it" = 'engey poringo'
SELECT "English Meaning" FROM "table_67101" WHERE "How other Tamils say it" = 'engey poringo'
0.09082
CREATE TABLE table_name_12 (away_team VARCHAR2, home_team VARCHAR2, competition VARCHAR2)
Who is the away team for the tome team Leeds United, at the League Cup Competition?
SELECT away_team FROM table_name_12 WHERE home_team = "leeds united" AND competition = "league cup"
SELECT "away_team" FROM "table_name_12" WHERE "competition" = "league cup" AND "home_team" = "leeds united"
0.104492
CREATE TABLE table_12588 ("Outcome" CLOB, "Date" CLOB, "Category" CLOB, "Tournament" CLOB, "Surface" CLOB, "Opponent" CLOB, "Score" CLOB)
What is the Score of the tournament played on Clay Surface against Pablo Martin-Adalia?
SELECT "Score" FROM table_12588 WHERE "Surface" = 'clay' AND "Opponent" = 'pablo martin-adalia'
SELECT "Score" FROM "table_12588" WHERE "Opponent" = 'pablo martin-adalia' AND "Surface" = 'clay'
0.094727
CREATE TABLE table_47229 ("Game" FLOAT, "Date" CLOB, "Team" CLOB, "Score" CLOB, "High points" CLOB, "High rebounds" CLOB, "High assists" CLOB, "Location Attendance" CLOB, "Record" CLOB)
What was the score of game 4?
SELECT "Score" FROM table_47229 WHERE "Game" = '4'
SELECT "Score" FROM "table_47229" WHERE "Game" = '4'
0.050781
CREATE TABLE table_10432351_1 (radius__r___ NUMBER)
What is the smallest possible radius?
SELECT MIN(radius__r___) FROM table_10432351_1
SELECT MIN("radius__r___") FROM "table_10432351_1"
0.048828
CREATE TABLE table_name_55 (year NUMBER, wins NUMBER)
What is the earliest year associated with under 0 wins?
SELECT MIN(year) FROM table_name_55 WHERE wins < 0
SELECT MIN("year") FROM "table_name_55" WHERE "wins" < 0
0.054688
CREATE TABLE table_30544 ("#" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" CLOB, "Winnings ( $ ) " FLOAT, "After" FLOAT, "Before" FLOAT)
What is the to par when the after is 33?
SELECT "To par" FROM table_30544 WHERE "After" = '33'
SELECT "To par" FROM "table_30544" WHERE "After" = '33'
0.053711
CREATE TABLE table_25742 ("Season" CLOB, "Oberbayern A" CLOB, "Oberbayern B" CLOB, "Niederbayern" CLOB, "Schwaben" CLOB, "Oberpfalz" CLOB)
When fc schwandorf is the oberpfalz what is the oberbayern b?
SELECT "Oberbayern B" FROM table_25742 WHERE "Oberpfalz" = 'FC Schwandorf'
SELECT "Oberbayern B" FROM "table_25742" WHERE "Oberpfalz" = 'FC Schwandorf'
0.074219
CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB)
How are people using the 'Leaving a half-answer as a comment' comment?.
SELECT PostId AS "post_link", * FROM Comments WHERE Text LIKE '%Leaving a half-answer as a comment%'
SELECT "PostId" AS "post_link", * FROM "Comments" WHERE "Text" LIKE '%Leaving a half-answer as a comment%'
0.103516
CREATE TABLE table_38274 ("Team" CLOB, "Driver" CLOB, "Laps" FLOAT, "Time" CLOB, "Grid" FLOAT)
What is the smallest grid number that had 10 laps listed with Jonathan Summerton as the driver?
SELECT MIN("Grid") FROM table_38274 WHERE "Laps" = '10' AND "Driver" = 'jonathan summerton'
SELECT MIN("Grid") FROM "table_38274" WHERE "Driver" = 'jonathan summerton' AND "Laps" = '10'
0.09082
CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB)
how many patients whose gender is m and drug code is clin1000i?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "M" AND prescriptions.formulary_drug_cd = "CLIN1000I"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "CLIN1000I" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "M" = "demographic"."gender"
0.227539
CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB)
Number of users with rep >= X.
SELECT COUNT(Id) AS "number_of_users" FROM Users WHERE Reputation >= '##minrep##'
SELECT COUNT("Id") AS "number_of_users" FROM "Users" WHERE "Reputation" >= '##minrep##'
0.084961
CREATE TABLE table_28795 ("Episode" FLOAT, "Title" CLOB, "Writer" CLOB, "Director" CLOB, "Original airdate" CLOB, "Ratings ( Kanto ) " CLOB, "Ratings ( Kansai ) " CLOB)
Who is the writer with the ratings 14.8?
SELECT "Writer" FROM table_28795 WHERE "Ratings (Kanto)" = '14.8'
SELECT "Writer" FROM "table_28795" WHERE "Ratings (Kanto)" = '14.8'
0.06543
CREATE TABLE table_67886 ("City" CLOB, "Province/Region" CLOB, "Country" CLOB, "IATA" CLOB, "ICAO" CLOB, "Airport" CLOB)
In what country is Hiroshima Airport located?
SELECT "Country" FROM table_67886 WHERE "Airport" = 'hiroshima airport'
SELECT "Country" FROM "table_67886" WHERE "Airport" = 'hiroshima airport'
0.071289
CREATE TABLE table_74882 ("District" CLOB, "Incumbent" CLOB, "Party" CLOB, "First elected" FLOAT, "Result" CLOB)
Which District has a Result of Re-elected and a First Elected of 1898?
SELECT "District" FROM table_74882 WHERE "Result" = 're-elected' AND "First elected" = '1898'
SELECT "District" FROM "table_74882" WHERE "First elected" = '1898' AND "Result" = 're-elected'
0.092773
CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB)
get me the number of patients less than 85 years who have lab test item id 51274.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "85" AND lab.itemid = "51274"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51274" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "85" > "demographic"."age"
0.181641
CREATE TABLE table_name_30 (time VARCHAR2, record VARCHAR2)
What is the Time of the match with a Record of 3-3?
SELECT time FROM table_name_30 WHERE record = "3-3"
SELECT "time" FROM "table_name_30" WHERE "3-3" = "record"
0.055664
CREATE TABLE table_name_35 (qual VARCHAR2, laps VARCHAR2, year VARCHAR2)
What was the qualification with more than 162 laps in 1953?
SELECT qual FROM table_name_35 WHERE laps > 162 AND year = "1953"
SELECT "qual" FROM "table_name_35" WHERE "1953" = "year" AND "laps" > 162
0.071289
CREATE TABLE table_38763 ("The Kennel Club ( UK ) Toy Group" CLOB, "Canadian Kennel Club Toy Dogs Group" CLOB, "American Kennel Club Toy Group" CLOB, "Australian National Kennel Council Toy Dogs Group" CLOB, "New Zealand Kennel Club Toy Group" CLOB)
What is the Kennel Club (UK) Toy Group with the shih-tzu as the American Kennel Club Toy Group breed?
SELECT "The Kennel Club (UK) Toy Group" FROM table_38763 WHERE "American Kennel Club Toy Group" = 'shih-tzu'
SELECT "The Kennel Club (UK) Toy Group" FROM "table_38763" WHERE "American Kennel Club Toy Group" = 'shih-tzu'
0.107422
CREATE TABLE Invoice_Line_Items (order_item_id NUMBER, invoice_number NUMBER, product_id NUMBER, product_title VARCHAR2, product_quantity VARCHAR2, product_price NUMBER, derived_product_cost NUMBER, derived_vat_payable NUMBER, derived_total_cost NUMBER) CREATE TABLE Customers (customer_id NUMBER, customer_first_name VARCHAR2, customer_middle_initial VARCHAR2, customer_last_name VARCHAR2, gender VARCHAR2, email_address VARCHAR2, login_name VARCHAR2, login_password VARCHAR2, phone_number VARCHAR2, town_city VARCHAR2, state_county_province VARCHAR2, country VARCHAR2) CREATE TABLE Order_Items (order_item_id NUMBER, order_id NUMBER, product_id NUMBER, product_quantity VARCHAR2, other_order_item_details VARCHAR2) CREATE TABLE Financial_Transactions (transaction_id NUMBER, account_id NUMBER, invoice_number NUMBER, transaction_type VARCHAR2, transaction_date DATETIME, transaction_amount NUMBER, transaction_comment VARCHAR2, other_transaction_details VARCHAR2) CREATE TABLE Orders (order_id NUMBER, customer_id NUMBER, date_order_placed DATETIME, order_details VARCHAR2) CREATE TABLE Invoices (invoice_number NUMBER, order_id NUMBER, invoice_date DATETIME) CREATE TABLE Accounts (account_id NUMBER, customer_id NUMBER, date_account_opened DATETIME, account_name VARCHAR2, other_account_details VARCHAR2) CREATE TABLE Product_Categories (production_type_code VARCHAR2, product_type_description VARCHAR2, vat_rating NUMBER) CREATE TABLE Products (product_id NUMBER, parent_product_id NUMBER, production_type_code VARCHAR2, unit_price NUMBER, product_name VARCHAR2, product_color VARCHAR2, product_size VARCHAR2)
Visualize a scatter chart on how many different products correspond to each order id?
SELECT order_id, COUNT(DISTINCT product_id) FROM Order_Items
SELECT "order_id", COUNT(DISTINCT "product_id") FROM "Order_Items"
0.064453
CREATE TABLE table_69243 ("Date" CLOB, "Time" CLOB, "Round" CLOB, "Opponent" CLOB, "Ground" CLOB, "Score" CLOB)
What time was the game played against Cagliari that lasted 16 rounds?
SELECT "Time" FROM table_69243 WHERE "Opponent" = 'cagliari' AND "Round" = '16'
SELECT "Time" FROM "table_69243" WHERE "Opponent" = 'cagliari' AND "Round" = '16'
0.079102
CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
when was patient 025-55786 last measured heartrate until 11/21/2104?
SELECT vitalperiodic.observationtime FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-55786')) AND NOT vitalperiodic.heartrate IS NULL AND STRFTIME('%y-%m-%d', vitalperiodic.observationtime) <= '2104-11-21' ORDER BY vitalperiodic.observationtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '025-55786' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "vitalperiodic"."observationtime" FROM "vitalperiodic" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."heartrate" IS NULL AND STRFTIME('%y-%m-%d', "vitalperiodic"."observationtime") <= '2104-11-21' ORDER BY "vitalperiodic"."observationtime" DESC FETCH FIRST 1 ROWS ONLY
0.694336
CREATE TABLE table_41515 ("Date" CLOB, "Cover model" CLOB, "Centerfold model" CLOB, "Interview subject" CLOB, "20 Questions" CLOB)
Who was the 20 Questions section aimed at when the Interview Subject was Camille Paglia?
SELECT "20 Questions" FROM table_41515 WHERE "Interview subject" = 'camille paglia'
SELECT "20 Questions" FROM "table_41515" WHERE "Interview subject" = 'camille paglia'
0.083008
CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB) CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB)
count the number of patients whose diagnoses long title is long-term (current) use of steroids and lab test abnormal status is delta?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.long_title = "Long-term (current) use of steroids" AND lab.flag = "delta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Long-term (current) use of steroids" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "delta" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.28125
CREATE TABLE Manufacturers (Code NUMBER, Name VARCHAR2, Headquarter VARCHAR2, Founder VARCHAR2, Revenue FLOAT) CREATE TABLE Products (Code NUMBER, Name VARCHAR2, Price NUMBER, Manufacturer NUMBER)
For those records from the products and each product's manufacturer, draw a bar chart about the distribution of name and the sum of code , and group by attribute name, could you list in descending by the bars?
SELECT T2.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T2.Name ORDER BY T2.Name DESC
SELECT "T2"."Name", "T1"."Code" FROM "Products" "T1" JOIN "Manufacturers" "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T2"."Name" ORDER BY "T2"."Name" DESC
0.158203
CREATE TABLE table_6188 ("Date" CLOB, "Opponent" CLOB, "Venue" CLOB, "Result" CLOB, "Attendance" CLOB)
Which Opponent has a Attendance of 7,034?
SELECT "Opponent" FROM table_6188 WHERE "Attendance" = '7,034'
SELECT "Opponent" FROM "table_6188" WHERE "Attendance" = '7,034'
0.0625
CREATE TABLE table_name_71 (date VARCHAR2, record VARCHAR2)
What date was the record 38-22?
SELECT date FROM table_name_71 WHERE record = "38-22"
SELECT "date" FROM "table_name_71" WHERE "38-22" = "record"
0.057617
CREATE TABLE table_34542 ("Date" CLOB, "Tournament" CLOB, "Winning score" CLOB, "Margin of victory" CLOB, "Runner ( s ) -up" CLOB)
What is the winning score for Tournament of linde german masters with a margin of victory of 1 stroke?
SELECT "Winning score" FROM table_34542 WHERE "Margin of victory" = '1 stroke' AND "Tournament" = 'linde german masters'
SELECT "Winning score" FROM "table_34542" WHERE "Margin of victory" = '1 stroke' AND "Tournament" = 'linde german masters'
0.119141
CREATE TABLE table_50513 ("Rank" FLOAT, "Name" CLOB, "Team ( s ) " CLOB, "Birth date" CLOB, "Death date" CLOB, "Age ( as of 1 February 2014 ) " CLOB, "Nationality" CLOB)
What is the age of Fred Gibson?
SELECT "Age (as of 1 February 2014)" FROM table_50513 WHERE "Name" = 'fred gibson'
SELECT "Age (as of 1 February 2014)" FROM "table_50513" WHERE "Name" = 'fred gibson'
0.082031
CREATE TABLE university (School_ID NUMBER, School CLOB, Location CLOB, Founded FLOAT, Affiliation CLOB, Enrollment FLOAT, Nickname CLOB, Primary_conference CLOB) CREATE TABLE basketball_match (Team_ID NUMBER, School_ID NUMBER, Team_Name CLOB, ACC_Regular_Season CLOB, ACC_Percent CLOB, ACC_Home CLOB, ACC_Road CLOB, All_Games CLOB, All_Games_Percent NUMBER, All_Home CLOB, All_Road CLOB, All_Neutral CLOB)
A bar chart shows the distribution of All_Games and ACC_Percent , could you list from high to low by the names?
SELECT All_Games, ACC_Percent FROM basketball_match ORDER BY All_Games DESC
SELECT "All_Games", "ACC_Percent" FROM "basketball_match" ORDER BY "All_Games" DESC
0.081055
CREATE TABLE table_name_49 (headquarter VARCHAR2, type VARCHAR2)
What is Headquarter, when Type is Independent Online News Portal?
SELECT headquarter FROM table_name_49 WHERE type = "independent online news portal"
SELECT "headquarter" FROM "table_name_49" WHERE "independent online news portal" = "type"
0.086914
CREATE TABLE table_2305948_1 (country VARCHAR2)
How many times has a wrestler from the country of England wrestled in this event?
SELECT COUNT(2) FROM table_2305948_1 WHERE country = "England"
SELECT COUNT(2) FROM "table_2305948_1" WHERE "England" = "country"
0.064453
CREATE TABLE table_52421 ("Result" CLOB, "Opponent" CLOB, "Method" CLOB, "Event" CLOB, "Date" FLOAT, "Notes" CLOB)
I want the event for method of points with notes of opening round
SELECT "Event" FROM table_52421 WHERE "Method" = 'points' AND "Notes" = 'opening round'
SELECT "Event" FROM "table_52421" WHERE "Method" = 'points' AND "Notes" = 'opening round'
0.086914
CREATE TABLE gas_station (Station_ID NUMBER, Open_Year NUMBER, Location CLOB, Manager_Name CLOB, Vice_Manager_Name CLOB, Representative_Name CLOB) CREATE TABLE company (Company_ID NUMBER, Rank NUMBER, Company CLOB, Headquarters CLOB, Main_Industry CLOB, Sales_billion FLOAT, Profits_billion FLOAT, Assets_billion FLOAT, Market_Value FLOAT) CREATE TABLE station_company (Station_ID NUMBER, Company_ID NUMBER, Rank_of_the_Year NUMBER)
How many companies in each headquarter? Plot a bar chart, could you order in ascending by the y-axis please?
SELECT Headquarters, COUNT(Headquarters) FROM company GROUP BY Headquarters ORDER BY COUNT(Headquarters)
SELECT "Headquarters", COUNT("Headquarters") FROM "company" GROUP BY "Headquarters" ORDER BY COUNT("Headquarters")
0.111328
CREATE TABLE table_21153 ("Season" FLOAT, "Class" CLOB, "Motorcycle" CLOB, "Team" CLOB, "Races" FLOAT, "Wins" FLOAT, "Podiums" FLOAT, "Poles" FLOAT, "FLaps" FLOAT, "Points" CLOB, "Placement" CLOB)
Name the number of flaps for 63 points
SELECT COUNT("FLaps") FROM table_21153 WHERE "Points" = '63'
SELECT COUNT("FLaps") FROM "table_21153" WHERE "Points" = '63'
0.060547
CREATE TABLE train (Train_ID NUMBER, Train_Num CLOB, Name CLOB, From CLOB, Arrival CLOB, Railway_ID NUMBER) CREATE TABLE railway_manage (Railway_ID NUMBER, Manager_ID NUMBER, From_Year CLOB) CREATE TABLE railway (Railway_ID NUMBER, Railway CLOB, Builder CLOB, Built CLOB, Wheels CLOB, Location CLOB, ObjectNumber CLOB) CREATE TABLE manager (Manager_ID NUMBER, Name CLOB, Country CLOB, Working_year_starts CLOB, Age NUMBER, Level NUMBER)
A bar chart for showing the number of the countries that have managers of age above 50 or below 46, could you order x-axis from low to high order?
SELECT Country, COUNT(Country) FROM manager WHERE Age > 50 OR Age < 46 GROUP BY Country ORDER BY Country
SELECT "Country", COUNT("Country") FROM "manager" WHERE "Age" < 46 OR "Age" > 50 GROUP BY "Country" ORDER BY "Country"
0.115234
CREATE TABLE table_52501 ("Series #" FLOAT, "Season #" FLOAT, "Title" CLOB, "Directed by" CLOB, "Original air date" CLOB, "Production code" CLOB)
What title aired on March 19, 1998?
SELECT "Title" FROM table_52501 WHERE "Original air date" = 'march 19, 1998'
SELECT "Title" FROM "table_52501" WHERE "Original air date" = 'march 19, 1998'
0.076172
CREATE TABLE table_62224 ("Tie no" CLOB, "Home team" CLOB, "Score" CLOB, "Away team" CLOB, "Date" CLOB)
Who was the away team on 31 January 1987 when the home team was Wimbledon?
SELECT "Away team" FROM table_62224 WHERE "Date" = '31 january 1987' AND "Home team" = 'wimbledon'
SELECT "Away team" FROM "table_62224" WHERE "Date" = '31 january 1987' AND "Home team" = 'wimbledon'
0.097656
CREATE TABLE PostHistoryTypes (Id NUMBER, Name CLOB) CREATE TABLE SuggestedEditVotes (Id NUMBER, SuggestedEditId NUMBER, UserId NUMBER, VoteTypeId NUMBER, CreationDate TIME, TargetUserId NUMBER, TargetRepChange NUMBER) CREATE TABLE Comments (Id NUMBER, PostId NUMBER, Score NUMBER, Text CLOB, CreationDate TIME, UserDisplayName CLOB, UserId NUMBER, ContentLicense CLOB) CREATE TABLE Users (Id NUMBER, Reputation NUMBER, CreationDate TIME, DisplayName CLOB, LastAccessDate TIME, WebsiteUrl CLOB, Location CLOB, AboutMe CLOB, Views NUMBER, UpVotes NUMBER, DownVotes NUMBER, ProfileImageUrl CLOB, EmailHash CLOB, AccountId NUMBER) CREATE TABLE Posts (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE PostLinks (Id NUMBER, CreationDate TIME, PostId NUMBER, RelatedPostId NUMBER, LinkTypeId NUMBER) CREATE TABLE Badges (Id NUMBER, UserId NUMBER, Name CLOB, Date TIME, Class NUMBER, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostHistory (Id NUMBER, PostHistoryTypeId NUMBER, PostId NUMBER, RevisionGUID other, CreationDate TIME, UserId NUMBER, UserDisplayName CLOB, Comment CLOB, Text CLOB, ContentLicense CLOB) CREATE TABLE TagSynonyms (Id NUMBER, SourceTagName CLOB, TargetTagName CLOB, CreationDate TIME, OwnerUserId NUMBER, AutoRenameCount NUMBER, LastAutoRename TIME, Score NUMBER, ApprovedByUserId NUMBER, ApprovalDate TIME) CREATE TABLE PostTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewRejectionReasons (Id NUMBER, Name CLOB, Description CLOB, PostTypeId NUMBER) CREATE TABLE PostNotices (Id NUMBER, PostId NUMBER, PostNoticeTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body CLOB, OwnerUserId NUMBER, DeletionUserId NUMBER) CREATE TABLE SuggestedEdits (Id NUMBER, PostId NUMBER, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId NUMBER, Comment CLOB, Text CLOB, Title CLOB, Tags CLOB, RevisionGUID other) CREATE TABLE ReviewTasks (Id NUMBER, ReviewTaskTypeId NUMBER, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId NUMBER, PostId NUMBER, SuggestedEditId NUMBER, CompletedByReviewTaskId NUMBER) CREATE TABLE CloseAsOffTopicReasonTypes (Id NUMBER, IsUniversal BOOLEAN, InputTitle CLOB, MarkdownInputGuidance CLOB, MarkdownPostOwnerGuidance CLOB, MarkdownPrivilegedUserGuidance CLOB, MarkdownConcensusDescription CLOB, CreationDate TIME, CreationModeratorId NUMBER, ApprovalDate TIME, ApprovalModeratorId NUMBER, DeactivationDate TIME, DeactivationModeratorId NUMBER) CREATE TABLE PostTags (PostId NUMBER, TagId NUMBER) CREATE TABLE ReviewTaskResults (Id NUMBER, ReviewTaskId NUMBER, ReviewTaskResultTypeId NUMBER, CreationDate TIME, RejectionReasonId NUMBER, Comment CLOB) CREATE TABLE CloseReasonTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE ReviewTaskTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE Tags (Id NUMBER, TagName CLOB, Count NUMBER, ExcerptPostId NUMBER, WikiPostId NUMBER) CREATE TABLE ReviewTaskResultTypes (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostsWithDeleted (Id NUMBER, PostTypeId NUMBER, AcceptedAnswerId NUMBER, ParentId NUMBER, CreationDate TIME, DeletionDate TIME, Score NUMBER, ViewCount NUMBER, Body CLOB, OwnerUserId NUMBER, OwnerDisplayName CLOB, LastEditorUserId NUMBER, LastEditorDisplayName CLOB, LastEditDate TIME, LastActivityDate TIME, Title CLOB, Tags CLOB, AnswerCount NUMBER, CommentCount NUMBER, FavoriteCount NUMBER, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense CLOB) CREATE TABLE Votes (Id NUMBER, PostId NUMBER, VoteTypeId NUMBER, UserId NUMBER, CreationDate TIME, BountyAmount NUMBER) CREATE TABLE PendingFlags (Id NUMBER, FlagTypeId NUMBER, PostId NUMBER, CreationDate TIME, CloseReasonTypeId NUMBER, CloseAsOffTopicReasonTypeId NUMBER, DuplicateOfQuestionId NUMBER, BelongsOnBaseHostAddress CLOB) CREATE TABLE PostFeedback (Id NUMBER, PostId NUMBER, IsAnonymous BOOLEAN, VoteTypeId NUMBER, CreationDate TIME) CREATE TABLE VoteTypes (Id NUMBER, Name CLOB) CREATE TABLE ReviewTaskStates (Id NUMBER, Name CLOB, Description CLOB) CREATE TABLE PostNoticeTypes (Id NUMBER, ClassId NUMBER, Name CLOB, Body CLOB, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId NUMBER)
Top 20 Bounty hunters per # of bounties and rep.
SELECT Posts.OwnerUserId AS "user_link", COUNT(*) AS "bounties_won", SUM(Votes.BountyAmount) AS "rep_gained" FROM Votes INNER JOIN Posts ON Votes.PostId = Posts.Id WHERE VoteTypeId = 9 GROUP BY Posts.OwnerUserId ORDER BY 2 DESC LIMIT 20
SELECT "Posts"."OwnerUserId" AS "user_link", COUNT(*) AS "bounties_won", SUM("Votes"."BountyAmount") AS "rep_gained" FROM "Votes" JOIN "Posts" ON "Posts"."Id" = "Votes"."PostId" WHERE "VoteTypeId" = 9 GROUP BY "Posts"."OwnerUserId" ORDER BY 2 DESC FETCH FIRST 20 ROWS ONLY
0.265625
CREATE TABLE paperdataset (paperid NUMBER, datasetid NUMBER) CREATE TABLE dataset (datasetid NUMBER, datasetname VARCHAR2) CREATE TABLE paperkeyphrase (paperid NUMBER, keyphraseid NUMBER) CREATE TABLE paper (paperid NUMBER, title VARCHAR2, venueid NUMBER, year NUMBER, numciting NUMBER, numcitedby NUMBER, journalid NUMBER) CREATE TABLE paperfield (fieldid NUMBER, paperid NUMBER) CREATE TABLE field (fieldid NUMBER) CREATE TABLE venue (venueid NUMBER, venuename VARCHAR2) CREATE TABLE cite (citingpaperid NUMBER, citedpaperid NUMBER) CREATE TABLE author (authorid NUMBER, authorname VARCHAR2) CREATE TABLE journal (journalid NUMBER, journalname VARCHAR2) CREATE TABLE writes (paperid NUMBER, authorid NUMBER) CREATE TABLE keyphrase (keyphraseid NUMBER, keyphrasename VARCHAR2)
How many papers does Andrew King have ?
SELECT DISTINCT COUNT(DISTINCT writes.paperid) FROM author, writes WHERE author.authorname = 'Andrew King' AND writes.authorid = author.authorid
SELECT DISTINCT COUNT(DISTINCT "writes"."paperid") FROM "author" JOIN "writes" ON "author"."authorid" = "writes"."authorid" WHERE "author"."authorname" = 'Andrew King'
0.163086
CREATE TABLE table_55625 ("Goalkeeper" CLOB, "Goals" FLOAT, "Matches" FLOAT, "Average" FLOAT, "Team" CLOB)
What team has Carlos S nchez as a goalkeeper and an average below 1.12?
SELECT "Team" FROM table_55625 WHERE "Average" < '1.12' AND "Goalkeeper" = 'carlos sánchez'
SELECT "Team" FROM "table_55625" WHERE "Average" < '1.12' AND "Goalkeeper" = 'carlos sánchez'
0.09082
CREATE TABLE prescriptions (subject_id CLOB, hadm_id CLOB, icustay_id CLOB, drug_type CLOB, drug CLOB, formulary_drug_cd CLOB, route CLOB, drug_dose CLOB) CREATE TABLE demographic (subject_id CLOB, hadm_id CLOB, name CLOB, marital_status CLOB, age CLOB, dob CLOB, gender CLOB, language CLOB, religion CLOB, admission_type CLOB, days_stay CLOB, insurance CLOB, ethnicity CLOB, expire_flag CLOB, admission_location CLOB, discharge_location CLOB, diagnosis CLOB, dod CLOB, dob_year CLOB, dod_year CLOB, admittime CLOB, dischtime CLOB, admityear CLOB) CREATE TABLE diagnoses (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE procedures (subject_id CLOB, hadm_id CLOB, icd9_code CLOB, short_title CLOB, long_title CLOB) CREATE TABLE lab (subject_id CLOB, hadm_id CLOB, itemid CLOB, charttime CLOB, flag CLOB, value_unit CLOB, label CLOB, fluid CLOB)
count the number of patients whose admission type is emergency and procedure short title is int insert lead in vent?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND procedures.short_title = "Int insert lead in vent"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Int insert lead in vent" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "EMERGENCY" = "demographic"."admission_type"
0.242188
CREATE TABLE medication (medicationid NUMBER, patientunitstayid NUMBER, drugname CLOB, dosage CLOB, routeadmin CLOB, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid CLOB, patienthealthsystemstayid NUMBER, patientunitstayid NUMBER, gender CLOB, age CLOB, ethnicity CLOB, hospitalid NUMBER, wardid NUMBER, admissionheight NUMBER, admissionweight NUMBER, dischargeweight NUMBER, hospitaladmittime TIME, hospitaladmitsource CLOB, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus CLOB) CREATE TABLE intakeoutput (intakeoutputid NUMBER, patientunitstayid NUMBER, cellpath CLOB, celllabel CLOB, cellvaluenumeric NUMBER, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid NUMBER, patientunitstayid NUMBER, treatmentname CLOB, treatmenttime TIME) CREATE TABLE lab (labid NUMBER, patientunitstayid NUMBER, labname CLOB, labresult NUMBER, labresulttime TIME) CREATE TABLE allergy (allergyid NUMBER, patientunitstayid NUMBER, drugname CLOB, allergyname CLOB, allergytime TIME) CREATE TABLE cost (costid NUMBER, uniquepid CLOB, patienthealthsystemstayid NUMBER, eventtype CLOB, eventid NUMBER, chargetime TIME, cost NUMBER) CREATE TABLE vitalperiodic (vitalperiodicid NUMBER, patientunitstayid NUMBER, temperature NUMBER, sao2 NUMBER, heartrate NUMBER, respiration NUMBER, systemicsystolic NUMBER, systemicdiastolic NUMBER, systemicmean NUMBER, observationtime TIME) CREATE TABLE diagnosis (diagnosisid NUMBER, patientunitstayid NUMBER, diagnosisname CLOB, diagnosistime TIME, icd9code CLOB) CREATE TABLE microlab (microlabid NUMBER, patientunitstayid NUMBER, culturesite CLOB, organism CLOB, culturetakentime TIME)
what is the minimum cost of the hospital that regular insulin involves until 4 years ago?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT medication.patientunitstayid FROM medication WHERE medication.drugname = 'regular insulin')) AND DATETIME(cost.chargetime) <= DATETIME(CURRENT_TIME(), '-4 year') GROUP BY cost.patienthealthsystemstayid) AS t1
WITH "_u_0" AS (SELECT "medication"."patientunitstayid" FROM "medication" WHERE "medication"."drugname" = 'regular insulin' GROUP BY "patientunitstayid"), "_u_1" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" LEFT JOIN "_u_0" "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patienthealthsystemstayid"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" "_u_1" ON "_u_1"."" = "cost"."patienthealthsystemstayid" WHERE DATETIME("cost"."chargetime") <= DATETIME(CURRENT_TIME(), '-4 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."patienthealthsystemstayid") SELECT MIN("t1"."c1") FROM "t1" "t1"
0.657227
CREATE TABLE table_45317 ("Place" CLOB, "Player" CLOB, "Country" CLOB, "Score" CLOB, "To par" FLOAT, "Money ( $ ) " CLOB)
What was gary player's score?
SELECT "Score" FROM table_45317 WHERE "Player" = 'gary player'
SELECT "Score" FROM "table_45317" WHERE "Player" = 'gary player'
0.0625
CREATE TABLE table_name_92 (ngc_number VARCHAR2, right_ascension___j2000__ VARCHAR2)
I want the NGC number for right ascension of 08h11m13.6s
SELECT ngc_number FROM table_name_92 WHERE right_ascension___j2000__ = "08h11m13.6s"
SELECT "ngc_number" FROM "table_name_92" WHERE "08h11m13.6s" = "right_ascension___j2000__"
0.087891