schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_name_41 (first_title VARCHAR, wins VARCHAR, country VARCHAR)
Which First title has Wins smaller than 8 and in Canada?
SELECT COUNT(first_title) FROM table_name_41 WHERE wins < 8 AND country = "canada"
SELECT COUNT("first_title") FROM "table_name_41" WHERE "canada" = "country" AND "wins" < 8
0.087891
CREATE TABLE table_name_51 (pct INT, co_champions VARCHAR, state_champions VARCHAR, mrc_championships VARCHAR)
What is the average Pct value when state champions is less than 1, MRC Championships is 10, and co-champions are greater than 4?
SELECT AVG(pct) FROM table_name_51 WHERE state_champions < 1 AND mrc_championships = 10 AND co_champions > 4
SELECT AVG("pct") FROM "table_name_51" WHERE "co_champions" > 4 AND "mrc_championships" = 10 AND "state_champions" < 1
0.115234
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, visualize a bar chart about the distribution of founder and the amount of founder , and group by attribute founder, sort by the y-axis in desc.
SELECT Founder, COUNT(Founder) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Founder ORDER BY COUNT(Founder) DESC
SELECT "Founder", COUNT("Founder") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Founder" ORDER BY COUNT("Founder") DESC NULLS LAST
0.180664
CREATE TABLE table_13133 ("Player" TEXT, "Country" TEXT, "Year ( s ) won" TEXT, "Total" FLOAT, "To par" FLOAT, "Finish" TEXT)
How much Total has a Player of todd hamilton, and a To par smaller than 15?
SELECT COUNT("Total") FROM table_13133 WHERE "Player" = 'todd hamilton' AND "To par" < '15'
SELECT COUNT("Total") FROM "table_13133" WHERE "Player" = 'todd hamilton' AND "To par" < '15'
0.09082
CREATE TABLE table_name_9 (record VARCHAR, visitor VARCHAR)
What was the record when Vancouver was the visitor?
SELECT record FROM table_name_9 WHERE visitor = "vancouver"
SELECT "record" FROM "table_name_9" WHERE "vancouver" = "visitor"
0.063477
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
show me the number of patients with a diagnoses icd9 code of 4846 who were hospitalized for more than 15 days.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.days_stay > "15" AND diagnoses.icd9_code = "4846"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "4846" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "15" < "demographic"."days_stay"
0.207031
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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients stayed at hospital for more than 4 days?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.days_stay > "4"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "4" < "demographic"."days_stay"
0.103516
CREATE TABLE table_name_42 (group VARCHAR, team VARCHAR)
What is the Dolphins Group?
SELECT group FROM table_name_42 WHERE team = "dolphins"
SELECT "group" FROM "table_name_42" WHERE "dolphins" = "team"
0.05957
CREATE TABLE table_1342292_45 (result VARCHAR, incumbent VARCHAR)
In how many districts is the incumbent Dave E. Satterfield, Jr.
SELECT COUNT(result) FROM table_1342292_45 WHERE incumbent = "Dave E. Satterfield, Jr."
SELECT COUNT("result") FROM "table_1342292_45" WHERE "Dave E. Satterfield, Jr." = "incumbent"
0.09082
CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL)
For those employees who do not work in departments with managers that have ids between 100 and 200, a bar chart shows the distribution of phone_number and salary , order by the bars from low to high.
SELECT PHONE_NUMBER, SALARY FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY PHONE_NUMBER
SELECT "PHONE_NUMBER", "SALARY" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY "PHONE_NUMBER" NULLS FIRST
0.202148
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
how many patients were born before the year 2101 with the procedure short title gastroenterostomy nec?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2101" AND procedures.short_title = "Gastroenterostomy NEC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Gastroenterostomy NEC" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2101" > "demographic"."dob_year"
0.229492
CREATE TABLE table_76665 ("Round #" FLOAT, "Pick" FLOAT, "Player" TEXT, "Position" TEXT, "College" TEXT)
Which pick came from Texas El-Paso?
SELECT SUM("Pick") FROM table_76665 WHERE "College" = 'texas el-paso'
SELECT SUM("Pick") FROM "table_76665" WHERE "College" = 'texas el-paso'
0.069336
CREATE TABLE table_27914076_1 (coverage VARCHAR, branding VARCHAR)
Name the number of coverage for 106.7 energy fm
SELECT COUNT(coverage) FROM table_27914076_1 WHERE branding = "106.7 Energy FM"
SELECT COUNT("coverage") FROM "table_27914076_1" WHERE "106.7 Energy FM" = "branding"
0.083008
CREATE TABLE table_52698 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What team was the away team when the home team scored 9.10 (64)?
SELECT "Away team" FROM table_52698 WHERE "Home team score" = '9.10 (64)'
SELECT "Away team" FROM "table_52698" WHERE "Home team score" = '9.10 (64)'
0.073242
CREATE TABLE table_63689 ("Rank" FLOAT, "Lane" FLOAT, "Name" TEXT, "Nationality" TEXT, "React" FLOAT, "Time" FLOAT)
What is the total time of the athlete from Canada with a lane less than 8 and a rank less than 8?
SELECT COUNT("Time") FROM table_63689 WHERE "Lane" < '8' AND "Nationality" = 'canada' AND "Rank" < '8'
SELECT COUNT("Time") FROM "table_63689" WHERE "Lane" < '8' AND "Nationality" = 'canada' AND "Rank" < '8'
0.101563
CREATE TABLE table_23290 ("Draw" FLOAT, "Artist" TEXT, "Song" TEXT, "Jury votes" FLOAT, "Televotes" FLOAT, "Total votes" FLOAT, "Result" TEXT)
How many jury votes for the televote of 7?
SELECT "Jury votes" FROM table_23290 WHERE "Televotes" = '7'
SELECT "Jury votes" FROM "table_23290" WHERE "Televotes" = '7'
0.060547
CREATE TABLE table_47647 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Decision" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
What is Visitor, when Home is Philadelphia, and when Date is November 18?
SELECT "Visitor" FROM table_47647 WHERE "Home" = 'philadelphia' AND "Date" = 'november 18'
SELECT "Visitor" FROM "table_47647" WHERE "Date" = 'november 18' AND "Home" = 'philadelphia'
0.089844
CREATE TABLE table_name_48 (time INT, heat_rank VARCHAR, lane VARCHAR)
Tell me the highest time for heat rank of 8 and lane more than 2
SELECT MAX(time) FROM table_name_48 WHERE heat_rank = 8 AND lane > 2
SELECT MAX("time") FROM "table_name_48" WHERE "heat_rank" = 8 AND "lane" > 2
0.074219
CREATE TABLE table_name_61 (country VARCHAR, abbreviation VARCHAR)
Which country has an abbreviation of kia?
SELECT country FROM table_name_61 WHERE abbreviation = "kia"
SELECT "country" FROM "table_name_61" WHERE "abbreviation" = "kia"
0.064453
CREATE TABLE table_23464 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "Production code" FLOAT, "U.S. viewers ( millions ) " TEXT)
How many different series number does the episode titled 'Skate or Die' have?
SELECT COUNT("No. in series") FROM table_23464 WHERE "Title" = 'Skate or Die'
SELECT COUNT("No. in series") FROM "table_23464" WHERE "Title" = 'Skate or Die'
0.077148
CREATE TABLE table_name_17 (player VARCHAR, opponent VARCHAR)
What is Player, when Opponent is source: . last updated: 28 june 2007.?
SELECT player FROM table_name_17 WHERE opponent = "source: . last updated: 28 june 2007."
SELECT "player" FROM "table_name_17" WHERE "opponent" = "source: . last updated: 28 june 2007."
0.092773
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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
Number of posts vs. total bounty amount.
WITH bounties_cte AS (SELECT SUM(v.BountyAmount) AS bnt, p.Id AS pid, p.ViewCount AS vc FROM Posts AS p JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 8 GROUP BY p.Id, p.ViewCount) SELECT bnt AS "bounties_count", COUNT(pid) FROM bounties_cte GROUP BY bnt ORDER BY bnt
WITH "bounties_cte" AS (SELECT MAX(1) AS "_" FROM "Posts" AS "p" JOIN "Votes" AS "v" ON "p"."Id" = "v"."PostId" AND "v"."VoteTypeId" = 8 GROUP BY "p"."Id", "p"."ViewCount") SELECT "bnt" AS "bounties_count", COUNT("pid") FROM "bounties_cte" GROUP BY "bnt" ORDER BY "bnt" NULLS FIRST
0.274414
CREATE TABLE table_39718 ("Round" FLOAT, "Pick #" TEXT, "Player" TEXT, "Position" TEXT, "College" TEXT, "Tenure w/ Steelers" TEXT)
What round pick was pick number 101 who plays defensive back?
SELECT "Round" FROM table_39718 WHERE "Position" = 'defensive back' AND "Pick #" = '101'
SELECT "Round" FROM "table_39718" WHERE "Pick #" = '101' AND "Position" = 'defensive back'
0.087891
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE 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 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)
Answers: Zero-score accepted - Tag parameter.
SELECT a.Id AS "post_link", q.Tags FROM Posts AS q, Posts AS a WHERE a.Score = 0 AND q.AcceptedAnswerId = a.Id AND q.Tags LIKE LOWER('%##Tag##%') ORDER BY q.Id LIMIT 100
SELECT "a"."Id" AS "post_link", "q"."Tags" FROM "Posts" AS "q" JOIN "Posts" AS "a" ON "a"."Id" = "q"."AcceptedAnswerId" AND "a"."Score" = 0 WHERE "q"."Tags" LIKE LOWER('%##Tag##%') ORDER BY "q"."Id" NULLS FIRST LIMIT 100
0.214844
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 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)
how many patients diagnosed with short title accid in resident instit have delta lab test abnormal status?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE diagnoses.short_title = "Accid in resident instit" AND lab.flag = "delta"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Accid in resident instit" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "delta" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.271484
CREATE TABLE table_76988 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " FLOAT)
What is the To par of the 4 Place Player?
SELECT "To par" FROM table_76988 WHERE "Place" = '4'
SELECT "To par" FROM "table_76988" WHERE "Place" = '4'
0.052734
CREATE TABLE table_63582 ("Location" TEXT, "Name of mill" TEXT, "Type" TEXT, "Built" TEXT, "Notes" TEXT)
What is the Location of the Mill Built in the Early 19th Century?
SELECT "Location" FROM table_63582 WHERE "Built" = 'early 19th century'
SELECT "Location" FROM "table_63582" WHERE "Built" = 'early 19th century'
0.071289
CREATE TABLE table_30054758_3 (record VARCHAR, date VARCHAR)
What is the record for december 3?
SELECT record FROM table_30054758_3 WHERE date = "December 3"
SELECT "record" FROM "table_30054758_3" WHERE "December 3" = "date"
0.06543
CREATE TABLE table_24522 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( millions ) " TEXT)
How many U.S. viewers watched the episode directed by Frank Waldeck?
SELECT "U.S. viewers (millions)" FROM table_24522 WHERE "Directed by" = 'Frank Waldeck'
SELECT "U.S. viewers (millions)" FROM "table_24522" WHERE "Directed by" = 'Frank Waldeck'
0.086914
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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)
in 04/this year, when was the first time patient 002-27661 was prescribed medication via sublingual route?
SELECT medication.drugstarttime FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-27661')) AND medication.routeadmin = 'sublingual' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', medication.drugstarttime) = '04' ORDER BY medication.drugstarttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-27661' 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 "medication"."drugstarttime" FROM "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE "medication"."routeadmin" = 'sublingual' AND DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "medication"."drugstarttime") = '04' ORDER BY "medication"."drugstarttime" NULLS FIRST LIMIT 1
0.769531
CREATE TABLE table_204_373 (id DECIMAL, "wager" TEXT, "winner" TEXT, "loser" TEXT, "location" TEXT, "date" TEXT)
first opponent to defeat mocho cota in mexico city
SELECT "winner" FROM table_204_373 WHERE "loser" = 'mocho cota' AND "location" = 'mexico city' ORDER BY "date" LIMIT 1
SELECT "winner" FROM "table_204_373" WHERE "location" = 'mexico city' AND "loser" = 'mocho cota' ORDER BY "date" NULLS FIRST LIMIT 1
0.128906
CREATE TABLE table_13082 ("Date ( dd.mm.yyyy ) " TEXT, "Soviet Unit" TEXT, "Aircraft flown" TEXT, "Enemy Aircraft" TEXT, "Axis Unit" TEXT)
What was the aircraft flown when the axis unit was luftwaffe (**) and the enemy aircraft was ju.88?
SELECT "Aircraft flown" FROM table_13082 WHERE "Axis Unit" = 'luftwaffe (**)' AND "Enemy Aircraft" = 'ju.88'
SELECT "Aircraft flown" FROM "table_13082" WHERE "Axis Unit" = 'luftwaffe (**)' AND "Enemy Aircraft" = 'ju.88'
0.107422
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what are the four most commonly performed procedures until 3 years ago?
SELECT t1.treatmentname FROM (SELECT treatment.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM treatment WHERE DATETIME(treatment.treatmenttime) <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY treatment.treatmentname) AS t1 WHERE t1.c1 <= 4
WITH "t1" AS (SELECT "treatment"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "treatment" WHERE DATETIME("treatment"."treatmenttime") <= DATETIME(CURRENT_TIME(), '-3 year') GROUP BY "treatment"."treatmentname") SELECT "t1"."treatmentname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4
0.308594
CREATE TABLE table_27987623_3 (timeslot VARCHAR, viewers__millions_ VARCHAR)
How many timeslots had viewers of 0.238 million?
SELECT COUNT(timeslot) FROM table_27987623_3 WHERE viewers__millions_ = "0.238"
SELECT COUNT("timeslot") FROM "table_27987623_3" WHERE "0.238" = "viewers__millions_"
0.083008
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
what is the number of patients whose admission type is urgent and procedure short title is open reduc-int fix femur?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Open reduc-int fix femur"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Open reduc-int fix femur" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.240234
CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT)
Are any upper elective courses offered for CS ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program_course WHERE program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%'
0.205078
CREATE TABLE table_8597 ("Club" TEXT, "Played" TEXT, "Drawn" TEXT, "Lost" TEXT, "Points for" TEXT, "Points against" TEXT, "Points difference" TEXT, "Points" TEXT)
When there were 554 points, what was the point difference?
SELECT "Points difference" FROM table_8597 WHERE "Points for" = '554'
SELECT "Points difference" FROM "table_8597" WHERE "Points for" = '554'
0.069336
CREATE TABLE table_14070062_3 (tries_for VARCHAR, club VARCHAR)
How many tries for does Pontardawe RFC have?
SELECT tries_for FROM table_14070062_3 WHERE club = "Pontardawe RFC"
SELECT "tries_for" FROM "table_14070062_3" WHERE "Pontardawe RFC" = "club"
0.072266
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
what were the five procedures most frequently given for patients who had previously been diagnosed with anuria - etiology unknown within 2 months last year?
SELECT t3.treatmentname FROM (SELECT t2.treatmentname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'anuria - etiology unknown' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, treatment.treatmentname, treatment.treatmenttime FROM treatment JOIN patient ON treatment.patientunitstayid = patient.patientunitstayid WHERE DATETIME(treatment.treatmenttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.treatmenttime AND DATETIME(t2.treatmenttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month') GROUP BY t2.treatmentname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "treatment"."treatmentname", "treatment"."treatmenttime" FROM "treatment" JOIN "patient" ON "patient"."patientunitstayid" = "treatment"."patientunitstayid" WHERE DATETIME("treatment"."treatmenttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."treatmentname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."treatmenttime" AND "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("diagnosis"."diagnosistime") <= DATETIME("t2"."treatmenttime") AND DATETIME("diagnosis"."diagnosistime", '+2 month') >= DATETIME("t2"."treatmenttime") WHERE "diagnosis"."diagnosisname" = 'anuria - etiology unknown' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."treatmentname") SELECT "t3"."treatmentname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5
1.047852
CREATE TABLE table_21888 ("Tie no" FLOAT, "Home team" TEXT, "Score 1" TEXT, "Away team" TEXT, "Attendance" FLOAT)
Who was the home team when Burnley were the away team?
SELECT "Home team" FROM table_21888 WHERE "Away team" = 'Burnley'
SELECT "Home team" FROM "table_21888" WHERE "Away team" = 'Burnley'
0.06543
CREATE TABLE table_37496 ("Date" FLOAT, "Tournament" TEXT, "Surface" TEXT, "Opponent in the final" TEXT, "Score" TEXT)
Which Date has a Score of 6 3, 7 6?
SELECT SUM("Date") FROM table_37496 WHERE "Score" = '6–3, 7–6'
SELECT SUM("Date") FROM "table_37496" WHERE "Score" = '6–3, 7–6'
0.0625
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Return a bar chart about the distribution of All_Home and the average of Team_ID , and group by attribute All_Home.
SELECT All_Home, AVG(Team_ID) FROM basketball_match GROUP BY All_Home
SELECT "All_Home", AVG("Team_ID") FROM "basketball_match" GROUP BY "All_Home"
0.075195
CREATE TABLE table_26131768_4 (representative VARCHAR, residence VARCHAR)
If the residence is Chagrin falls, who is the representative?
SELECT representative FROM table_26131768_4 WHERE residence = "Chagrin Falls"
SELECT "representative" FROM "table_26131768_4" WHERE "Chagrin Falls" = "residence"
0.081055
CREATE TABLE table_68710 ("Date" TEXT, "Visiting team" TEXT, "Final score" TEXT, "Host team" TEXT, "Stadium" TEXT)
What stadium did the Denver Broncos visit?
SELECT "Stadium" FROM table_68710 WHERE "Visiting team" = 'denver broncos'
SELECT "Stadium" FROM "table_68710" WHERE "Visiting team" = 'denver broncos'
0.074219
CREATE TABLE table_67124 ("Year" FLOAT, "Tournament" TEXT, "Round 1" FLOAT, "Round 2" FLOAT, "Round 3" FLOAT, "Round 4" FLOAT, "Score" FLOAT, "To par" TEXT, "Place" TEXT, "Money ( \\uffe5 ) " FLOAT)
What is the earliest year when the Dunlop Phoenix Tournament was played with a round 4 score larger than 72?
SELECT MIN("Year") FROM table_67124 WHERE "Tournament" = 'dunlop phoenix tournament' AND "Round 4" > '72'
SELECT MIN("Year") FROM "table_67124" WHERE "Round 4" > '72' AND "Tournament" = 'dunlop phoenix tournament'
0.104492
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
calculate the length of patient 035-20156's first stay in icu.
SELECT STRFTIME('%j', patient.unitdischargetime) - STRFTIME('%j', patient.unitadmittime) FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '035-20156') AND NOT patient.unitadmittime IS NULL ORDER BY patient.unitadmittime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '035-20156' GROUP BY "patienthealthsystemstayid") SELECT STRFTIME('%j', "patient"."unitdischargetime") - STRFTIME('%j', "patient"."unitadmittime") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitadmittime" IS NULL ORDER BY "patient"."unitadmittime" NULLS FIRST LIMIT 1
0.460938
CREATE TABLE table_name_95 (set_3 VARCHAR, total VARCHAR)
What is the set 3 when the total is 78 92?
SELECT set_3 FROM table_name_95 WHERE total = "78–92"
SELECT "set_3" FROM "table_name_95" WHERE "78–92" = "total"
0.057617
CREATE TABLE table_41364 ("Year" FLOAT, "Venue" TEXT, "Location" TEXT, "Winners" TEXT, "Runners-up" TEXT)
What is the average Year when Australia was the runner-up at victoria golf club?
SELECT AVG("Year") FROM table_41364 WHERE "Runners-up" = 'australia' AND "Venue" = 'victoria golf club'
SELECT AVG("Year") FROM "table_41364" WHERE "Runners-up" = 'australia' AND "Venue" = 'victoria golf club'
0.102539
CREATE TABLE table_18424435_3 (title VARCHAR, production_code VARCHAR)
Which episodes had production code 217?
SELECT title FROM table_18424435_3 WHERE production_code = 217
SELECT "title" FROM "table_18424435_3" WHERE "production_code" = 217
0.066406
CREATE TABLE table_203_622 (id DECIMAL, "date" TEXT, "team" TEXT, "name" TEXT, "position" TEXT, "years in nba" DECIMAL, "notes" TEXT)
what is the difference between the player with the most experience and the least amount of experience ?
SELECT MAX("years in nba") - MIN("years in nba") FROM table_203_622
SELECT MAX("years in nba") - MIN("years in nba") FROM "table_203_622"
0.067383
CREATE TABLE table_name_20 (laps INT, grid VARCHAR)
How many laps were completed in grid 18?
SELECT SUM(laps) FROM table_name_20 WHERE grid = 18
SELECT SUM("laps") FROM "table_name_20" WHERE "grid" = 18
0.055664
CREATE TABLE table_78191 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What score did the home team of north melbourne get?
SELECT "Home team score" FROM table_78191 WHERE "Home team" = 'north melbourne'
SELECT "Home team score" FROM "table_78191" WHERE "Home team" = 'north melbourne'
0.079102
CREATE TABLE table_name_21 (name VARCHAR, length__ft_ VARCHAR)
Who has a length of 71 ft?
SELECT name FROM table_name_21 WHERE length__ft_ = 71
SELECT "name" FROM "table_name_21" WHERE "length__ft_" = 71
0.057617
CREATE TABLE table_9851 ("Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Opponent in the final" TEXT, "Score" TEXT)
For what tournament was Bla Kav i the opponent in the final?
SELECT "Tournament" FROM table_9851 WHERE "Opponent in the final" = 'blaž kavčič'
SELECT "Tournament" FROM "table_9851" WHERE "Opponent in the final" = 'blaž kavčič'
0.081055
CREATE TABLE table_78913 ("Round" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "College/junior/club team ( league ) " TEXT)
Which College/junior/club team (league) was the player from Switzerland from?
SELECT "College/junior/club team (league)" FROM table_78913 WHERE "Nationality" = 'switzerland'
SELECT "College/junior/club team (league)" FROM "table_78913" WHERE "Nationality" = 'switzerland'
0.094727
CREATE TABLE table_31577 ("Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
Tell me the competition of 20 august 2008
SELECT "Competition" FROM table_31577 WHERE "Date" = '20 august 2008'
SELECT "Competition" FROM "table_31577" WHERE "Date" = '20 august 2008'
0.069336
CREATE TABLE table_204_805 (id DECIMAL, "name" TEXT, "club" TEXT, "date of departure" TEXT, "replacement" TEXT, "date of appointment" TEXT)
what is the number of managerial changes that ttm samut sakhon made in 2009 ?
SELECT COUNT(*) FROM table_204_805 WHERE "club" = 'ttm samut sakhon'
SELECT COUNT(*) FROM "table_204_805" WHERE "club" = 'ttm samut sakhon'
0.068359
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) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients taking main drug type prescription have the diagnoses of hemiplegia, unspecified, affecting dominant side?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.long_title = "Hemiplegia, unspecified, affecting dominant side" AND prescriptions.drug_type = "MAIN"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Hemiplegia, unspecified, affecting dominant side" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "MAIN" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.327148
CREATE TABLE table_47519 ("Season" FLOAT, "Premiered" TEXT, "Bachelorette" TEXT, "Profile" TEXT, "Winner" TEXT, "Runner ( s ) -Up" TEXT, "Proposal" TEXT)
Who is the bachelorette of the season that premiered on May 24, 2010?
SELECT "Bachelorette" FROM table_47519 WHERE "Premiered" = 'may 24, 2010'
SELECT "Bachelorette" FROM "table_47519" WHERE "Premiered" = 'may 24, 2010'
0.073242
CREATE TABLE table_204_867 (id DECIMAL, "number" DECIMAL, "date" TEXT, "name" TEXT, "age\ ( at execution ) " DECIMAL, "age\ ( at offense ) " DECIMAL, "race" TEXT, "state" TEXT, "method" TEXT)
who was the next consecutive woman to be executed after lynda lyon block ?
SELECT "name" FROM table_204_867 WHERE "number" = (SELECT "number" FROM table_204_867 WHERE "name" = 'lynda lyon block') + 1
SELECT "name" FROM "table_204_867" WHERE "number" = (SELECT "number" FROM "table_204_867" WHERE "name" = 'lynda lyon block') + 1
0.125
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 the number of private insurance patients who have had red blood cells lab tests?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.insurance = "Private" AND lab.label = "Red Blood Cells"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Red Blood Cells" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "Private" = "demographic"."insurance"
0.201172
CREATE TABLE table_40284 ("Pick" FLOAT, "Player" TEXT, "Team" TEXT, "Position" TEXT, "School" TEXT)
What is the name of the Outfielder that was picked prior to Pick 42?
SELECT "Player" FROM table_40284 WHERE "Position" = 'outfielder' AND "Pick" < '42'
SELECT "Player" FROM "table_40284" WHERE "Pick" < '42' AND "Position" = 'outfielder'
0.082031
CREATE TABLE table_24312 ("Competition" TEXT, "Round" TEXT, "Opponent" TEXT, "Result" TEXT, "Score" TEXT, "Home/Away" TEXT, "Venue" TEXT, "Attendance" TEXT, "Date" TEXT)
How many rounds have 6,150 as attendance?
SELECT "Round" FROM table_24312 WHERE "Attendance" = '6,150'
SELECT "Round" FROM "table_24312" WHERE "Attendance" = '6,150'
0.060547
CREATE TABLE table_61880 ("Tie no" TEXT, "Home team" TEXT, "Score 1" TEXT, "Away team" TEXT, "Attendance" TEXT)
What is the Score 1 of Tie no 6?
SELECT "Score 1" FROM table_61880 WHERE "Tie no" = '6'
SELECT "Score 1" FROM "table_61880" WHERE "Tie no" = '6'
0.054688
CREATE TABLE table_name_33 (attendance INT, date VARCHAR)
How many people were in attendance on January 4, 2008?
SELECT SUM(attendance) FROM table_name_33 WHERE date = "january 4, 2008"
SELECT SUM("attendance") FROM "table_name_33" WHERE "date" = "january 4, 2008"
0.076172
CREATE TABLE table_name_78 (segment_c VARCHAR, segment_a VARCHAR)
Name the segment c for ski goggles
SELECT segment_c FROM table_name_78 WHERE segment_a = "ski goggles"
SELECT "segment_c" FROM "table_name_78" WHERE "segment_a" = "ski goggles"
0.071289
CREATE TABLE table_name_36 (height VARCHAR, players VARCHAR)
How tall is Ye Fei?
SELECT height FROM table_name_36 WHERE players = "ye fei"
SELECT "height" FROM "table_name_36" WHERE "players" = "ye fei"
0.061523
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
count the number of patients whose admission year is less than 2164 and lab test name is wbc?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2164" AND lab.label = "WBC"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "WBC" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2164" > "demographic"."admityear"
0.186523
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) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is maximum days of hospital stay of patients whose primary disease is hypertension;rule out coronary artery disease\cardiac cath?
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH"
SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "HYPERTENSION;RULE OUT CORONARY ARTERY DISEASE\CARDIAC CATH" = "demographic"."diagnosis"
0.147461
CREATE TABLE table_name_71 (enrollment INT, location VARCHAR)
What's the most enrollment in Hamilton?
SELECT MAX(enrollment) FROM table_name_71 WHERE location = "hamilton"
SELECT MAX("enrollment") FROM "table_name_71" WHERE "hamilton" = "location"
0.073242
CREATE TABLE table_name_61 (player VARCHAR, team VARCHAR)
Which player played for the Boston Patriots?
SELECT player FROM table_name_61 WHERE team = "boston patriots"
SELECT "player" FROM "table_name_61" WHERE "boston patriots" = "team"
0.067383
CREATE TABLE table_name_65 (title VARCHAR, original_airdate VARCHAR)
What is the title of the episode originally aired on February 2, 2008?
SELECT title FROM table_name_65 WHERE original_airdate = "february 2, 2008"
SELECT "title" FROM "table_name_65" WHERE "february 2, 2008" = "original_airdate"
0.079102
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod 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 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 d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) 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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
what is the name of a procedure that patient 24547 has been given for two times in 09/2104?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t1.icd9_code FROM (SELECT procedures_icd.icd9_code, COUNT(procedures_icd.charttime) AS c1 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 24547) AND STRFTIME('%y-%m', procedures_icd.charttime) = '2104-09' GROUP BY procedures_icd.icd9_code) AS t1 WHERE t1.c1 = 2)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 24547 GROUP BY "hadm_id"), "t1" AS (SELECT "procedures_icd"."icd9_code", COUNT("procedures_icd"."charttime") AS "c1" FROM "procedures_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "procedures_icd"."charttime") = '2104-09' GROUP BY "procedures_icd"."icd9_code"), "_u_1" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" = 2 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
0.680664
CREATE TABLE dataset (datasetid INT, datasetname VARCHAR) CREATE TABLE journal (journalid INT, journalname VARCHAR) CREATE TABLE paperdataset (paperid INT, datasetid INT) CREATE TABLE paper (paperid INT, title VARCHAR, venueid INT, year INT, numciting INT, numcitedby INT, journalid INT) CREATE TABLE paperfield (fieldid INT, paperid INT) CREATE TABLE paperkeyphrase (paperid INT, keyphraseid INT) CREATE TABLE writes (paperid INT, authorid INT) CREATE TABLE cite (citingpaperid INT, citedpaperid INT) CREATE TABLE author (authorid INT, authorname VARCHAR) CREATE TABLE keyphrase (keyphraseid INT, keyphrasename VARCHAR) CREATE TABLE venue (venueid INT, venuename VARCHAR) CREATE TABLE field (fieldid INT)
papers published at EMNLP 2010
SELECT DISTINCT paper.paperid FROM paper, venue WHERE paper.year = 2010 AND venue.venueid = paper.venueid AND venue.venuename = 'EMNLP'
SELECT DISTINCT "paper"."paperid" FROM "paper" JOIN "venue" ON "paper"."venueid" = "venue"."venueid" AND "venue"."venuename" = 'EMNLP' WHERE "paper"."year" = 2010
0.158203
CREATE TABLE table_name_97 (partnered_with VARCHAR, score_in_final VARCHAR)
Who was Alicja Rosolska Partnered with when the Score in Final was 4 6, 3 6?
SELECT partnered_with FROM table_name_97 WHERE score_in_final = "4–6, 3–6"
SELECT "partnered_with" FROM "table_name_97" WHERE "4–6, 3–6" = "score_in_final"
0.078125
CREATE TABLE table_1566852_6 (interview_subject VARCHAR, centerfold_model VARCHAR)
How many total interview subjects wererthere when the centerfold model was Tamara Witmer?
SELECT COUNT(interview_subject) FROM table_1566852_6 WHERE centerfold_model = "Tamara Witmer"
SELECT COUNT("interview_subject") FROM "table_1566852_6" WHERE "Tamara Witmer" = "centerfold_model"
0.09668
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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime 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)
what is the one year survival rate of patients who were prescribed with cefazolin 2gm syr after the acute coronary syndrome - unstable angina?
SELECT SUM(CASE WHEN patient.hospitaldischargestatus = 'alive' THEN 1 WHEN STRFTIME('%j', patient.hospitaldischargetime) - STRFTIME('%j', t4.diagnosistime) > 1 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) FROM (SELECT t2.uniquepid, t2.diagnosistime FROM (SELECT t1.uniquepid, t1.diagnosistime FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'acute coronary syndrome - unstable angina' GROUP BY patient.uniquepid HAVING MIN(diagnosis.diagnosistime) = diagnosis.diagnosistime) AS t1) AS t2 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'cefazolin 2gm syr') AS t3 ON t2.uniquepid = t3.uniquepid WHERE t2.diagnosistime < t3.drugstarttime) AS t4 JOIN patient ON t4.uniquepid = patient.uniquepid
WITH "t1" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosistime" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'acute coronary syndrome - unstable angina' GROUP BY "patient"."uniquepid" HAVING "diagnosis"."diagnosistime" = MIN("diagnosis"."diagnosistime")), "t3" AS (SELECT "patient"."uniquepid", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" WHERE "medication"."drugname" = 'cefazolin 2gm syr') SELECT SUM(CASE WHEN "patient"."hospitaldischargestatus" = 'alive' THEN 1 WHEN STRFTIME('%j', "patient"."hospitaldischargetime") - STRFTIME('%j', "t1"."diagnosistime") > 365 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) FROM "t1" AS "t1" JOIN "t3" AS "t3" ON "t1"."diagnosistime" < "t3"."drugstarttime" AND "t1"."uniquepid" = "t3"."uniquepid" JOIN "patient" ON "patient"."uniquepid" = "t1"."uniquepid"
0.955078
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)
give me the number of patients whose drug code is kclbase2?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "KCLBASE2"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "KCLBASE2" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.192383
CREATE TABLE Products (Code INT, Name VARCHAR, Price DECIMAL, Manufacturer INT) CREATE TABLE Manufacturers (Code INT, Name VARCHAR, Headquarter VARCHAR, Founder VARCHAR, Revenue FLOAT)
For those records from the products and each product's manufacturer, return a bar chart about the distribution of headquarter and the average of price , and group by attribute headquarter, order by the Headquarter from high to low.
SELECT Headquarter, AVG(Price) FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY Headquarter ORDER BY Headquarter DESC
SELECT "Headquarter", AVG("Price") FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "Headquarter" ORDER BY "Headquarter" DESC NULLS LAST
0.181641
CREATE TABLE table_name_4 (callsign VARCHAR, iata VARCHAR)
Which Callsign has an IATA of tr?
SELECT callsign FROM table_name_4 WHERE iata = "tr"
SELECT "callsign" FROM "table_name_4" WHERE "iata" = "tr"
0.055664
CREATE TABLE table_28887 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" TEXT, "Result" TEXT, "Candidates" TEXT)
How many people won the election in the district of Virginia 4?
SELECT COUNT("Result") FROM table_28887 WHERE "District" = 'Virginia 4'
SELECT COUNT("Result") FROM "table_28887" WHERE "District" = 'Virginia 4'
0.071289
CREATE TABLE table_204_38 (id DECIMAL, "date" TEXT, "opponent#" TEXT, "rank#" TEXT, "site" TEXT, "result" TEXT)
how many games did the team win while not at home ?
SELECT COUNT(*) FROM table_204_38 WHERE "result" = 'w' AND "opponent#" <> 'home'
SELECT COUNT(*) FROM "table_204_38" WHERE "opponent#" <> 'home' AND "result" = 'w'
0.080078
CREATE TABLE table_name_58 (opponent VARCHAR, time VARCHAR)
Who was the opponent in the match that lasted 4:17?
SELECT opponent FROM table_name_58 WHERE time = "4:17"
SELECT "opponent" FROM "table_name_58" WHERE "4:17" = "time"
0.058594
CREATE TABLE table_37556 ("Outcome" TEXT, "Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Partner" TEXT, "Opponents" TEXT, "Score" TEXT)
Which Score has a Date of 13 april 1997?
SELECT "Score" FROM table_37556 WHERE "Date" = '13 april 1997'
SELECT "Score" FROM "table_37556" WHERE "Date" = '13 april 1997'
0.0625
CREATE TABLE table_47481 ("Company name" TEXT, "Hardware Model" TEXT, "Accreditation type" TEXT, "Accreditation level" TEXT, "Date" TEXT)
What is the accreditation level for the approved (awarded 05.12.12) date?
SELECT "Accreditation level" FROM table_47481 WHERE "Date" = 'approved (awarded 05.12.12)'
SELECT "Accreditation level" FROM "table_47481" WHERE "Date" = 'approved (awarded 05.12.12)'
0.089844
CREATE TABLE table_76497 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Venue" TEXT, "Result" TEXT, "Attendance" TEXT)
What is the result of the game with a game number greater than 6 and an away venue?
SELECT "Result" FROM table_76497 WHERE "Venue" = 'away' AND "Game" > '6'
SELECT "Result" FROM "table_76497" WHERE "Game" > '6' AND "Venue" = 'away'
0.072266
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what are the three most commonly prescribed drugs for patients who were also prescribed atorvastatin calcium 40 mg po tabs at the same time in 2103?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'atorvastatin calcium 40 mg po tabs' AND STRFTIME('%y', medication.drugstarttime) = '2103') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE STRFTIME('%y', medication.drugstarttime) = '2103') AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" WHERE STRFTIME('%y', "medication"."drugstarttime") = '2103'), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("medication"."drugstarttime") = DATETIME("t2"."drugstarttime") WHERE "medication"."drugname" = 'atorvastatin calcium 40 mg po tabs' AND STRFTIME('%y', "medication"."drugstarttime") = '2103' GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3
0.790039
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
what procedure did patient 006-158338 receive the last time since 6 years ago.
SELECT treatment.treatmentname FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '006-158338')) AND DATETIME(treatment.treatmenttime) >= DATETIME(CURRENT_TIME(), '-6 year') ORDER BY treatment.treatmenttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '006-158338' 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 "treatment"."treatmentname" FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE DATETIME("treatment"."treatmenttime") >= DATETIME(CURRENT_TIME(), '-6 year') AND NOT "_u_1"."" IS NULL ORDER BY "treatment"."treatmenttime" DESC NULLS LAST LIMIT 1
0.638672
CREATE TABLE table_name_59 (ground VARCHAR, away_team VARCHAR)
What was the ground for away team sydney?
SELECT ground FROM table_name_59 WHERE away_team = "sydney"
SELECT "ground" FROM "table_name_59" WHERE "away_team" = "sydney"
0.063477
CREATE TABLE table_72350 ("Institution" TEXT, "Team" TEXT, "City" TEXT, "Province" TEXT, "First season" FLOAT, "Head coach" TEXT, "Enrollment" FLOAT, "Endowment" TEXT, "Football stadium" TEXT, "Capacity" FLOAT)
How many cities have an enrollment of 19082?
SELECT COUNT("City") FROM table_72350 WHERE "Enrollment" = '19082'
SELECT COUNT("City") FROM "table_72350" WHERE "Enrollment" = '19082'
0.066406
CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare 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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) 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 food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE 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 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 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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE code_description (code VARCHAR, description TEXT)
list flights from ONTARIO CALIFORNIA to ORLANDO
SELECT DISTINCT flight_id FROM flight WHERE (from_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE (CITYalias0.city_name = 'ONTARIO' AND CITYalias0.state_code IN (SELECT STATEalias0.state_code FROM state AS STATEalias0 WHERE STATEalias0.state_name = 'CALIFORNIA')))) AND to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM city AS CITYalias1 WHERE CITYalias1.city_name = 'ORLANDO')))
WITH "_u_0" AS (SELECT "STATEalias0"."state_code" FROM "state" AS "STATEalias0" WHERE "STATEalias0"."state_name" = 'CALIFORNIA' GROUP BY "state_code"), "_u_1" AS (SELECT "CITYalias0"."city_code" FROM "city" AS "CITYalias0" LEFT JOIN "_u_0" AS "_u_0" ON "CITYalias0"."state_code" = "_u_0"."" WHERE "CITYalias0"."city_name" = 'ONTARIO' AND NOT "_u_0"."" IS NULL GROUP BY "city_code"), "_u_2" AS (SELECT "AIRPORT_SERVICEalias0"."airport_code" FROM "airport_service" AS "AIRPORT_SERVICEalias0" LEFT JOIN "_u_1" AS "_u_1" ON "AIRPORT_SERVICEalias0"."city_code" = "_u_1"."" WHERE NOT "_u_1"."" IS NULL GROUP BY "airport_code"), "_u_3" AS (SELECT "CITYalias1"."city_code" FROM "city" AS "CITYalias1" WHERE "CITYalias1"."city_name" = 'ORLANDO' GROUP BY "city_code"), "_u_4" AS (SELECT "AIRPORT_SERVICEalias1"."airport_code" FROM "airport_service" AS "AIRPORT_SERVICEalias1" LEFT JOIN "_u_3" AS "_u_3" ON "AIRPORT_SERVICEalias1"."city_code" = "_u_3"."" WHERE NOT "_u_3"."" IS NULL GROUP BY "airport_code") SELECT DISTINCT "flight_id" FROM "flight" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "from_airport" LEFT JOIN "_u_4" AS "_u_4" ON "_u_4"."" = "to_airport" WHERE NOT "_u_2"."" IS NULL AND NOT "_u_4"."" IS NULL
1.175781
CREATE TABLE table_name_40 (family VARCHAR, name VARCHAR)
Which family has a Name of humpback whale?
SELECT family FROM table_name_40 WHERE name = "humpback whale"
SELECT "family" FROM "table_name_40" WHERE "humpback whale" = "name"
0.066406
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
when patient 012-29464 first received transplant surgery consultation?
SELECT treatment.treatmenttime FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '012-29464')) AND treatment.treatmentname = 'transplant surgery consultation' ORDER BY treatment.treatmenttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '012-29464' 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 "treatment"."treatmenttime" FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE "treatment"."treatmentname" = 'transplant surgery consultation' AND NOT "_u_1"."" IS NULL ORDER BY "treatment"."treatmenttime" NULLS FIRST LIMIT 1
0.621094
CREATE TABLE tourist_attractions (tourist_attraction_id DECIMAL, attraction_type_code TEXT, location_id DECIMAL, how_to_get_there TEXT, name TEXT, description TEXT, opening_hours TEXT, other_details TEXT) CREATE TABLE locations (location_id DECIMAL, location_name TEXT, address TEXT, other_details TEXT) CREATE TABLE visitors (tourist_id DECIMAL, tourist_details TEXT) CREATE TABLE ref_attraction_types (attraction_type_code TEXT, attraction_type_description TEXT) CREATE TABLE theme_parks (theme_park_id DECIMAL, theme_park_details TEXT) CREATE TABLE staff (staff_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, other_details TEXT) CREATE TABLE hotels (hotel_id DECIMAL, star_rating_code TEXT, pets_allowed_yn TEXT, price_range DECIMAL, other_hotel_details TEXT) CREATE TABLE shops (shop_id DECIMAL, shop_details TEXT) CREATE TABLE tourist_attraction_features (tourist_attraction_id DECIMAL, feature_id DECIMAL) CREATE TABLE street_markets (market_id DECIMAL, market_details TEXT) CREATE TABLE ref_hotel_star_ratings (star_rating_code TEXT, star_rating_description TEXT) CREATE TABLE features (feature_id DECIMAL, feature_details TEXT) CREATE TABLE photos (photo_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, description TEXT, filename TEXT, other_details TEXT) CREATE TABLE visits (visit_id DECIMAL, tourist_attraction_id DECIMAL, tourist_id DECIMAL, visit_date TIME, visit_details TEXT) CREATE TABLE royal_family (royal_family_id DECIMAL, royal_family_details TEXT) CREATE TABLE museums (museum_id DECIMAL, museum_details TEXT)
What are the distinct visit dates?
SELECT DISTINCT visit_date FROM visits
SELECT DISTINCT "visit_date" FROM "visits"
0.041016
CREATE TABLE table_44305 ("Rank" FLOAT, "Country" TEXT, "Miss United Continent" FLOAT, "Virreina" FLOAT, "1st RU" FLOAT, "2nd RU" FLOAT, "3rd RU" FLOAT, "4th RU" FLOAT, "Semifinalists" FLOAT, "Total" FLOAT)
How many semifinalists had a total less than 2, 1st RU greater than 0, 2nd RU was 0 and Miss United Continent of 0?
SELECT COUNT("Semifinalists") FROM table_44305 WHERE "Miss United Continent" = '0' AND "2nd RU" = '0' AND "1st RU" > '0' AND "Total" < '2'
SELECT COUNT("Semifinalists") FROM "table_44305" WHERE "1st RU" > '0' AND "2nd RU" = '0' AND "Miss United Continent" = '0' AND "Total" < '2'
0.136719
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 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)
what is procedure icd9 code and drug type of subject id 52012?
SELECT procedures.icd9_code, prescriptions.drug_type FROM procedures INNER JOIN prescriptions ON procedures.hadm_id = prescriptions.hadm_id WHERE procedures.subject_id = "52012"
SELECT "procedures"."icd9_code", "prescriptions"."drug_type" FROM "procedures" JOIN "prescriptions" ON "prescriptions"."hadm_id" = "procedures"."hadm_id" WHERE "52012" = "procedures"."subject_id"
0.19043
CREATE TABLE table_52185 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" FLOAT)
I want the greatest attendance when the opponent is the chicago bears
SELECT MAX("Attendance") FROM table_52185 WHERE "Opponent" = 'chicago bears'
SELECT MAX("Attendance") FROM "table_52185" WHERE "Opponent" = 'chicago bears'
0.076172
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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) 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 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 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) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_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)
in 01/this year, when did patient 5364 last get prescribed imipenem-cilastatin and propofol at the same time?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'imipenem-cilastatin' AND admissions.subject_id = 5364 AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '01') AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'propofol' AND admissions.subject_id = 5364 AND DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', prescriptions.startdate) = '01') AS t2 ON t1.subject_id = t2.subject_id WHERE DATETIME(t1.startdate) = DATETIME(t2.startdate) ORDER BY t1.startdate DESC LIMIT 1
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 5364 WHERE "prescriptions"."drug" = 'propofol' AND DATETIME("prescriptions"."startdate", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', "prescriptions"."startdate") = '01') SELECT "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 5364 JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND DATETIME("prescriptions"."startdate") = DATETIME("t2"."startdate") WHERE "prescriptions"."drug" = 'imipenem-cilastatin' AND DATETIME("prescriptions"."startdate", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND STRFTIME('%m', "prescriptions"."startdate") = '01' ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.979492
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL)
what did patient 021-93953 first have as an output on the last intensive care unit visit?
SELECT intakeoutput.celllabel FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-93953') AND NOT patient.unitdischargetime IS NULL ORDER BY patient.unitadmittime DESC LIMIT 1) AND intakeoutput.cellpath LIKE '%output%' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '021-93953' GROUP BY "patienthealthsystemstayid") SELECT "intakeoutput"."celllabel" FROM "intakeoutput" WHERE "intakeoutput"."cellpath" LIKE '%output%' AND "intakeoutput"."patientunitstayid" IN (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL AND NOT "patient"."unitdischargetime" IS NULL ORDER BY "patient"."unitadmittime" DESC NULLS LAST LIMIT 1) ORDER BY "intakeoutput"."intakeoutputtime" NULLS FIRST LIMIT 1
0.614258
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Return a scatter chart about the correlation between ACC_Percent and All_Games_Percent , and group by attribute All_Neutral.
SELECT ACC_Percent, All_Games_Percent FROM basketball_match GROUP BY All_Neutral
SELECT "ACC_Percent", "All_Games_Percent" FROM "basketball_match" GROUP BY "All_Neutral"
0.085938