schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
count the number of people who were diagnosed with lung contusion-open and didn't come back to the hospital within 2 months.
SELECT (SELECT COUNT(DISTINCT t1.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'lung contusion-open')) AS t1) - (SELECT COUNT(DISTINCT t2.subject_id) FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'lung contusion-open')) AS t2 JOIN admissions ON t2.subject_id = admissions.subject_id WHERE t2.charttime < admissions.admittime AND DATETIME(admissions.admittime) BETWEEN DATETIME(t2.charttime) AND DATETIME(t2.charttime, '+2 month'))
WITH "_u_0" AS (SELECT "d_icd_diagnoses"."icd9_code" FROM "d_icd_diagnoses" WHERE "d_icd_diagnoses"."short_title" = 'lung contusion-open') SELECT (SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "diagnoses_icd" JOIN "_u_0" AS "_u_0" ON "_u_0"."icd9_code" = "diagnoses_icd"."icd9_code" JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id") - (SELECT COUNT(DISTINCT "admissions_2"."subject_id") FROM "diagnoses_icd" JOIN "_u_0" AS "_u_2" ON "_u_2"."icd9_code" = "diagnoses_icd"."icd9_code" JOIN "admissions" AS "admissions_2" ON "admissions_2"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "admissions" ON "admissions"."admittime" > "diagnoses_icd"."charttime" AND "admissions"."subject_id" = "admissions_2"."subject_id" AND DATETIME("admissions"."admittime") <= DATETIME("diagnoses_icd"."charttime", '+2 month') AND DATETIME("admissions"."admittime") >= DATETIME("diagnoses_icd"."charttime"))
0.891602
CREATE TABLE table_19744915_22 (couple VARCHAR, public INT)
What couple had less than 2.0 points from the public?
SELECT couple FROM table_19744915_22 WHERE public < 2.0
SELECT "couple" FROM "table_19744915_22" WHERE "public" < 2.0
0.05957
CREATE TABLE table_name_94 (location VARCHAR, time VARCHAR)
Where was the fight that took a time of 1:37?
SELECT location FROM table_name_94 WHERE time = "1:37"
SELECT "location" FROM "table_name_94" WHERE "1:37" = "time"
0.058594
CREATE TABLE table_13987 ("Rank" FLOAT, "Athlete" TEXT, "Country" TEXT, "Time" TEXT, "Notes" TEXT)
What is the Rank of the Player with a Time of 7:20.32 and Notes of FB?
SELECT COUNT("Rank") FROM table_13987 WHERE "Notes" = 'fb' AND "Time" = '7:20.32'
SELECT COUNT("Rank") FROM "table_13987" WHERE "Notes" = 'fb' AND "Time" = '7:20.32'
0.081055
CREATE TABLE table_name_61 (score VARCHAR, opponent VARCHAR, date VARCHAR)
Name the score when the opponent was the dodgers on april 21
SELECT score FROM table_name_61 WHERE opponent = "dodgers" AND date = "april 21"
SELECT "score" FROM "table_name_61" WHERE "april 21" = "date" AND "dodgers" = "opponent"
0.085938
CREATE TABLE table_14650373_1 (pick__number VARCHAR, college VARCHAR)
What number picked were players from arizona state picked?
SELECT pick__number FROM table_14650373_1 WHERE college = "Arizona State"
SELECT "pick__number" FROM "table_14650373_1" WHERE "Arizona State" = "college"
0.077148
CREATE TABLE table_27987623_1 (season_episode VARCHAR, us_viewers__in_million_ VARCHAR)
What was the episode number for the episode viewed by 5.68 million viewers?
SELECT season_episode FROM table_27987623_1 WHERE us_viewers__in_million_ = "5.68"
SELECT "season_episode" FROM "table_27987623_1" WHERE "5.68" = "us_viewers__in_million_"
0.085938
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
popular db access programming languages.
SELECT COUNT(DISTINCT P.Id) AS num_questions, t_dbname.TagName FROM Posts AS P INNER JOIN PostTags AS pt ON pt.PostId = P.Id INNER JOIN Tags AS t_lang ON t_lang.Id = pt.TagId INNER JOIN PostTags AS pt_db ON pt_db.PostId = P.Id INNER JOIN Tags AS t_dbname ON t_dbname.Id = pt_db.TagId WHERE t_lang.TagName IN ('c++', 'java', 'python', 'go', 'php', 'asp.net', 'c#', 'node.js', 'ocaml', 'haskell', 'erlang') AND t_dbname.TagName IN ('mysql', 'sql-server', 'oracle', 'postgresql', 'db2', 'mongo', 'rocksdb', 'redis', 'google-cloud-spanner', 'amazon-dynamodb', 'azure-cosmosdb', 'voltdb', 'sqlite', 'leveldb', 'hbase') AND P.CreationDate > DATEADD(yyyy, -2, SYSDATETIME()) GROUP BY t_dbname.TagName ORDER BY COUNT(DISTINCT P.Id) DESC
SELECT COUNT(DISTINCT "P"."Id") AS "num_questions", "t_dbname"."TagName" FROM "Posts" AS "P" JOIN "PostTags" AS "pt" ON "P"."Id" = "pt"."PostId" JOIN "PostTags" AS "pt_db" ON "P"."Id" = "pt_db"."PostId" JOIN "Tags" AS "t_dbname" ON "pt_db"."TagId" = "t_dbname"."Id" AND "t_dbname"."TagName" IN ('mysql', 'sql-server', 'oracle', 'postgresql', 'db2', 'mongo', 'rocksdb', 'redis', 'google-cloud-spanner', 'amazon-dynamodb', 'azure-cosmosdb', 'voltdb', 'sqlite', 'leveldb', 'hbase') JOIN "Tags" AS "t_lang" ON "pt"."TagId" = "t_lang"."Id" AND "t_lang"."TagName" IN ('c++', 'java', 'python', 'go', 'php', 'asp.net', 'c#', 'node.js', 'ocaml', 'haskell', 'erlang') WHERE "P"."CreationDate" > DATEADD(YEAR, -2, SYSDATETIME()) GROUP BY "t_dbname"."TagName" ORDER BY COUNT(DISTINCT "P"."Id") DESC NULLS LAST
0.77832
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
how many patients were staying in csru careunits a year before?
SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT transfers.hadm_id FROM transfers WHERE transfers.careunit = 'csru' AND DATETIME(transfers.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year'))
WITH "_u_0" AS (SELECT "transfers"."hadm_id" FROM "transfers" WHERE "transfers"."careunit" = 'csru' AND DATETIME("transfers"."intime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "admissions"."hadm_id" WHERE NOT "_u_0"."" IS NULL
0.376953
CREATE TABLE table_name_3 (home_team VARCHAR, venue VARCHAR)
Who played the home team at Windy Hill?
SELECT home_team FROM table_name_3 WHERE venue = "windy hill"
SELECT "home_team" FROM "table_name_3" WHERE "venue" = "windy hill"
0.06543
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
Among patients who had a lab test for cerebrospinal fluid (CSF), how many of them had st elevated myocardial infarction or cardiac cath as their primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" AND lab.fluid = "Cerebrospinal Fluid (CSF)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Cerebrospinal Fluid (CSF)" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "ST ELEVATED MYOCARDIAL INFARCTION\CARDIAC CATH" = "demographic"."diagnosis"
0.249023
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
Recent short posts containing multiple common typos. Posts containing a body that is less than 8 chars long
SELECT Id AS "post_link", Body FROM Posts WHERE PostTypeId = 1 AND Id > 1000000 AND Id < 5000000 AND Body LIKE '%, and%' AND Body LIKE '%doesnt%' AND LENGTH(Body) < 500 ORDER BY Id DESC
SELECT "Id" AS "post_link", "Body" FROM "Posts" WHERE "Body" LIKE '%, and%' AND "Body" LIKE '%doesnt%' AND "Id" < 5000000 AND "Id" > 1000000 AND "PostTypeId" = 1 AND LENGTH("Body") < 500 ORDER BY "Id" DESC NULLS LAST
0.210938
CREATE TABLE table_37424 ("Round" FLOAT, "Pick" FLOAT, "Player" TEXT, "Position" TEXT, "School/Club Team" TEXT)
How many Picks have a Position of defensive back?
SELECT COUNT("Pick") FROM table_37424 WHERE "Position" = 'defensive back'
SELECT COUNT("Pick") FROM "table_37424" WHERE "Position" = 'defensive back'
0.073242
CREATE TABLE table_5108 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
Which Points is the lowest one that has a Position larger than 5?
SELECT MIN("Points") FROM table_5108 WHERE "Position" > '5'
SELECT MIN("Points") FROM "table_5108" WHERE "Position" > '5'
0.05957
CREATE TABLE table_name_81 (location VARCHAR, college_or_campus_name VARCHAR)
What Location has a College or Campus Name of anna university - tharamani campus?
SELECT location FROM table_name_81 WHERE college_or_campus_name = "anna university - tharamani campus"
SELECT "location" FROM "table_name_81" WHERE "anna university - tharamani campus" = "college_or_campus_name"
0.105469
CREATE TABLE table_name_27 (stadium VARCHAR, clubs VARCHAR)
What is the stadium of the zooveti tbilisi club?
SELECT stadium FROM table_name_27 WHERE clubs = "zooveti tbilisi"
SELECT "stadium" FROM "table_name_27" WHERE "clubs" = "zooveti tbilisi"
0.069336
CREATE TABLE table_24076 ("Episode" TEXT, "Broadcast date" TEXT, "Run time" TEXT, "Viewers ( in millions ) " TEXT, "Archive" TEXT)
What is the archive of the show that aired on 18april1970?
SELECT "Archive" FROM table_24076 WHERE "Broadcast date" = '18April1970'
SELECT "Archive" FROM "table_24076" WHERE "Broadcast date" = '18April1970'
0.072266
CREATE TABLE table_name_98 (nationality VARCHAR, time VARCHAR)
What Nationality's time is 2:07.64?
SELECT nationality FROM table_name_98 WHERE time = "2:07.64"
SELECT "nationality" FROM "table_name_98" WHERE "2:07.64" = "time"
0.064453
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
what is the number of patients with a diagnoses of diaphragmatic hernia without mention of obstruction or gangrene who had urine lab test?
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 = "Diaphragmatic hernia without mention of obstruction or gangrene" AND lab.fluid = "Urine"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Diaphragmatic hernia without mention of obstruction or gangrene" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "Urine" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.30957
CREATE TABLE table_60540 ("Country" TEXT, "Date" TEXT, "Label" TEXT, "Format" TEXT, "Catalogue number ( s ) " TEXT)
Which Country has a Catalogue number(s) of eredv711?
SELECT "Country" FROM table_60540 WHERE "Catalogue number(s)" = 'eredv711'
SELECT "Country" FROM "table_60540" WHERE "Catalogue number(s)" = 'eredv711'
0.074219
CREATE TABLE table_2339 ("School" TEXT, "Main location" TEXT, "Control" TEXT, "Type" TEXT, "Enrollment ( 2005 ) " FLOAT, "Founded" FLOAT)
Name the control for albany
SELECT "Control" FROM table_2339 WHERE "Main location" = 'Albany'
SELECT "Control" FROM "table_2339" WHERE "Main location" = 'Albany'
0.06543
CREATE TABLE table_name_90 (position VARCHAR, league VARCHAR, season VARCHAR)
Which Position has a League of southern league premier division, and a Season of 2004 05?
SELECT position FROM table_name_90 WHERE league = "southern league premier division" AND season = "2004–05"
SELECT "position" FROM "table_name_90" WHERE "2004–05" = "season" AND "league" = "southern league premier division"
0.112305
CREATE TABLE table_56499 ("Wind farm" TEXT, "Capacity ( MW ) " FLOAT, "Country" TEXT, "State/Province" TEXT, "Notes" TEXT)
Which state is Tehachapi Pass Wind Farm located in?
SELECT "State/Province" FROM table_56499 WHERE "Wind farm" = 'tehachapi pass wind farm'
SELECT "State/Province" FROM "table_56499" WHERE "Wind farm" = 'tehachapi pass wind farm'
0.086914
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is the unabbreviated version of the necator americanus?
SELECT d_icd_diagnoses.long_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'necator americanus' UNION SELECT d_icd_procedures.long_title FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'necator americanus'
SELECT "d_icd_diagnoses"."long_title" FROM "d_icd_diagnoses" WHERE "d_icd_diagnoses"."short_title" = 'necator americanus' UNION SELECT "d_icd_procedures"."long_title" FROM "d_icd_procedures" WHERE "d_icd_procedures"."short_title" = 'necator americanus'
0.246094
CREATE TABLE table_74347 ("Pick #" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "NHL team" TEXT, "College/junior/club team" TEXT)
How many draft picks is player byron dafoe?
SELECT COUNT("Pick #") FROM table_74347 WHERE "Player" = 'Byron Dafoe'
SELECT COUNT("Pick #") FROM "table_74347" WHERE "Player" = 'Byron Dafoe'
0.070313
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
provide the number of patients whose primary disease is sdh and lab test fluid is urine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.diagnosis = "SDH" AND lab.fluid = "Urine"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Urine" = "lab"."fluid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "SDH" = "demographic"."diagnosis"
0.1875
CREATE TABLE ref_address_types (address_type_code TEXT, address_type_description TEXT) CREATE TABLE addresses (address_id DECIMAL, line_1 TEXT, line_2 TEXT, line_3 TEXT, city TEXT, zip_postcode TEXT, state_province_county TEXT, country TEXT, other_address_details TEXT) CREATE TABLE detention (detention_id DECIMAL, detention_type_code TEXT, teacher_id DECIMAL, datetime_detention_start TIME, datetime_detention_end TIME, detention_summary TEXT, other_details TEXT) CREATE TABLE students_in_detention (student_id DECIMAL, detention_id DECIMAL, incident_id DECIMAL) CREATE TABLE teachers (teacher_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, gender TEXT, cell_mobile_number TEXT, email_address TEXT, other_details TEXT) CREATE TABLE assessment_notes (notes_id DECIMAL, student_id DECIMAL, teacher_id DECIMAL, date_of_notes TIME, text_of_notes TEXT, other_details TEXT) CREATE TABLE student_addresses (student_id DECIMAL, address_id DECIMAL, date_address_from TIME, date_address_to TIME, monthly_rental DECIMAL, other_details TEXT) CREATE TABLE ref_detention_type (detention_type_code TEXT, detention_type_description TEXT) CREATE TABLE ref_incident_type (incident_type_code TEXT, incident_type_description TEXT) CREATE TABLE students (student_id DECIMAL, address_id DECIMAL, first_name TEXT, middle_name TEXT, last_name TEXT, cell_mobile_number TEXT, email_address TEXT, date_first_rental TIME, date_left_university TIME, other_student_details TEXT) CREATE TABLE behavior_incident (incident_id DECIMAL, incident_type_code TEXT, student_id DECIMAL, date_incident_start TIME, date_incident_end TIME, incident_summary TEXT, recommendations TEXT, other_details TEXT)
What are the code and description of the least frequent detention type ?
SELECT T1.detention_type_code, T2.detention_type_description FROM detention AS T1 JOIN ref_detention_type AS T2 ON T1.detention_type_code = T2.detention_type_code GROUP BY T1.detention_type_code ORDER BY COUNT(*) LIMIT 1
SELECT "T1"."detention_type_code", "T2"."detention_type_description" FROM "detention" AS "T1" JOIN "ref_detention_type" AS "T2" ON "T1"."detention_type_code" = "T2"."detention_type_code" GROUP BY "T1"."detention_type_code" ORDER BY COUNT(*) NULLS FIRST LIMIT 1
0.253906
CREATE TABLE gas_station (Station_ID INT, Open_Year INT, Location TEXT, Manager_Name TEXT, Vice_Manager_Name TEXT, Representative_Name TEXT) CREATE TABLE company (Company_ID INT, Rank INT, Company TEXT, Headquarters TEXT, Main_Industry TEXT, Sales_billion FLOAT, Profits_billion FLOAT, Assets_billion FLOAT, Market_Value FLOAT) CREATE TABLE station_company (Station_ID INT, Company_ID INT, Rank_of_the_Year INT)
Show the number of companies whose headquarters are not from USA fpr each main industry in a pie chart.
SELECT Main_Industry, COUNT(Main_Industry) FROM company WHERE Headquarters <> 'USA' GROUP BY Main_Industry
SELECT "Main_Industry", COUNT("Main_Industry") FROM "company" WHERE "Headquarters" <> 'USA' GROUP BY "Main_Industry"
0.113281
CREATE TABLE table_59898 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " FLOAT)
What place did the golfer who had a score of 69-68-69-70=276 finish in?
SELECT "Place" FROM table_59898 WHERE "Score" = '69-68-69-70=276'
SELECT "Place" FROM "table_59898" WHERE "Score" = '69-68-69-70=276'
0.06543
CREATE TABLE table_26245 ("No" FLOAT, "Player" TEXT, "Height ( m ) " TEXT, "Height ( f ) " TEXT, "Position" TEXT, "Year born" FLOAT, "Current Club" TEXT)
Which players were born in 1983 and play as forward position?
SELECT "Player" FROM table_26245 WHERE "Year born" = '1983' AND "Position" = 'Forward'
SELECT "Player" FROM "table_26245" WHERE "Position" = 'Forward' AND "Year born" = '1983'
0.085938
CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT) CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT)
For those records from the products and each product's manufacturer, find name and code , and group by attribute name, and visualize them by a bar chart, and I want to order in asc by the x axis.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name, T1.Name ORDER BY T1.Name
SELECT "T1"."Name", "T1"."Code" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name", "T1"."Name" ORDER BY "T1"."Name" NULLS FIRST
0.183594
CREATE TABLE table_name_41 (week INT, attendance VARCHAR)
what is the lowest week when the attendance is 54,714?
SELECT MIN(week) FROM table_name_41 WHERE attendance = 54 OFFSET 714
SELECT MIN("week") FROM "table_name_41" WHERE "attendance" = 54 OFFSET 714
0.072266
CREATE TABLE table_52302 ("D 49 \\u221a" TEXT, "D 48 \\u221a" TEXT, "D 47 \\u221a" TEXT, "D 46 \\u221a" TEXT, "D 45 \\u221a" TEXT, "D 44 \\u221a" TEXT, "D 43 \\u221a" TEXT, "D 42 \\u221a" TEXT, "D 41 \\u221a" TEXT)
What is the D 48 with a D 46 with r 33 o?
SELECT "D 48 \u221a" FROM table_52302 WHERE "D 46 \u221a" = 'r 33 o'
SELECT "D 48 \u221a" FROM "table_52302" WHERE "D 46 \u221a" = 'r 33 o'
0.068359
CREATE TABLE table_55940 ("Rank" FLOAT, "Team" TEXT, "Floor Exercise" FLOAT, "Pommel Horse" FLOAT, "Rings" FLOAT, "Vault" FLOAT, "Parallel Bars" FLOAT, "Horizontal Bar" FLOAT, "Total" FLOAT)
How many Horizontal Bars have a Team of japan (jpn), and Parallel Bars smaller than 38.924?
SELECT COUNT("Horizontal Bar") FROM table_55940 WHERE "Team" = 'japan (jpn)' AND "Parallel Bars" < '38.924'
SELECT COUNT("Horizontal Bar") FROM "table_55940" WHERE "Parallel Bars" < '38.924' AND "Team" = 'japan (jpn)'
0.106445
CREATE TABLE table_name_37 (date VARCHAR, category VARCHAR, team VARCHAR)
How many dates does the ladies category correspond to Rothaus-Cube?
SELECT COUNT(date) FROM table_name_37 WHERE category = "ladies" AND team = "rothaus-cube"
SELECT COUNT("date") FROM "table_name_37" WHERE "category" = "ladies" AND "rothaus-cube" = "team"
0.094727
CREATE TABLE instructor (ID VARCHAR, name VARCHAR, dept_name VARCHAR, salary DECIMAL) CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity DECIMAL) CREATE TABLE advisor (s_ID VARCHAR, i_ID VARCHAR) CREATE TABLE time_slot (time_slot_id VARCHAR, day VARCHAR, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL) CREATE TABLE teaches (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL) CREATE TABLE takes (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, grade VARCHAR) CREATE TABLE course (course_id VARCHAR, title VARCHAR, dept_name VARCHAR, credits DECIMAL) CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget DECIMAL) CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR) CREATE TABLE student (ID VARCHAR, name VARCHAR, dept_name VARCHAR, tot_cred DECIMAL) CREATE TABLE section (course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, building VARCHAR, room_number VARCHAR, time_slot_id VARCHAR)
How many courses have two prerequisites? Show me a bar chart grouping by title, and display X-axis in desc order.
SELECT title, COUNT(title) FROM course AS T1 JOIN prereq AS T2 ON T1.course_id = T2.course_id GROUP BY title ORDER BY title DESC
SELECT "title", COUNT("title") FROM "course" AS "T1" JOIN "prereq" AS "T2" ON "T1"."course_id" = "T2"."course_id" GROUP BY "title" ORDER BY "title" DESC NULLS LAST
0.15918
CREATE TABLE table_name_75 (prefix VARCHAR, formula VARCHAR)
What is the prefix for the formula of Rsor'?
SELECT prefix FROM table_name_75 WHERE formula = "rsor'"
SELECT "prefix" FROM "table_name_75" WHERE "formula" = "rsor'"
0.060547
CREATE TABLE assignedto (scientist DECIMAL, project TEXT) CREATE TABLE scientists (ssn DECIMAL, name TEXT) CREATE TABLE projects (code TEXT, name TEXT, hours DECIMAL)
What is the name of the project with the most hours?
SELECT name FROM projects ORDER BY hours DESC LIMIT 1
SELECT "name" FROM "projects" ORDER BY "hours" DESC NULLS LAST LIMIT 1
0.068359
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
How many upvotes does my username have for each tag?. how long before I get tag badges?
SELECT TagName, COUNT(*) AS UpVotes FROM Tags INNER JOIN PostTags ON PostTags.TagId = Tags.Id INNER JOIN Posts ON Posts.ParentId = PostTags.PostId INNER JOIN Votes ON Votes.PostId = Posts.Id AND VoteTypeId = 2 INNER JOIN Users ON Users.AccountId = Posts.OwnerUserId WHERE Users.DisplayName = @DisplayName GROUP BY TagName ORDER BY UpVotes DESC
SELECT "TagName", COUNT(*) AS "UpVotes" FROM "Tags" JOIN "PostTags" ON "PostTags"."TagId" = "Tags"."Id" JOIN "Posts" ON "PostTags"."PostId" = "Posts"."ParentId" JOIN "Users" ON "Posts"."OwnerUserId" = "Users"."AccountId" AND "Users"."DisplayName" = $DisplayName JOIN "Votes" ON "Posts"."Id" = "Votes"."PostId" AND "VoteTypeId" = 2 GROUP BY "TagName" ORDER BY "UpVotes" DESC NULLS LAST
0.375
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients whose admission location is trsf within this facility and drug code is foli 1.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admission_location = "TRSF WITHIN THIS FACILITY" AND prescriptions.formulary_drug_cd = "FOLI1"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "FOLI1" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "TRSF WITHIN THIS FACILITY" = "demographic"."admission_location"
0.258789
CREATE TABLE table_name_12 (city___state VARCHAR, winner VARCHAR, circuit VARCHAR)
In what City/State did John Bowe win at Phillip Island Grand Prix Circuit?
SELECT city___state FROM table_name_12 WHERE winner = "john bowe" AND circuit = "phillip island grand prix circuit"
SELECT "city___state" FROM "table_name_12" WHERE "circuit" = "phillip island grand prix circuit" AND "john bowe" = "winner"
0.120117
CREATE TABLE table_name_30 (kickoff VARCHAR, date VARCHAR)
What is the kickoff for the game on october 22, 2000?
SELECT kickoff FROM table_name_30 WHERE date = "october 22, 2000"
SELECT "kickoff" FROM "table_name_30" WHERE "date" = "october 22, 2000"
0.069336
CREATE TABLE table_2798 ("Club" TEXT, "Location" TEXT, "Manager" TEXT, "Stadium" TEXT, "Capacity" FLOAT, "Team captain" TEXT)
Who's captain of the team whose stadium has a capacity of 17800 people?
SELECT "Team captain" FROM table_2798 WHERE "Capacity" = '17800'
SELECT "Team captain" FROM "table_2798" WHERE "Capacity" = '17800'
0.064453
CREATE TABLE table_65274 ("Position" TEXT, "Name" TEXT, "Year at CU" TEXT, "Experience" FLOAT, "Alma Mater" TEXT)
What person has the alma mater of Eastern Nazarene ('74), and greater than 19 experience?
SELECT "Name" FROM table_65274 WHERE "Experience" > '19' AND "Alma Mater" = 'eastern nazarene (''74)'
SELECT "Name" FROM "table_65274" WHERE "Alma Mater" = 'eastern nazarene (\'74)' AND "Experience" > '19'
0.100586
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
when was the last time that patient 006-80884 had the foley cath output since 876 days ago?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-80884')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'foley cath' AND DATETIME(intakeoutput.intakeoutputtime) >= DATETIME(CURRENT_TIME(), '-876 day') ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-80884' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "intakeoutput"."intakeoutputtime" FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'foley cath' AND "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime") >= DATETIME(CURRENT_TIME(), '-876 day') AND NOT "_u_1"."" IS NULL ORDER BY "intakeoutput"."intakeoutputtime" DESC NULLS LAST LIMIT 1
0.751953
CREATE TABLE table_train_132 ("id" INT, "loss_of_consciousness" BOOLEAN, "deep_venous_thrombosis" BOOLEAN, "unstable_angina" BOOLEAN, "thromboembolic_vascular_disease" BOOLEAN, "head_injury" BOOLEAN, "stroke" BOOLEAN, "cerebrovascular_disease" BOOLEAN, "mental_retardation" BOOLEAN, "psychiatric_disease" BOOLEAN, "modified_hachinski_ischemia_scale" INT, "systemic_illness" BOOLEAN, "mental_illness" BOOLEAN, "hydrocephalus" BOOLEAN, "mri" BOOLEAN, "psychotic_disorder" BOOLEAN, "pulmonary_embolus" BOOLEAN, "arrythmias" BOOLEAN, "lacunar_infarcts" BOOLEAN, "bipolar_disorder" BOOLEAN, "cva" BOOLEAN, "cardiac_disease" BOOLEAN, "brain_damage" BOOLEAN, "neurological_disease" BOOLEAN, "seizure_disorder" BOOLEAN, "vascular_dementia" BOOLEAN, "organ_failure" BOOLEAN, "parkinson_disease" BOOLEAN, "lewy_body_disease" BOOLEAN, "hypertension" BOOLEAN, "NOUSE" FLOAT)
subjects with evidence of other psychiatric / neurologic disorders including, but not limited to, stroke, vascular dementia, lewy _ body disease, parkinson's disease, seizure disorder, head injury with loss of consciousness within the past 5 years, any psychotic disorder, or bipolar disorder
SELECT * FROM table_train_132 WHERE psychiatric_disease = 1 OR neurological_disease = 1 OR (stroke = 1 OR vascular_dementia = 1 OR lewy_body_disease = 1 OR parkinson_disease = 1 OR seizure_disorder = 1 OR head_injury = 1 OR loss_of_consciousness = 1 OR psychotic_disorder = 1 OR bipolar_disorder = 1)
SELECT * FROM "table_train_132" WHERE "bipolar_disorder" = 1 OR "head_injury" = 1 OR "lewy_body_disease" = 1 OR "loss_of_consciousness" = 1 OR "neurological_disease" = 1 OR "parkinson_disease" = 1 OR "psychiatric_disease" = 1 OR "psychotic_disorder" = 1 OR "seizure_disorder" = 1 OR "stroke" = 1 OR "vascular_dementia" = 1
0.314453
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
Attempt at getting dupe/original combinations.
SELECT RelatedPostId AS "Original", q.Id AS "Dupe" FROM PostLinks JOIN Posts AS q ON q.Id = RelatedPostId WHERE LinkTypeId = 3
SELECT "RelatedPostId" AS "Original", "q"."Id" AS "Dupe" FROM "PostLinks" JOIN "Posts" AS "q" ON "RelatedPostId" = "q"."Id" WHERE "LinkTypeId" = 3
0.142578
CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT)
Give me the comparison about the sum of meter_100 over the Nationality , and group by attribute Nationality, I want to display from high to low by the y-axis.
SELECT Nationality, SUM(meter_100) FROM swimmer GROUP BY Nationality ORDER BY SUM(meter_100) DESC
SELECT "Nationality", SUM("meter_100") FROM "swimmer" GROUP BY "Nationality" ORDER BY SUM("meter_100") DESC NULLS LAST
0.115234
CREATE TABLE table_14370 ("Name" TEXT, "Years" TEXT, "Gender" TEXT, "Area" TEXT, "Authority" TEXT, "Decile" FLOAT)
What years are listed for the Tahunanui school with an authority of state?
SELECT "Years" FROM table_14370 WHERE "Authority" = 'state' AND "Name" = 'tahunanui school'
SELECT "Years" FROM "table_14370" WHERE "Authority" = 'state' AND "Name" = 'tahunanui school'
0.09082
CREATE TABLE table_13521 ("Pick" FLOAT, "Player" TEXT, "Team" TEXT, "Position" TEXT, "Hometown/School" TEXT)
Which Hometown/School has a Team of atlanta braves?
SELECT "Hometown/School" FROM table_13521 WHERE "Team" = 'atlanta braves'
SELECT "Hometown/School" FROM "table_13521" WHERE "Team" = 'atlanta braves'
0.073242
CREATE TABLE table_51860 ("Name" TEXT, "Country" TEXT, "Status" TEXT, "Moving to" TEXT, "Transfer window" TEXT, "Transfer fee" TEXT)
Name the status for belletti
SELECT "Status" FROM table_51860 WHERE "Name" = 'belletti'
SELECT "Status" FROM "table_51860" WHERE "Name" = 'belletti'
0.058594
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
count the number of patients whose procedure icd9 code is 3799 and drug type is additive?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE procedures.icd9_code = "3799" AND prescriptions.drug_type = "ADDITIVE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "ADDITIVE" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" JOIN "procedures" ON "3799" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.290039
CREATE TABLE Track (TrackId INT, Name VARCHAR, AlbumId INT, MediaTypeId INT, GenreId INT, Composer VARCHAR, Milliseconds INT, Bytes INT, UnitPrice DECIMAL) CREATE TABLE MediaType (MediaTypeId INT, Name VARCHAR) CREATE TABLE Customer (CustomerId INT, FirstName VARCHAR, LastName VARCHAR, Company VARCHAR, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR, SupportRepId INT) CREATE TABLE Playlist (PlaylistId INT, Name VARCHAR) CREATE TABLE Genre (GenreId INT, Name VARCHAR) CREATE TABLE PlaylistTrack (PlaylistId INT, TrackId INT) CREATE TABLE InvoiceLine (InvoiceLineId INT, InvoiceId INT, TrackId INT, UnitPrice DECIMAL, Quantity INT) CREATE TABLE Employee (EmployeeId INT, LastName VARCHAR, FirstName VARCHAR, Title VARCHAR, ReportsTo INT, BirthDate DATETIME, HireDate DATETIME, Address VARCHAR, City VARCHAR, State VARCHAR, Country VARCHAR, PostalCode VARCHAR, Phone VARCHAR, Fax VARCHAR, Email VARCHAR) CREATE TABLE Invoice (InvoiceId INT, CustomerId INT, InvoiceDate DATETIME, BillingAddress VARCHAR, BillingCity VARCHAR, BillingState VARCHAR, BillingCountry VARCHAR, BillingPostalCode VARCHAR, Total DECIMAL) CREATE TABLE Artist (ArtistId INT, Name VARCHAR) CREATE TABLE Album (AlbumId INT, Title VARCHAR, ArtistId INT)
A bar chart for what are the number of the invoice dates for customers with the first name Astrid and the last name Gruber?, rank from low to high 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)
SELECT "InvoiceDate", COUNT("InvoiceDate") FROM "Customer" AS "T1" JOIN "Invoice" AS "T2" ON "T1"."CustomerId" = "T2"."CustomerId" WHERE "Astrid" = "T1"."FirstName" AND "Gruber" = "LastName" ORDER BY COUNT("InvoiceDate") NULLS FIRST
0.226563
CREATE TABLE table_name_10 (safari VARCHAR, firefox VARCHAR)
What was the percentage of safari when firefox was 24.66%
SELECT safari FROM table_name_10 WHERE firefox = "24.66%"
SELECT "safari" FROM "table_name_10" WHERE "24.66%" = "firefox"
0.061523
CREATE TABLE table_57218 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
When did an away team have a score of 12.9 (81)?
SELECT "Date" FROM table_57218 WHERE "Away team score" = '12.9 (81)'
SELECT "Date" FROM "table_57218" WHERE "Away team score" = '12.9 (81)'
0.068359
CREATE TABLE table_203_190 (id DECIMAL, "name" TEXT, "type" TEXT, "circle" TEXT, "bench" TEXT, "formed" DECIMAL, "notes" TEXT)
what is the total number of states formed between 1000 and 1200 ?
SELECT COUNT("name") FROM table_203_190 WHERE "formed" >= 1000 AND "formed" <= 1200
SELECT COUNT("name") FROM "table_203_190" WHERE "formed" <= 1200 AND "formed" >= 1000
0.083008
CREATE TABLE table_21192 ("Months in Malayalam Era" TEXT, "In Malayalam" TEXT, "Gregorian Calendar" TEXT, "Tamil calendar" TEXT, "Saka era" TEXT, "Sign of Zodiac" TEXT)
Name the saka era for sign of zodiac being pisces
SELECT "Saka era" FROM table_21192 WHERE "Sign of Zodiac" = 'Pisces'
SELECT "Saka era" FROM "table_21192" WHERE "Sign of Zodiac" = 'Pisces'
0.068359
CREATE TABLE table_203_416 (id DECIMAL, "school name" TEXT, "city" TEXT, "grades" TEXT, "establishment" DECIMAL, "charter" TEXT)
what was the first public middle school established in hawaii ?
SELECT "school name" FROM table_203_416 ORDER BY "establishment" LIMIT 1
SELECT "school name" FROM "table_203_416" ORDER BY "establishment" NULLS FIRST LIMIT 1
0.083984
CREATE TABLE table_name_98 (animal_name VARCHAR, tv_series VARCHAR, species VARCHAR)
What animal was yes for tv series and was a terrapins?
SELECT animal_name FROM table_name_98 WHERE tv_series = "yes" AND species = "terrapins"
SELECT "animal_name" FROM "table_name_98" WHERE "species" = "terrapins" AND "tv_series" = "yes"
0.092773
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
what's patient 18159's insurance name in their first hospital encounter?
SELECT admissions.insurance FROM admissions WHERE admissions.subject_id = 18159 AND NOT admissions.dischtime IS NULL ORDER BY admissions.admittime LIMIT 1
SELECT "admissions"."insurance" FROM "admissions" WHERE "admissions"."subject_id" = 18159 AND NOT "admissions"."dischtime" IS NULL ORDER BY "admissions"."admittime" NULLS FIRST LIMIT 1
0.179688
CREATE TABLE table_name_58 (crowd INT, away_team VARCHAR)
Which match where Hawthorn was the away team had the largest crowd?
SELECT MAX(crowd) FROM table_name_58 WHERE away_team = "hawthorn"
SELECT MAX("crowd") FROM "table_name_58" WHERE "away_team" = "hawthorn"
0.069336
CREATE TABLE table_24938621_3 (production_code VARCHAR, directed_by VARCHAR)
What was the title of the episode directed by Jesse Warn?
SELECT production_code FROM table_24938621_3 WHERE directed_by = "Jesse Warn"
SELECT "production_code" FROM "table_24938621_3" WHERE "Jesse Warn" = "directed_by"
0.081055
CREATE TABLE table_19084 ("Code" FLOAT, "County" TEXT, "Former Province" TEXT, "Area ( km 2 ) " TEXT, "Population Census 2009" FLOAT, "Capital" TEXT)
what's the capital with area (km 2 ) being 12,245.9
SELECT "Capital" FROM table_19084 WHERE "Area (km 2 )" = '12,245.9'
SELECT "Capital" FROM "table_19084" WHERE "Area (km 2 )" = '12,245.9'
0.067383
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
has patient 26612 been prescribed a drug until 2104?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 26612) AND STRFTIME('%y', prescriptions.startdate) <= '2104'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 26612 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "prescriptions"."startdate") <= '2104'
0.310547
CREATE TABLE table_name_94 (to_par VARCHAR, score VARCHAR)
When the score was 71-71-70-70=282 what was the To par recorded?
SELECT to_par FROM table_name_94 WHERE score = 71 - 71 - 70 - 70 = 282
SELECT "to_par" FROM "table_name_94" WHERE "score" = FALSE
0.056641
CREATE TABLE table_41580 ("Name" TEXT, "Japanese" TEXT, "Date of designation" TEXT, "Date of reclassification" TEXT, "Region" TEXT, "Prefecture" TEXT)
Which Date of designation has a Name of kurume?
SELECT "Date of designation" FROM table_41580 WHERE "Name" = 'kurume'
SELECT "Date of designation" FROM "table_41580" WHERE "Name" = 'kurume'
0.069336
CREATE TABLE table_54778 ("NGC number" FLOAT, "Object type" TEXT, "Constellation" TEXT, "Right ascension ( J2000 ) " TEXT, "Declination ( J2000 ) " TEXT, "Apparent magnitude" FLOAT)
What is the highest NGC number that has a Declination ( J2000 ) of 04 58 and a Apparent magnitude larger than 7.3?
SELECT MAX("NGC number") FROM table_54778 WHERE "Declination ( J2000 )" = '°04′58″' AND "Apparent magnitude" > '7.3'
SELECT MAX("NGC number") FROM "table_54778" WHERE "Apparent magnitude" > '7.3' AND "Declination ( J2000 )" = '°04′58″'
0.115234
CREATE TABLE table_name_17 (date VARCHAR, score VARCHAR)
On what day was the game that ended in a score of 97-38?
SELECT date FROM table_name_17 WHERE score = "97-38"
SELECT "date" FROM "table_name_17" WHERE "97-38" = "score"
0.056641
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is subject name and religion of subject id 2560?
SELECT demographic.name, demographic.religion FROM demographic WHERE demographic.subject_id = "2560"
SELECT "demographic"."name", "demographic"."religion" FROM "demographic" WHERE "2560" = "demographic"."subject_id"
0.111328
CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT)
what types of aircraft does DL fly
SELECT DISTINCT aircraft.aircraft_code FROM aircraft, equipment_sequence, flight WHERE equipment_sequence.aircraft_code = aircraft.aircraft_code AND flight.aircraft_code_sequence = equipment_sequence.aircraft_code_sequence AND flight.airline_code = 'DL'
SELECT DISTINCT "aircraft"."aircraft_code" FROM "aircraft" JOIN "equipment_sequence" ON "aircraft"."aircraft_code" = "equipment_sequence"."aircraft_code" JOIN "flight" ON "equipment_sequence"."aircraft_code_sequence" = "flight"."aircraft_code_sequence" AND "flight"."airline_code" = 'DL'
0.280273
CREATE TABLE table_name_77 (crowd INT, away_team VARCHAR)
What was the attendance when North Melbourne was the away team?
SELECT AVG(crowd) FROM table_name_77 WHERE away_team = "north melbourne"
SELECT AVG("crowd") FROM "table_name_77" WHERE "away_team" = "north melbourne"
0.076172
CREATE TABLE table_name_1 (score VARCHAR, team VARCHAR)
What is the Score with a Team that is @ portland?
SELECT score FROM table_name_1 WHERE team = "@ portland"
SELECT "score" FROM "table_name_1" WHERE "@ portland" = "team"
0.060547
CREATE TABLE table_test_17 ("id" INT, "anemia" BOOLEAN, "left_ventricular_ejection_fraction_lvef" INT, "systolic_blood_pressure_sbp" INT, "active_infection" BOOLEAN, "fever" BOOLEAN, "bradycardia" INT, "renal_disease" BOOLEAN, "oliguria" BOOLEAN, "creatinine_clearance_cl" FLOAT, "left_ventricular_failure" BOOLEAN, "hgb" INT, "platelet_count" FLOAT, "oxygen_saturation" INT, "thrombocytopenia" FLOAT, "heart_rate" INT, "serum_creatinine" FLOAT, "diuresis" INT, "catecholamine_support" BOOLEAN, "NOUSE" FLOAT)
renal impairment defined by a serum creatinine > 200 umol / ml
SELECT * FROM table_test_17 WHERE renal_disease = 1 OR serum_creatinine > 200
SELECT * FROM "table_test_17" WHERE "renal_disease" = 1 OR "serum_creatinine" > 200
0.081055
CREATE TABLE domain_keyword (did INT, kid INT) CREATE TABLE cite (cited INT, citing INT) CREATE TABLE publication (abstract VARCHAR, cid INT, citation_num INT, jid INT, pid INT, reference_num INT, title VARCHAR, year INT) CREATE TABLE domain (did INT, name VARCHAR) CREATE TABLE writes (aid INT, pid INT) CREATE TABLE author (aid INT, homepage VARCHAR, name VARCHAR, oid INT) CREATE TABLE organization (continent VARCHAR, homepage VARCHAR, name VARCHAR, oid INT) CREATE TABLE domain_author (aid INT, did INT) CREATE TABLE domain_journal (did INT, jid INT) CREATE TABLE domain_conference (cid INT, did INT) CREATE TABLE publication_keyword (kid INT, pid INT) CREATE TABLE conference (cid INT, homepage VARCHAR, name VARCHAR) CREATE TABLE journal (homepage VARCHAR, jid INT, name VARCHAR) CREATE TABLE domain_publication (did INT, pid INT) CREATE TABLE keyword (keyword VARCHAR, kid INT)
return me the authors who have cooperated with ' H. V. Jagadish ' .
SELECT AUTHOR_0.name FROM author AS AUTHOR_0, author AS AUTHOR_1, publication, writes AS WRITES_0, writes AS WRITES_1 WHERE AUTHOR_1.name = 'H. V. Jagadish' AND WRITES_0.aid = AUTHOR_0.aid AND WRITES_0.pid = publication.pid AND WRITES_1.aid = AUTHOR_1.aid AND WRITES_1.pid = publication.pid
SELECT "AUTHOR_0"."name" FROM "author" AS "AUTHOR_0" JOIN "writes" AS "WRITES_0" ON "AUTHOR_0"."aid" = "WRITES_0"."aid" JOIN "publication" ON "WRITES_0"."pid" = "publication"."pid" JOIN "writes" AS "WRITES_1" ON "WRITES_1"."pid" = "publication"."pid" JOIN "author" AS "AUTHOR_1" ON "AUTHOR_1"."aid" = "WRITES_1"."aid" AND "AUTHOR_1"."name" = 'H. V. Jagadish'
0.349609
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
provide the number of patients whose procedure icd9 code is 4439?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.icd9_code = "4439"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "4439" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.171875
CREATE TABLE table_42431 ("Season" TEXT, "Tier" FLOAT, "League" TEXT, "Postseason" TEXT, "European competitions" TEXT)
What is the European competition when the tier is more than 2?
SELECT "European competitions" FROM table_42431 WHERE "Tier" > '2'
SELECT "European competitions" FROM "table_42431" WHERE "Tier" > '2'
0.066406
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
count the number of patients whose primary disease is chest pain and procedure short title is endosc inser stent bile?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.diagnosis = "CHEST PAIN" AND procedures.short_title = "Endosc inser stent bile"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Endosc inser stent bile" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "CHEST PAIN" = "demographic"."diagnosis"
0.238281
CREATE TABLE table_name_45 (opponent VARCHAR, round VARCHAR, record VARCHAR)
Who was the opponent with a record of 14-4-1 and has a round of 1?
SELECT opponent FROM table_name_45 WHERE round = "1" AND record = "14-4-1"
SELECT "opponent" FROM "table_name_45" WHERE "1" = "round" AND "14-4-1" = "record"
0.080078
CREATE TABLE table_name_77 (white__both_hispanic_and_non_hispanic_ VARCHAR, black__both_hispanic_and_non_hispanic_ VARCHAR, hispanic__of_any_race_ VARCHAR)
What is the total number of white (Hispanic/Non-Hispanic) having a black (Hispanic/Non-Hispanic) of 9.9 and Hispanic under 99.5?
SELECT COUNT(white__both_hispanic_and_non_hispanic_) FROM table_name_77 WHERE black__both_hispanic_and_non_hispanic_ = 9.9 AND hispanic__of_any_race_ < 99.5
SELECT COUNT("white__both_hispanic_and_non_hispanic_") FROM "table_name_77" WHERE "black__both_hispanic_and_non_hispanic_" = 9.9 AND "hispanic__of_any_race_" < 99.5
0.160156
CREATE TABLE table_30907 ("Episode" FLOAT, "Title" TEXT, "Writer" TEXT, "Director" TEXT, "Original airdate" TEXT, "Ratings ( Kanto ) " TEXT)
What episode did tomoyuki furumaya
SELECT "Title" FROM table_30907 WHERE "Director" = 'Tomoyuki Furumaya'
SELECT "Title" FROM "table_30907" WHERE "Director" = 'Tomoyuki Furumaya'
0.070313
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
had ever been the heart rate of patient 5828 been ever greater than 77.0 since 11/02/2105?
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5828)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum > 77.0 AND STRFTIME('%y-%m-%d', chartevents.charttime) >= '2105-11-02'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 5828 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'heart rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE "chartevents"."valuenum" > 77.0 AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "chartevents"."charttime") >= '2105-11-02'
0.758789
CREATE TABLE table_name_71 (producer VARCHAR, production_cost VARCHAR)
What is the name of the producer that produced a film with a production cost of $1,000,000?
SELECT producer FROM table_name_71 WHERE production_cost = "$1,000,000"
SELECT "producer" FROM "table_name_71" WHERE "$1,000,000" = "production_cost"
0.075195
CREATE TABLE table_10727 ("Player" TEXT, "Position" TEXT, "School" TEXT, "Hometown" TEXT, "College" TEXT)
What's the hometown of thomas tyner?
SELECT "Hometown" FROM table_10727 WHERE "Player" = 'thomas tyner'
SELECT "Hometown" FROM "table_10727" WHERE "Player" = 'thomas tyner'
0.066406
CREATE TABLE table_name_27 (time VARCHAR, opponent VARCHAR)
What is the time when the opponent is stephanie palmer?
SELECT time FROM table_name_27 WHERE opponent = "stephanie palmer"
SELECT "time" FROM "table_name_27" WHERE "opponent" = "stephanie palmer"
0.070313
CREATE TABLE table_17288845_9 (high_assists VARCHAR, team VARCHAR)
Name the high assists for houston
SELECT high_assists FROM table_17288845_9 WHERE team = "Houston"
SELECT "high_assists" FROM "table_17288845_9" WHERE "Houston" = "team"
0.068359
CREATE TABLE table_62419 ("Pick #" FLOAT, "Player" TEXT, "Nationality" TEXT, "Position" TEXT, "Team from" TEXT, "League from" TEXT)
Which Pick # has a Nationality of canada, and a Team from of sudbury wolves?
SELECT MIN("Pick #") FROM table_62419 WHERE "Nationality" = 'canada' AND "Team from" = 'sudbury wolves'
SELECT MIN("Pick #") FROM "table_62419" WHERE "Nationality" = 'canada' AND "Team from" = 'sudbury wolves'
0.102539
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
calculate the minimum days for which patients with rash primary disease were hospitalized.
SELECT MIN(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "RASH"
SELECT MIN("demographic"."days_stay") FROM "demographic" WHERE "RASH" = "demographic"."diagnosis"
0.094727
CREATE TABLE Room (RoomNumber INT, RoomType VARCHAR, BlockFloor INT, BlockCode INT, Unavailable BOOLEAN) CREATE TABLE Affiliated_With (Physician INT, Department INT, PrimaryAffiliation BOOLEAN) CREATE TABLE Appointment (AppointmentID INT, Patient INT, PrepNurse INT, Physician INT, Start DATETIME, End DATETIME, ExaminationRoom TEXT) CREATE TABLE Department (DepartmentID INT, Name VARCHAR, Head INT) CREATE TABLE On_Call (Nurse INT, BlockFloor INT, BlockCode INT, OnCallStart DATETIME, OnCallEnd DATETIME) CREATE TABLE Stay (StayID INT, Patient INT, Room INT, StayStart DATETIME, StayEnd DATETIME) CREATE TABLE Physician (EmployeeID INT, Name VARCHAR, Position VARCHAR, SSN INT) CREATE TABLE Procedures (Code INT, Name VARCHAR, Cost FLOAT) CREATE TABLE Trained_In (Physician INT, Treatment INT, CertificationDate DATETIME, CertificationExpires DATETIME) CREATE TABLE Patient (SSN INT, Name VARCHAR, Address VARCHAR, Phone VARCHAR, InsuranceID INT, PCP INT) CREATE TABLE Undergoes (Patient INT, Procedures INT, Stay INT, DateUndergoes DATETIME, Physician INT, AssistingNurse INT) CREATE TABLE Block (BlockFloor INT, BlockCode INT) CREATE TABLE Prescribes (Physician INT, Patient INT, Medication INT, Date DATETIME, Appointment INT, Dose VARCHAR) CREATE TABLE Medication (Code INT, Name VARCHAR, Brand VARCHAR, Description VARCHAR) CREATE TABLE Nurse (EmployeeID INT, Name VARCHAR, Position VARCHAR, Registered BOOLEAN, SSN INT)
List the physicians' employee ids together with their primary affiliation departments' ids. Plot them as scatter chart.
SELECT Physician, Department FROM Affiliated_With WHERE PrimaryAffiliation = 1
SELECT "Physician", "Department" FROM "Affiliated_With" WHERE "PrimaryAffiliation" = 1
0.083984
CREATE TABLE table_35246 ("Distance" TEXT, "Event" TEXT, "Record" TEXT, "Nationality" TEXT, "Year" FLOAT, "Location" TEXT)
Which nationality's distance was 500m before 2012, when the record was 1:37.071s?
SELECT "Nationality" FROM table_35246 WHERE "Distance" = '500m' AND "Year" < '2012' AND "Record" = '1:37.071s'
SELECT "Nationality" FROM "table_35246" WHERE "Distance" = '500m' AND "Record" = '1:37.071s' AND "Year" < '2012'
0.109375
CREATE TABLE table_25519358_1 (vertical_0_b VARCHAR, name VARCHAR)
Name the vertical for bian
SELECT vertical_0_b FROM table_25519358_1 WHERE name = "边 BIAN"
SELECT "vertical_0_b" FROM "table_25519358_1" WHERE "name" = "边 BIAN"
0.067383
CREATE TABLE Nurse (EmployeeID INT, Name VARCHAR, Position VARCHAR, Registered BOOLEAN, SSN INT) CREATE TABLE Prescribes (Physician INT, Patient INT, Medication INT, Date DATETIME, Appointment INT, Dose VARCHAR) CREATE TABLE On_Call (Nurse INT, BlockFloor INT, BlockCode INT, OnCallStart DATETIME, OnCallEnd DATETIME) CREATE TABLE Appointment (AppointmentID INT, Patient INT, PrepNurse INT, Physician INT, Start DATETIME, End DATETIME, ExaminationRoom TEXT) CREATE TABLE Medication (Code INT, Name VARCHAR, Brand VARCHAR, Description VARCHAR) CREATE TABLE Procedures (Code INT, Name VARCHAR, Cost FLOAT) CREATE TABLE Trained_In (Physician INT, Treatment INT, CertificationDate DATETIME, CertificationExpires DATETIME) CREATE TABLE Department (DepartmentID INT, Name VARCHAR, Head INT) CREATE TABLE Patient (SSN INT, Name VARCHAR, Address VARCHAR, Phone VARCHAR, InsuranceID INT, PCP INT) CREATE TABLE Stay (StayID INT, Patient INT, Room INT, StayStart DATETIME, StayEnd DATETIME) CREATE TABLE Block (BlockFloor INT, BlockCode INT) CREATE TABLE Affiliated_With (Physician INT, Department INT, PrimaryAffiliation BOOLEAN) CREATE TABLE Undergoes (Patient INT, Procedures INT, Stay INT, DateUndergoes DATETIME, Physician INT, AssistingNurse INT) CREATE TABLE Physician (EmployeeID INT, Name VARCHAR, Position VARCHAR, SSN INT) CREATE TABLE Room (RoomNumber INT, RoomType VARCHAR, BlockFloor INT, BlockCode INT, Unavailable BOOLEAN)
List the names of patients who have made appointments, and count them by a bar chart, display names from low to high order.
SELECT Name, COUNT(Name) FROM Appointment AS T1 JOIN Patient AS T2 ON T1.Patient = T2.SSN GROUP BY Name ORDER BY Name
SELECT "Name", COUNT("Name") FROM "Appointment" AS "T1" JOIN "Patient" AS "T2" ON "T1"."Patient" = "T2"."SSN" GROUP BY "Name" ORDER BY "Name" NULLS FIRST
0.149414
CREATE TABLE table_name_74 (grid VARCHAR, time_retired VARCHAR)
What grad has a Time/Retired of + 1:24.3?
SELECT grid FROM table_name_74 WHERE time_retired = "+ 1:24.3"
SELECT "grid" FROM "table_name_74" WHERE "+ 1:24.3" = "time_retired"
0.066406
CREATE TABLE table_6192 ("Date" TEXT, "Opponent" TEXT, "Venue" TEXT, "Result" TEXT, "Attendance" TEXT)
When Venue of A has Attendance of 4,365?
SELECT "Date" FROM table_6192 WHERE "Venue" = 'a' AND "Attendance" = '4,365'
SELECT "Date" FROM "table_6192" WHERE "Attendance" = '4,365' AND "Venue" = 'a'
0.076172
CREATE TABLE table_16996 ("Marginal Ordinary Income Tax Rate" TEXT, "Single" TEXT, "Married Filing Jointly or Qualified Widow ( er ) " TEXT, "Married Filing Separately" TEXT, "Head of Household" TEXT)
What is the amoun of marginal ordinary income tax rate where married filing jointly or qualified widow is $208,851 $372,950?
SELECT COUNT("Marginal Ordinary Income Tax Rate") FROM table_16996 WHERE "Married Filing Jointly or Qualified Widow(er)" = '$208,851–$372,950'
SELECT COUNT("Marginal Ordinary Income Tax Rate") FROM "table_16996" WHERE "Married Filing Jointly or Qualified Widow(er)" = '$208,851–$372,950'
0.140625
CREATE TABLE table_47759 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
What is the Date of Week 9?
SELECT "Date" FROM table_47759 WHERE "Week" = '9'
SELECT "Date" FROM "table_47759" WHERE "Week" = '9'
0.049805
CREATE TABLE table_73638 ("Episode number Production number" TEXT, "Title" TEXT, "Original airdate" TEXT, "Rating/Share in Households" TEXT, "18\\u201349 Rating Live+SD / Live+7" TEXT, "Share" TEXT, "Live+SD Total viewers" TEXT, "Live+7 Day DVR Total viewers" TEXT)
When did the episode that had 3.69 million total viewers (Live and SD types combined) first air?
SELECT "Original airdate" FROM table_73638 WHERE "Live+SD Total viewers" = '3.69 million'
SELECT "Original airdate" FROM "table_73638" WHERE "Live+SD Total viewers" = '3.69 million'
0.088867
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
which patients have lab test item id 51251?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.itemid = "51251"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51251" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.149414
CREATE TABLE debate_people (Debate_ID INT, Affirmative INT, Negative INT, If_Affirmative_Win BOOLEAN) CREATE TABLE people (People_ID INT, District TEXT, Name TEXT, Party TEXT, Age INT) CREATE TABLE debate (Debate_ID INT, Date TEXT, Venue TEXT, Num_of_Audience INT)
Compute the total the total number across party as a pie chart.
SELECT Party, COUNT(*) FROM people GROUP BY Party
SELECT "Party", COUNT(*) FROM "people" GROUP BY "Party"
0.053711
CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT)
when can i fly from PHILADELPHIA to DALLAS on a SATURDAY morning
SELECT DISTINCT flight.departure_time FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, days, flight WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'DALLAS' AND days.day_name = 'SATURDAY' AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.departure_time BETWEEN 0 AND 1200
SELECT DISTINCT "flight"."departure_time" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHILADELPHIA' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."departure_time" <= 1200 AND "flight"."departure_time" >= 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "days" ON "days"."day_name" = 'SATURDAY' AND "days"."days_code" = "flight"."flight_days" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'DALLAS'
0.666016
CREATE TABLE table_name_78 (qual VARCHAR, rank VARCHAR)
Name the qual for rank of 9
SELECT qual FROM table_name_78 WHERE rank = "9"
SELECT "qual" FROM "table_name_78" WHERE "9" = "rank"
0.051758