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_26266 ("Local Government Area" TEXT, "Type" TEXT, "Major Town" TEXT, "Land Area ( km\\u00b2 ) " TEXT, "Pop. 2006" FLOAT, "Density km \\u22122" FLOAT, "Towns" FLOAT, "Est." FLOAT)
Which major town is located within the Outback Areas Community Development Trust?
SELECT "Major Town" FROM table_26266 WHERE "Local Government Area" = 'Outback Areas Community Development Trust'
SELECT "Major Town" FROM "table_26266" WHERE "Local Government Area" = 'Outback Areas Community Development Trust'
0.111328
CREATE TABLE table_name_70 (round INT, record VARCHAR)
What is the sum of Round, when Record is '19-25-5'?
SELECT SUM(round) FROM table_name_70 WHERE record = "19-25-5"
SELECT SUM("round") FROM "table_name_70" WHERE "19-25-5" = "record"
0.06543
CREATE TABLE table_25800134_4 (writer_s_ VARCHAR, season__number VARCHAR)
Who was the writer of episode 15?
SELECT writer_s_ FROM table_25800134_4 WHERE season__number = 15
SELECT "writer_s_" FROM "table_25800134_4" WHERE "season__number" = 15
0.068359
CREATE TABLE table_36907 ("Club" TEXT, "Sport" TEXT, "Founded" FLOAT, "League" TEXT, "Venue" TEXT, "Head Coach" TEXT)
Sport of football, and a Venue of stadion polonii is what league?
SELECT "League" FROM table_36907 WHERE "Sport" = 'football' AND "Venue" = 'stadion polonii'
SELECT "League" FROM "table_36907" WHERE "Sport" = 'football' AND "Venue" = 'stadion polonii'
0.09082
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 diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients with diagnosis icd9 code 7242 have had abnormal lab tests?
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.icd9_code = "7242" AND lab.flag = "abnormal"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "7242" = "diagnoses"."icd9_code" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "lab" ON "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.25293
CREATE TABLE table_37927 ("Date" TEXT, "Time" TEXT, "Opponent" TEXT, "Score" TEXT, "Loss" TEXT, "Record" TEXT)
At what time was the game when they played the White Sox and had a record of 63-70?
SELECT "Time" FROM table_37927 WHERE "Opponent" = 'white sox' AND "Record" = '63-70'
SELECT "Time" FROM "table_37927" WHERE "Opponent" = 'white sox' AND "Record" = '63-70'
0.083984
CREATE TABLE CloseReasonTypes (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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT)
Questions with letter transpositions of 'Android' in the title. case-insensitive
SELECT Id AS "post_link", CreationDate FROM Posts WHERE PostTypeId = 1 AND (Title LIKE '%nadroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%adnroid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%anrdoid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%andorid%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%andriod%' COLLATE SQL_Latin1_General_CP1_CI_AS OR Title LIKE '%androdi%' COLLATE SQL_Latin1_General_CP1_CI_AS)
SELECT "Id" AS "post_link", "CreationDate" FROM "Posts" WHERE "PostTypeId" = 1 AND ("Title" LIKE COLLATE('%adnroid%', "SQL_Latin1_General_CP1_CI_AS") OR "Title" LIKE COLLATE('%andorid%', "SQL_Latin1_General_CP1_CI_AS") OR "Title" LIKE COLLATE('%andriod%', "SQL_Latin1_General_CP1_CI_AS") OR "Title" LIKE COLLATE('%androdi%', "SQL_Latin1_General_CP1_CI_AS") OR "Title" LIKE COLLATE('%anrdoid%', "SQL_Latin1_General_CP1_CI_AS") OR "Title" LIKE COLLATE('%nadroid%', "SQL_Latin1_General_CP1_CI_AS"))
0.483398
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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) 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 d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
what was the daily minimum amount of jackson pratt #1 given to patient 49457 until 10 months ago?
SELECT MIN(outputevents.value) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 49457)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'jackson pratt #1' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime) <= DATETIME(CURRENT_TIME(), '-10 month') GROUP BY STRFTIME('%y-%m-%d', outputevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 49457 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'jackson pratt #1' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT MIN("outputevents"."value") FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE DATETIME("outputevents"."charttime") <= DATETIME(CURRENT_TIME(), '-10 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL GROUP BY STRFTIME('%y-%m-%d', "outputevents"."charttime")
0.819336
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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
the number of times patient 013-28507 has had a splinting - orthopedic immobilizer procedure in 2105 count.
SELECT COUNT(*) FROM treatment WHERE treatment.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '013-28507')) AND treatment.treatmentname = 'splinting - orthopedic immobilizer' AND STRFTIME('%y', treatment.treatmenttime) = '2105'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '013-28507' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "treatment" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "treatment"."patientunitstayid" WHERE "treatment"."treatmentname" = 'splinting - orthopedic immobilizer' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y', "treatment"."treatmenttime") = '2105'
0.605469
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) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID 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)
For those employees who was hired before 2002-06-21, give me the trend about manager_id over hire_date .
SELECT HIRE_DATE, MANAGER_ID FROM employees WHERE HIRE_DATE < '2002-06-21'
SELECT "HIRE_DATE", "MANAGER_ID" FROM "employees" WHERE "HIRE_DATE" < '2002-06-21'
0.080078
CREATE TABLE student (id TEXT, name TEXT, dept_name TEXT, tot_cred DECIMAL) CREATE TABLE section (course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, building TEXT, room_number TEXT, time_slot_id TEXT) CREATE TABLE instructor (id TEXT, name TEXT, dept_name TEXT, salary DECIMAL) CREATE TABLE department (dept_name TEXT, building TEXT, budget DECIMAL) CREATE TABLE teaches (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL) CREATE TABLE takes (id TEXT, course_id TEXT, sec_id TEXT, semester TEXT, year DECIMAL, grade TEXT) CREATE TABLE course (course_id TEXT, title TEXT, dept_name TEXT, credits DECIMAL) CREATE TABLE classroom (building TEXT, room_number TEXT, capacity DECIMAL) CREATE TABLE time_slot (time_slot_id TEXT, day TEXT, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL) CREATE TABLE advisor (s_id TEXT, i_id TEXT) CREATE TABLE prereq (course_id TEXT, prereq_id TEXT)
What are the names of all instructors in the Comp. Sci. department?
SELECT name FROM instructor WHERE dept_name = 'Comp. Sci.'
SELECT "name" FROM "instructor" WHERE "dept_name" = 'Comp. Sci.'
0.0625
CREATE TABLE Accounts (customer_id VARCHAR)
Show all customer ids and the number of accounts for each customer.
SELECT customer_id, COUNT(*) FROM Accounts GROUP BY customer_id
SELECT "customer_id", COUNT(*) FROM "Accounts" GROUP BY "customer_id"
0.067383
CREATE TABLE table_13617 ("Club" TEXT, "Nickname" TEXT, "Years in Competition" TEXT, "No. of Premierships" FLOAT, "Premiership Years" TEXT)
How many Premierships have Nicknamed of kangaroos?
SELECT COUNT("No. of Premierships") FROM table_13617 WHERE "Nickname" = 'kangaroos'
SELECT COUNT("No. of Premierships") FROM "table_13617" WHERE "Nickname" = 'kangaroos'
0.083008
CREATE TABLE table_15383430_1 (original_artist VARCHAR, theme VARCHAR)
The theme year they were born belongs to what artist?
SELECT original_artist FROM table_15383430_1 WHERE theme = "Year They Were Born"
SELECT "original_artist" FROM "table_15383430_1" WHERE "Year They Were Born" = "theme"
0.083984
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) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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)
For those employees who did not have any job in the past, return a bar chart about the distribution of job_id and the sum of employee_id , and group by attribute job_id.
SELECT JOB_ID, SUM(EMPLOYEE_ID) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) GROUP BY JOB_ID
SELECT "JOB_ID", SUM("EMPLOYEE_ID") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") GROUP BY "JOB_ID"
0.135742
CREATE TABLE table_204_396 (id DECIMAL, "country" TEXT, "masters" DECIMAL, "u.s. open" DECIMAL, "the open" DECIMAL, "pga" DECIMAL, "total" DECIMAL)
what are the number of pga winning golfers that zimbabwe has ?
SELECT "pga" FROM table_204_396 WHERE "country" = 'zimbabwe'
SELECT "pga" FROM "table_204_396" WHERE "country" = 'zimbabwe'
0.060547
CREATE TABLE table_51544 ("Year" FLOAT, "Tournament" TEXT, "Venue" TEXT, "Result" TEXT, "Event" TEXT)
How did he place in 1970?
SELECT "Result" FROM table_51544 WHERE "Year" = '1970'
SELECT "Result" FROM "table_51544" WHERE "Year" = '1970'
0.054688
CREATE TABLE table_59738 ("Year" TEXT, "Winner" TEXT, "Runner-up" TEXT, "Venue" TEXT, "Location" TEXT)
What is the location where ed c. kingsley was the runner-up in 1939?
SELECT "Location" FROM table_59738 WHERE "Runner-up" = 'ed c. kingsley' AND "Year" = '1939'
SELECT "Location" FROM "table_59738" WHERE "Runner-up" = 'ed c. kingsley' AND "Year" = '1939'
0.09082
CREATE TABLE table_name_32 (wamalwa VARCHAR, turnout__percentage VARCHAR)
What's listed for the Wamalwa that has a Turnout % of 55.9%?
SELECT wamalwa FROM table_name_32 WHERE turnout__percentage = "55.9%"
SELECT "wamalwa" FROM "table_name_32" WHERE "55.9%" = "turnout__percentage"
0.073242
CREATE TABLE table_name_60 (win_loss VARCHAR, win__percentage VARCHAR)
What is Win-Loss, when Win % is .456?
SELECT win_loss FROM table_name_60 WHERE win__percentage = ".456"
SELECT "win_loss" FROM "table_name_60" WHERE ".456" = "win__percentage"
0.069336
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL)
Questions that define new LaTeX commands.
SELECT Id AS "post_link", CreationDate FROM Posts WHERE PostTypeId = 1 AND Body LIKE '%newcommand%' ORDER BY CreationDate DESC
SELECT "Id" AS "post_link", "CreationDate" FROM "Posts" WHERE "Body" LIKE '%newcommand%' AND "PostTypeId" = 1 ORDER BY "CreationDate" DESC NULLS LAST
0.145508
CREATE TABLE table_6762 ("Date" TEXT, "Pos." TEXT, "Player" TEXT, "From club" TEXT, "Transfer fee" TEXT)
Which Player had a From club of atl tico madrid?
SELECT "Player" FROM table_6762 WHERE "From club" = 'atlético madrid'
SELECT "Player" FROM "table_6762" WHERE "From club" = 'atlético madrid'
0.069336
CREATE TABLE table_name_94 (attendance VARCHAR, score VARCHAR)
What is the Attendance of the game with a Score of 0 0?
SELECT attendance FROM table_name_94 WHERE score = "0 – 0"
SELECT "attendance" FROM "table_name_94" WHERE "0 – 0" = "score"
0.0625
CREATE TABLE rental (rental_id DECIMAL, rental_date TIME, inventory_id DECIMAL, customer_id DECIMAL, return_date TIME, staff_id DECIMAL, last_update TIME) CREATE TABLE staff (staff_id DECIMAL, first_name TEXT, last_name TEXT, address_id DECIMAL, picture others, email TEXT, store_id DECIMAL, active BOOLEAN, username TEXT, password TEXT, last_update TIME) CREATE TABLE film_text (film_id DECIMAL, title TEXT, description TEXT) CREATE TABLE payment (payment_id DECIMAL, customer_id DECIMAL, staff_id DECIMAL, rental_id DECIMAL, amount DECIMAL, payment_date TIME, last_update TIME) CREATE TABLE film (film_id DECIMAL, title TEXT, description TEXT, release_year TIME, language_id DECIMAL, original_language_id DECIMAL, rental_duration DECIMAL, rental_rate DECIMAL, length DECIMAL, replacement_cost DECIMAL, rating TEXT, special_features TEXT, last_update TIME) CREATE TABLE store (store_id DECIMAL, manager_staff_id DECIMAL, address_id DECIMAL, last_update TIME) CREATE TABLE language (language_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE city (city_id DECIMAL, city TEXT, country_id DECIMAL, last_update TIME) CREATE TABLE inventory (inventory_id DECIMAL, film_id DECIMAL, store_id DECIMAL, last_update TIME) CREATE TABLE actor (actor_id DECIMAL, first_name TEXT, last_name TEXT, last_update TIME) CREATE TABLE customer (customer_id DECIMAL, store_id DECIMAL, first_name TEXT, last_name TEXT, email TEXT, address_id DECIMAL, active BOOLEAN, create_date TIME, last_update TIME) CREATE TABLE address (address_id DECIMAL, address TEXT, address2 TEXT, district TEXT, city_id DECIMAL, postal_code TEXT, phone TEXT, last_update TIME) CREATE TABLE category (category_id DECIMAL, name TEXT, last_update TIME) CREATE TABLE film_category (film_id DECIMAL, category_id DECIMAL, last_update TIME) CREATE TABLE film_actor (actor_id DECIMAL, film_id DECIMAL, last_update TIME) CREATE TABLE country (country_id DECIMAL, country TEXT, last_update TIME)
What are the title and id of the film which has a rental rate of 0.99 and an inventory of below 3?
SELECT title, film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title, T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING COUNT(*) < 3
SELECT "title", "film_id" FROM "film" WHERE "rental_rate" = 0.99 INTERSECT SELECT "T1"."title", "T1"."film_id" FROM "film" AS "T1" JOIN "inventory" AS "T2" ON "T1"."film_id" = "T2"."film_id" GROUP BY "T1"."film_id" HAVING COUNT(*) < 3
0.228516
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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 are suggested with the procedure colonoscopy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE procedures.short_title = "Colonoscopy"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Colonoscopy" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id"
0.180664
CREATE TABLE Statements (Statement_ID INT, Statement_Details VARCHAR) CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR) CREATE TABLE Documents (Document_ID INT, Document_Type_Code CHAR, Project_ID INT, Document_Date DATETIME, Document_Name VARCHAR, Document_Description VARCHAR, Other_Details VARCHAR) CREATE TABLE Accounts (Account_ID INT, Statement_ID INT, Account_Details VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR) CREATE TABLE Documents_with_Expenses (Document_ID INT, Budget_Type_Code CHAR, Document_Details VARCHAR) CREATE TABLE Projects (Project_ID INT, Project_Details VARCHAR)
what are the different budget type codes, and how many documents are there for each?
SELECT Budget_Type_Code, COUNT(*) FROM Documents_with_Expenses GROUP BY Budget_Type_Code
SELECT "Budget_Type_Code", COUNT(*) FROM "Documents_with_Expenses" GROUP BY "Budget_Type_Code"
0.091797
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE 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 have a government insurance policy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.insurance = "Government"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "Government" = "demographic"."insurance"
0.112305
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT)
what were the total amount of d20w intake that patient 30171 had received on 05/30/2101?
SELECT SUM(inputevents_cv.amount) FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 30171)) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd20w' AND d_items.linksto = 'inputevents_cv') AND STRFTIME('%y-%m-%d', inputevents_cv.charttime) = '2101-05-30'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 30171 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'd20w' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT SUM("inputevents_cv"."amount") FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "inputevents_cv"."charttime") = '2101-05-30'
0.75
CREATE TABLE table_name_50 (primary_sponsor_s_ VARCHAR, owner_s_ VARCHAR, crew_chief VARCHAR)
What primary sponsor has the owner Rick Hendrick and their crew chief is Alan Gustafson?
SELECT primary_sponsor_s_ FROM table_name_50 WHERE owner_s_ = "rick hendrick" AND crew_chief = "alan gustafson"
SELECT "primary_sponsor_s_" FROM "table_name_50" WHERE "alan gustafson" = "crew_chief" AND "owner_s_" = "rick hendrick"
0.116211
CREATE TABLE table_59333 ("Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Opponent" TEXT, "Score" TEXT)
What is Score, when Opponent is 'Daniel Gimeno-Traver'?
SELECT "Score" FROM table_59333 WHERE "Opponent" = 'daniel gimeno-traver'
SELECT "Score" FROM "table_59333" WHERE "Opponent" = 'daniel gimeno-traver'
0.073242
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label 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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many prescriptions were issued for hydrocerin in 2105?
SELECT COUNT(*) FROM prescriptions WHERE prescriptions.drug = 'hydrocerin' AND STRFTIME('%y', prescriptions.startdate) = '2105'
SELECT COUNT(*) FROM "prescriptions" WHERE "prescriptions"."drug" = 'hydrocerin' AND STRFTIME('%y', "prescriptions"."startdate") = '2105'
0.133789
CREATE TABLE table_13092 ("Municipality" TEXT, "Inhabitants" FLOAT, "Mayor" TEXT, "Party" TEXT, "Election" FLOAT)
What is the average election that has monza as the municipality?
SELECT AVG("Election") FROM table_13092 WHERE "Municipality" = 'monza'
SELECT AVG("Election") FROM "table_13092" WHERE "Municipality" = 'monza'
0.070313
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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 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 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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost 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 procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
has patient 6170 in yesterday excreted any foley.
SELECT COUNT(*) > 0 FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 6170)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'foley' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 6170 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'foley' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE DATETIME("outputevents"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-1 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.763672
CREATE TABLE table_60178 ("Week" TEXT, "Theme" TEXT, "Song Sung" TEXT, "Artist" TEXT, "Status" TEXT)
Which Artist is listed as having Top 6 in Week
SELECT "Artist" FROM table_60178 WHERE "Week" = 'top 6'
SELECT "Artist" FROM "table_60178" WHERE "Week" = 'top 6'
0.055664
CREATE TABLE table_3476 ("District" FLOAT, "Representative" TEXT, "Party" TEXT, "Residence" TEXT, "First Elected" TEXT, "Term Limited" FLOAT)
If first elected on 2003 (appt.), when was the term limited?
SELECT MIN("Term Limited") FROM table_3476 WHERE "First Elected" = '2003 (Appt.)'
SELECT MIN("Term Limited") FROM "table_3476" WHERE "First Elected" = '2003 (Appt.)'
0.081055
CREATE TABLE Customer_Event_Notes (Customer_Event_Note_ID INT, Customer_Event_ID INT, service_type_code CHAR, resident_id INT, property_id INT, date_moved_in DATETIME) CREATE TABLE Properties (property_id INT, property_type_code CHAR, property_address VARCHAR, other_details VARCHAR) CREATE TABLE Customer_Events (Customer_Event_ID INT, customer_id INT, date_moved_in DATETIME, property_id INT, resident_id INT, thing_id INT) CREATE TABLE Organizations (organization_id INT, parent_organization_id INT, organization_details VARCHAR) CREATE TABLE Residents_Services (resident_id INT, service_id INT, date_moved_in DATETIME, property_id INT, date_requested DATETIME, date_provided DATETIME, other_details VARCHAR) CREATE TABLE Things (thing_id INT, organization_id INT, Type_of_Thing_Code CHAR, service_type_code CHAR, service_details VARCHAR) CREATE TABLE Services (service_id INT, organization_id INT, service_type_code CHAR, service_details VARCHAR) CREATE TABLE Timed_Status_of_Things (thing_id INT, Date_and_Date DATETIME, Status_of_Thing_Code CHAR) CREATE TABLE Timed_Locations_of_Things (thing_id INT, Date_and_Time DATETIME, Location_Code CHAR) CREATE TABLE Residents (resident_id INT, property_id INT, date_moved_in DATETIME, date_moved_out DATETIME, other_details VARCHAR) CREATE TABLE Customers (customer_id INT, customer_details VARCHAR)
Please use a bar chart to compare the number of customers of each customer's move in date.
SELECT date_moved_in, COUNT(date_moved_in) FROM Customers AS T1 JOIN Customer_Events AS T2 ON T1.customer_id = T2.customer_id GROUP BY date_moved_in
SELECT "date_moved_in", COUNT("date_moved_in") FROM "Customers" AS "T1" JOIN "Customer_Events" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" GROUP BY "date_moved_in"
0.166016
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients have been prescribed the drug with code pred1?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "PRED1"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "PRED1" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.189453
CREATE TABLE Candidates (candidate_id INT, candidate_details VARCHAR) CREATE TABLE Courses (course_id VARCHAR, course_name VARCHAR, course_description VARCHAR, other_details VARCHAR) CREATE TABLE Candidate_Assessments (candidate_id INT, qualification CHAR, assessment_date DATETIME, asessment_outcome_code CHAR) CREATE TABLE Addresses (address_id INT, line_1 VARCHAR, line_2 VARCHAR, city VARCHAR, zip_postcode CHAR, state_province_county VARCHAR, country VARCHAR) CREATE TABLE Students (student_id INT, student_details VARCHAR) CREATE TABLE People_Addresses (person_address_id INT, person_id INT, address_id INT, date_from DATETIME, date_to DATETIME) CREATE TABLE Student_Course_Registrations (student_id INT, course_id INT, registration_date DATETIME) CREATE TABLE Student_Course_Attendance (student_id INT, course_id INT, date_of_attendance DATETIME) CREATE TABLE People (person_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, login_name VARCHAR, password VARCHAR)
For all course_name from courses table, group by the course name and count them with a bar chart, and display Y-axis from high to low order.
SELECT course_name, COUNT(course_name) FROM Courses GROUP BY course_name ORDER BY COUNT(course_name) DESC
SELECT "course_name", COUNT("course_name") FROM "Courses" GROUP BY "course_name" ORDER BY COUNT("course_name") DESC NULLS LAST
0.123047
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) 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)
how many female patients were prescribed the drug quetiapine fumarate?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.gender = "F" AND prescriptions.drug = "Quetiapine Fumarate"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Quetiapine Fumarate" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "F" = "demographic"."gender"
0.224609
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE 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 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)
tell me the monthly minimum sao2 of patient 010-19726 until 9 months ago.
SELECT MIN(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '010-19726')) AND NOT vitalperiodic.sao2 IS NULL AND DATETIME(vitalperiodic.observationtime) <= DATETIME(CURRENT_TIME(), '-9 month') GROUP BY STRFTIME('%y-%m', vitalperiodic.observationtime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '010-19726' 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 MIN("vitalperiodic"."sao2") FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE DATETIME("vitalperiodic"."observationtime") <= DATETIME(CURRENT_TIME(), '-9 month') AND NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."sao2" IS NULL GROUP BY STRFTIME('%y-%m', "vitalperiodic"."observationtime")
0.691406
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL)
when did patient 9038 last have an intake since 663 days ago?
SELECT inputevents_cv.charttime FROM inputevents_cv WHERE inputevents_cv.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 9038)) AND DATETIME(inputevents_cv.charttime) >= DATETIME(CURRENT_TIME(), '-663 day') ORDER BY inputevents_cv.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 9038 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id") SELECT "inputevents_cv"."charttime" FROM "inputevents_cv" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "inputevents_cv"."icustay_id" WHERE DATETIME("inputevents_cv"."charttime") >= DATETIME(CURRENT_TIME(), '-663 day') AND NOT "_u_1"."" IS NULL ORDER BY "inputevents_cv"."charttime" DESC NULLS LAST LIMIT 1
0.583984
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
what is the top five most frequent diagnoses for patients aged 30s during the previous year?
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 5
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 39 AND "patient"."age" >= 30 GROUP BY "patientunitstayid"), "t1" AS (SELECT "diagnosis"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "diagnosis"."patientunitstayid" WHERE DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL GROUP BY "diagnosis"."diagnosisname") SELECT "t1"."diagnosisname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 5
0.583008
CREATE TABLE paper (paperid INT, title VARCHAR, venueid INT, year INT, numciting INT, numcitedby INT, journalid INT) CREATE TABLE paperkeyphrase (paperid INT, keyphraseid INT) CREATE TABLE paperdataset (paperid INT, datasetid INT) CREATE TABLE field (fieldid INT) CREATE TABLE writes (paperid INT, authorid INT) CREATE TABLE venue (venueid INT, venuename VARCHAR) CREATE TABLE cite (citingpaperid INT, citedpaperid INT) CREATE TABLE author (authorid INT, authorname VARCHAR) CREATE TABLE keyphrase (keyphraseid INT, keyphrasename VARCHAR) CREATE TABLE dataset (datasetid INT, datasetname VARCHAR) CREATE TABLE paperfield (fieldid INT, paperid INT) CREATE TABLE journal (journalid INT, journalname VARCHAR)
Semantic Parsing papers by Li Dong
SELECT DISTINCT author.authorid, paper.paperid FROM author, keyphrase, paper, paperkeyphrase, writes WHERE author.authorname = 'Li Dong' AND keyphrase.keyphrasename = 'Semantic Parsing' AND paperkeyphrase.keyphraseid = keyphrase.keyphraseid AND paper.paperid = paperkeyphrase.paperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid
SELECT DISTINCT "author"."authorid", "paper"."paperid" FROM "author" JOIN "writes" ON "author"."authorid" = "writes"."authorid" JOIN "paper" ON "paper"."paperid" = "writes"."paperid" JOIN "paperkeyphrase" ON "paper"."paperid" = "paperkeyphrase"."paperid" JOIN "keyphrase" ON "keyphrase"."keyphraseid" = "paperkeyphrase"."keyphraseid" AND "keyphrase"."keyphrasename" = 'Semantic Parsing' WHERE "author"."authorname" = 'Li Dong'
0.416016
CREATE TABLE table_17103729_7 (location_attendance VARCHAR, score VARCHAR)
With a score of 68-85, what is the location and attendance?
SELECT location_attendance FROM table_17103729_7 WHERE score = "68-85"
SELECT "location_attendance" FROM "table_17103729_7" WHERE "68-85" = "score"
0.074219
CREATE TABLE table_204_750 (id DECIMAL, "team" TEXT, "stadium" TEXT, "capacity" DECIMAL, "seated" DECIMAL)
which allows for more seated , ladysmead or cossham street ?
SELECT "stadium" FROM table_204_750 WHERE "stadium" IN ('ladysmead', 'cossham street') ORDER BY "capacity" DESC LIMIT 1
SELECT "stadium" FROM "table_204_750" WHERE "stadium" IN ('ladysmead', 'cossham street') ORDER BY "capacity" DESC NULLS LAST LIMIT 1
0.128906
CREATE TABLE table_145439_1 (health VARCHAR, justice VARCHAR)
what's the health score with justice being 80.7
SELECT health FROM table_145439_1 WHERE justice = "80.7"
SELECT "health" FROM "table_145439_1" WHERE "80.7" = "justice"
0.060547
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT)
Most downvoted posts without a single (non-owner) comment.
SELECT Posts.Id AS "post_link", Posts.OwnerUserId AS "user_link", Posts.Score FROM Posts LEFT JOIN Comments ON Comments.PostId = Posts.Id AND Comments.UserId != Posts.OwnerUserId AND Comments.UserId > 1 WHERE Comments.Id IS NULL AND Posts.OwnerUserId > 1 AND Posts.Score < 0 ORDER BY Posts.Score, Posts.Id
SELECT "Posts"."Id" AS "post_link", "Posts"."OwnerUserId" AS "user_link", "Posts"."Score" FROM "Posts" LEFT JOIN "Comments" ON "Comments"."PostId" = "Posts"."Id" AND "Comments"."UserId" <> "Posts"."OwnerUserId" AND "Comments"."UserId" > 1 WHERE "Comments"."Id" IS NULL AND "Posts"."OwnerUserId" > 1 AND "Posts"."Score" < 0 ORDER BY "Posts"."Score" NULLS FIRST, "Posts"."Id" NULLS FIRST
0.375977
CREATE TABLE table_54456 ("Episode" TEXT, "Rating" FLOAT, "Share" FLOAT, "Rating/Share ( 18-49 ) " TEXT, "Viewers ( millions ) " FLOAT, "Rank ( timeslot ) " FLOAT, "Rank ( night ) " FLOAT, "Rank ( week ) " TEXT)
what is the rank (night) when the rating is more than 4.3 and the viewers (millions) is more than 10.72?
SELECT AVG("Rank (night)") FROM table_54456 WHERE "Rating" > '4.3' AND "Viewers (millions)" > '10.72'
SELECT AVG("Rank (night)") FROM "table_54456" WHERE "Rating" > '4.3' AND "Viewers (millions)" > '10.72'
0.100586
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients whose diagnoses short title is bleed esoph var oth dis and drug type is main?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE diagnoses.short_title = "Bleed esoph var oth dis" AND prescriptions.drug_type = "MAIN"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Bleed esoph var oth dis" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" JOIN "prescriptions" ON "MAIN" = "prescriptions"."drug_type" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.303711
CREATE TABLE table_42551 ("Time" TEXT, "06:00 PM" TEXT, "07:00 PM" TEXT, "08:00 PM" TEXT, "09:00 PM" TEXT, "10:00 PM" TEXT, "10:30 PM" TEXT, "11:00 PM" TEXT)
What is the 08:00 PM when the 07:00 PM is I am siam (rerun)?
SELECT "08:00 PM" FROM table_42551 WHERE "07:00 PM" = 'i am siam (rerun)'
SELECT "08:00 PM" FROM "table_42551" WHERE "07:00 PM" = 'i am siam (rerun)'
0.073242
CREATE TABLE table_27069503_2 (overall VARCHAR, conf_record VARCHAR)
What was the overall record for the Pandas when their conference record was 4-1-1?
SELECT overall FROM table_27069503_2 WHERE conf_record = "4-1-1"
SELECT "overall" FROM "table_27069503_2" WHERE "4-1-1" = "conf_record"
0.068359
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description 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 PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) 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 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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
All questions and answers by user, rendered as HTML.
SELECT name FROM sys.databases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb', 'Data.StackExchange')
SELECT "name" FROM "sys"."databases" WHERE NOT "name" IN ('master', 'tempdb', 'model', 'msdb', 'Data.StackExchange')
0.113281
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME)
what were the top three most common diagnoses of patients aged 30s until 2102.
SELECT t1.diagnosisname FROM (SELECT diagnosis.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnosis WHERE diagnosis.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 30 AND 39) AND STRFTIME('%y', diagnosis.diagnosistime) <= '2102' GROUP BY diagnosis.diagnosisname) AS t1 WHERE t1.c1 <= 3
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 39 AND "patient"."age" >= 30 GROUP BY "patientunitstayid"), "t1" AS (SELECT "diagnosis"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "diagnosis"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "diagnosis"."diagnosistime") <= '2102' GROUP BY "diagnosis"."diagnosisname") SELECT "t1"."diagnosisname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 3
0.52832
CREATE TABLE table_name_22 (league_apps INT, cup_goals VARCHAR, cup_apps VARCHAR)
How many league apps in the season with more than 2 cup goals and more than 6 cup apps?
SELECT SUM(league_apps) FROM table_name_22 WHERE cup_goals > 2 AND cup_apps > 6
SELECT SUM("league_apps") FROM "table_name_22" WHERE "cup_apps" > 6 AND "cup_goals" > 2
0.084961
CREATE TABLE betfront (year DECIMAL, datetime TIME, country TEXT, competion TEXT, match TEXT, home_opening DECIMAL, draw_opening DECIMAL, away_opening DECIMAL, home_closing DECIMAL, draw_closing DECIMAL, away_closing DECIMAL) CREATE TABLE football_data (season TEXT, datetime TIME, div TEXT, country TEXT, league TEXT, referee TEXT, hometeam TEXT, awayteam TEXT, fthg DECIMAL, ftag DECIMAL, ftr TEXT, hthg DECIMAL, htag DECIMAL, htr TEXT, psh DECIMAL, psd DECIMAL, psa DECIMAL, b365h DECIMAL, b365d DECIMAL, b365a DECIMAL, lbh DECIMAL, lbd DECIMAL, lba DECIMAL, bwh DECIMAL, bwd DECIMAL, bwa DECIMAL)
What is the highest home losing odds in Bet365 ever?
SELECT MAX(b365a) FROM football_data
SELECT MAX("b365a") FROM "football_data"
0.039063
CREATE TABLE table_16620 ("No. in series" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Featured character ( s ) " TEXT, "Original air date" TEXT, "U.S. viewers ( million ) " TEXT)
Who wrote all the shows with 18.73 u.s. viewers?
SELECT "Written by" FROM table_16620 WHERE "U.S. viewers (million)" = '18.73'
SELECT "Written by" FROM "table_16620" WHERE "U.S. viewers (million)" = '18.73'
0.077148
CREATE TABLE table_1243601_1 (open_cup VARCHAR, year VARCHAR)
What was the open cup results in 2004?
SELECT open_cup FROM table_1243601_1 WHERE year = "2004"
SELECT "open_cup" FROM "table_1243601_1" WHERE "2004" = "year"
0.060547
CREATE TABLE table_44223 ("Episode" FLOAT, "Title" TEXT, "Writer" TEXT, "Director" TEXT, "Original Airdate" TEXT)
Which Director has an Episode of 13?
SELECT "Director" FROM table_44223 WHERE "Episode" = '13'
SELECT "Director" FROM "table_44223" WHERE "Episode" = '13'
0.057617
CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_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) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees who do not work in departments with managers that have ids between 100 and 200, visualize a bar chart about the distribution of phone_number and commission_pct .
SELECT PHONE_NUMBER, COMMISSION_PCT FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200)
SELECT "PHONE_NUMBER", "COMMISSION_PCT" FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100)
0.174805
CREATE TABLE table_name_3 (home_team VARCHAR, away_team VARCHAR)
What was the home team when the away team was Frickley Athletic?
SELECT home_team FROM table_name_3 WHERE away_team = "frickley athletic"
SELECT "home_team" FROM "table_name_3" WHERE "away_team" = "frickley athletic"
0.076172
CREATE TABLE table_dev_6 ("id" INT, "gender" TEXT, "systolic_blood_pressure_sbp" INT, "heart_disease" BOOLEAN, "renal_disease" BOOLEAN, "hematocrit_hct" FLOAT, "creatinine_clearance_cl" FLOAT, "diastolic_blood_pressure_dbp" INT, "symptomatic_coronary_artery_disease" BOOLEAN, "hypertension" BOOLEAN, "myocardial_infarction" BOOLEAN, "NOUSE" FLOAT)
uncontrolled hypertension ( resting blood pressure > 140 / 90 )
SELECT * FROM table_dev_6 WHERE hypertension = 1 OR systolic_blood_pressure_sbp > 140 OR diastolic_blood_pressure_dbp > 90
SELECT * FROM "table_dev_6" WHERE "diastolic_blood_pressure_dbp" > 90 OR "hypertension" = 1 OR "systolic_blood_pressure_sbp" > 140
0.126953
CREATE TABLE table_name_53 (championship VARCHAR, opponent VARCHAR)
During what Championship was the Opponent Jeff Borowiak?
SELECT championship FROM table_name_53 WHERE opponent = "jeff borowiak"
SELECT "championship" FROM "table_name_53" WHERE "jeff borowiak" = "opponent"
0.075195
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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is the number of patients who has government insurance and with procedure 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.insurance = "Government" 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 "Government" = "demographic"."insurance"
0.239258
CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category 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 program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) 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 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 ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) 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_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 jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) 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 area (course_id INT, area VARCHAR)
How long has the university been offering LHSP 299 ?
SELECT DISTINCT semester.year FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'LHSP' AND course.number = 299 AND semester.semester_id = course_offering.semester ORDER BY semester.year LIMIT 1
SELECT DISTINCT "semester"."year" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" WHERE "course"."department" = 'LHSP' AND "course"."number" = 299 ORDER BY "semester"."year" NULLS FIRST LIMIT 1
0.305664
CREATE TABLE table_39423 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Time ( ET ) " TEXT, "Game site" TEXT, "Result" TEXT, "Record" TEXT)
What is the record of the game on week 13?
SELECT "Record" FROM table_39423 WHERE "Week" = '13'
SELECT "Record" FROM "table_39423" WHERE "Week" = '13'
0.052734
CREATE TABLE table_204_277 (id DECIMAL, "region" TEXT, "country" TEXT, "location" TEXT, "size ( m ) " TEXT, "payload ( metric tonnes ) " TEXT, "degrees of freedom" DECIMAL, "x horiz disp ( mm ) " DECIMAL, "y horiz disp ( mm ) " DECIMAL, "z vert disp ( mm ) " DECIMAL, "x horiz vel ( mm/s ) " DECIMAL, "y horiz vel ( mm/s ) " DECIMAL, "z vert vel ( mm/s ) " DECIMAL, "x horiz accel ( m/s2 ) " DECIMAL, "y horiz accel ( m/s2 ) " DECIMAL, "z vert accel ( m/s2 ) " DECIMAL, "max freq ( hz ) " TEXT, "details checked" TEXT)
what country is last on the list ?
SELECT "country" FROM table_204_277 ORDER BY id DESC LIMIT 1
SELECT "country" FROM "table_204_277" ORDER BY "id" DESC NULLS LAST LIMIT 1
0.073242
CREATE TABLE table_1590967_6 (episode_number VARCHAR, coat_of_cash_wearing_celebrity VARCHAR)
Name the total number of episodes for coat of cash wearing celebrity is matt di angelo
SELECT COUNT(episode_number) FROM table_1590967_6 WHERE coat_of_cash_wearing_celebrity = "Matt Di Angelo"
SELECT COUNT("episode_number") FROM "table_1590967_6" WHERE "Matt Di Angelo" = "coat_of_cash_wearing_celebrity"
0.108398
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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)
How many patients who passed away in or before 2168 were white russian?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND demographic.dod_year <= "2168.0"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2168.0" >= "demographic"."dod_year" AND "WHITE - RUSSIAN" = "demographic"."ethnicity"
0.157227
CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE 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 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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
100 ( ).
SELECT COUNT(*) FROM (SELECT DISTINCT OwnerUserId FROM Posts GROUP BY OwnerUserId, YEAR(CreationDate) HAVING COUNT(Id) >= 100) AS t1
WITH "t1" AS (SELECT DISTINCT "OwnerUserId" FROM "Posts" GROUP BY "OwnerUserId", YEAR("CreationDate") HAVING COUNT("Id") >= 100) SELECT COUNT(*) FROM "t1" AS "t1"
0.158203
CREATE TABLE table_63499 ("Year" FLOAT, "1st Place Team" TEXT, "2nd Place Team" TEXT, "3rd Place Team" TEXT, "4th Place Team" TEXT, "Host Location" TEXT)
Who was the 2nd place team when the location was Tulsa, OK before 1956?
SELECT "2nd Place Team" FROM table_63499 WHERE "Host Location" = 'tulsa, ok' AND "Year" < '1956'
SELECT "2nd Place Team" FROM "table_63499" WHERE "Host Location" = 'tulsa, ok' AND "Year" < '1956'
0.095703
CREATE TABLE table_24486462_1 (country VARCHAR, compulsory_deduction VARCHAR)
What country has a compulsory deduction of 29.3%?
SELECT country FROM table_24486462_1 WHERE compulsory_deduction = "29.3%"
SELECT "country" FROM "table_24486462_1" WHERE "29.3%" = "compulsory_deduction"
0.077148
CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE 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 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 food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight 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 time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
what flights leave DENVER before 1200 on NW
SELECT DISTINCT flight.flight_id FROM airport_service, city, flight WHERE (city.city_code = airport_service.city_code AND city.city_name = 'DENVER' AND flight.departure_time < 1200 AND flight.from_airport = airport_service.airport_code) AND flight.airline_code = 'NW'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" JOIN "city" ON "airport_service"."city_code" = "city"."city_code" AND "city"."city_name" = 'DENVER' JOIN "flight" ON "airport_service"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'NW' AND "flight"."departure_time" < 1200
0.299805
CREATE TABLE table_name_16 (player VARCHAR, no_s_ VARCHAR, school_club_team_country VARCHAR)
Which player from Oregon used the number 12?
SELECT player FROM table_name_16 WHERE no_s_ = "12" AND school_club_team_country = "oregon"
SELECT "player" FROM "table_name_16" WHERE "12" = "no_s_" AND "oregon" = "school_club_team_country"
0.09668
CREATE TABLE table_name_72 (name VARCHAR, rank VARCHAR)
Who is at rank 9?
SELECT name FROM table_name_72 WHERE rank = 9
SELECT "name" FROM "table_name_72" WHERE "rank" = 9
0.049805
CREATE TABLE table_name_85 (class VARCHAR, vessel_name VARCHAR)
What is the class of vessel of the ship Hyundai Smart?
SELECT class FROM table_name_85 WHERE vessel_name = "hyundai smart"
SELECT "class" FROM "table_name_85" WHERE "hyundai smart" = "vessel_name"
0.071289
CREATE TABLE table_20317 ("Series #" FLOAT, "Season #" FLOAT, "Title" TEXT, "Directed by:" TEXT, "Written by:" TEXT, "Original air date" TEXT)
What is the title of the first episode of the season that begin on february 27, 1954?
SELECT "Title" FROM table_20317 WHERE "Original air date" = 'February 27, 1954'
SELECT "Title" FROM "table_20317" WHERE "Original air date" = 'February 27, 1954'
0.079102
CREATE TABLE editor (Name VARCHAR, Age VARCHAR)
List the names of editors in ascending order of age.
SELECT Name FROM editor ORDER BY Age
SELECT "Name" FROM "editor" ORDER BY "Age" NULLS FIRST
0.052734
CREATE TABLE Transactions_Lots (transaction_id INT, lot_id INT) CREATE TABLE Purchases (purchase_transaction_id INT, purchase_details VARCHAR) CREATE TABLE Transactions (transaction_id INT, investor_id INT, transaction_type_code VARCHAR, date_of_transaction DATETIME, amount_of_transaction DECIMAL, share_count VARCHAR, other_details VARCHAR) CREATE TABLE Sales (sales_transaction_id INT, sales_details VARCHAR) CREATE TABLE Investors (investor_id INT, Investor_details VARCHAR) CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR, transaction_type_description VARCHAR) CREATE TABLE Lots (lot_id INT, investor_id INT, lot_details VARCHAR)
Show all dates of transactions whose type code is 'SALE', and count them by a line chart, and display by the x-axis from high to low.
SELECT date_of_transaction, COUNT(date_of_transaction) FROM Transactions WHERE transaction_type_code = "SALE" ORDER BY date_of_transaction DESC
SELECT "date_of_transaction", COUNT("date_of_transaction") FROM "Transactions" WHERE "SALE" = "transaction_type_code" ORDER BY "date_of_transaction" DESC NULLS LAST
0.160156
CREATE TABLE table_25711913_8 (touchdowns INT, position VARCHAR)
How many touchdowns did the fullback score?
SELECT MIN(touchdowns) FROM table_25711913_8 WHERE position = "Fullback"
SELECT MIN("touchdowns") FROM "table_25711913_8" WHERE "Fullback" = "position"
0.076172
CREATE TABLE table_name_59 (game_site VARCHAR, week VARCHAR)
Where did they have the divisional playoffs?
SELECT game_site FROM table_name_59 WHERE week = "divisional playoffs"
SELECT "game_site" FROM "table_name_59" WHERE "divisional playoffs" = "week"
0.074219
CREATE TABLE table_6588 ("Release date" TEXT, "Length" TEXT, "Director ( s ) " TEXT, "Character name" TEXT, "Character type" TEXT, "Leading lady" TEXT)
What is the character name that has phyllis welch as the leading lady?
SELECT "Character name" FROM table_6588 WHERE "Leading lady" = 'phyllis welch'
SELECT "Character name" FROM "table_6588" WHERE "Leading lady" = 'phyllis welch'
0.078125
CREATE TABLE table_70834 ("Name" TEXT, "Frequency" TEXT, "Language" TEXT, "City" TEXT, "Website" TEXT)
What is the name of the newspaper with the website liderinformativo.com ?
SELECT "Name" FROM table_70834 WHERE "Website" = 'liderinformativo.com'
SELECT "Name" FROM "table_70834" WHERE "Website" = 'liderinformativo.com'
0.071289
CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) 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) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR)
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 hire_date and the average of employee_id bin hire_date by time, show in desc by the total number.
SELECT HIRE_DATE, AVG(EMPLOYEE_ID) FROM employees WHERE NOT DEPARTMENT_ID IN (SELECT DEPARTMENT_ID FROM departments WHERE MANAGER_ID BETWEEN 100 AND 200) ORDER BY AVG(EMPLOYEE_ID) DESC
SELECT "HIRE_DATE", AVG("EMPLOYEE_ID") FROM "employees" WHERE NOT "DEPARTMENT_ID" IN (SELECT "DEPARTMENT_ID" FROM "departments" WHERE "MANAGER_ID" <= 200 AND "MANAGER_ID" >= 100) ORDER BY AVG("EMPLOYEE_ID") DESC NULLS LAST
0.216797
CREATE TABLE table_name_57 (attendance INT, opponent VARCHAR)
What is the average attendance against the expos?
SELECT AVG(attendance) FROM table_name_57 WHERE opponent = "expos"
SELECT AVG("attendance") FROM "table_name_57" WHERE "expos" = "opponent"
0.070313
CREATE TABLE table_29196086_4 (no_in_season INT, original_air_date VARCHAR)
which episode of the season aired on october20,2012
SELECT MAX(no_in_season) FROM table_29196086_4 WHERE original_air_date = "October20,2012"
SELECT MAX("no_in_season") FROM "table_29196086_4" WHERE "October20,2012" = "original_air_date"
0.092773
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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) 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 intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
when was the first time that patient 016-26907 had volume (ml) dopamine intake until 11/22/2102?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '016-26907')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'volume (ml) dopamine' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) <= '2102-11-22' ORDER BY intakeoutput.intakeoutputtime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '016-26907' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "intakeoutput"."intakeoutputtime" FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'volume (ml) dopamine' AND "intakeoutput"."cellpath" LIKE '%intake%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") <= '2102-11-22' ORDER BY "intakeoutput"."intakeoutputtime" NULLS FIRST LIMIT 1
0.746094
CREATE TABLE table_41402 ("Date" TEXT, "Tournament" TEXT, "Winning score" TEXT, "Margin of victory" TEXT, "Runner ( s ) -up" TEXT)
By how many strokes did Lema beat Jack Nicklaus?
SELECT "Margin of victory" FROM table_41402 WHERE "Runner(s)-up" = 'jack nicklaus'
SELECT "Margin of victory" FROM "table_41402" WHERE "Runner(s)-up" = 'jack nicklaus'
0.082031
CREATE TABLE table_203_56 (id DECIMAL, "star" TEXT, "start\ year" DECIMAL, "end\ year" DECIMAL, "maximum\ year" DECIMAL, "maximum\ magnitude" DECIMAL, "distance at\ maximum ( ly ) " DECIMAL, "current\ distance" DECIMAL, "current\ magnitude" DECIMAL)
which star has the highest distance at maximum ?
SELECT "star" FROM table_203_56 ORDER BY "distance at\nmaximum (ly)" DESC LIMIT 1
SELECT "star" FROM "table_203_56" ORDER BY "distance at\nmaximum (ly)" DESC NULLS LAST LIMIT 1
0.091797
CREATE TABLE table_23872 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Tar Heels points" FLOAT, "Opponents" FLOAT, "Record" TEXT)
How many games were against Furman?
SELECT MAX("Game") FROM table_23872 WHERE "Opponent" = 'Furman'
SELECT MAX("Game") FROM "table_23872" WHERE "Opponent" = 'Furman'
0.063477
CREATE TABLE table_name_2 (date VARCHAR, score VARCHAR)
What was the date of the game with a score of W 106-100?
SELECT date FROM table_name_2 WHERE score = "w 106-100"
SELECT "date" FROM "table_name_2" WHERE "score" = "w 106-100"
0.05957
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, a bar chart shows the distribution of name and the average of code , and group by attribute name, list from low to high by the y axis.
SELECT T1.Name, T1.Code FROM Products AS T1 JOIN Manufacturers AS T2 ON T1.Manufacturer = T2.Code GROUP BY T1.Name ORDER BY T1.Code
SELECT "T1"."Name", "T1"."Code" FROM "Products" AS "T1" JOIN "Manufacturers" AS "T2" ON "T1"."Manufacturer" = "T2"."Code" GROUP BY "T1"."Name" ORDER BY "T1"."Code" NULLS FIRST
0.170898
CREATE TABLE table_1300525_1 (population VARCHAR, pinyin VARCHAR)
How many people live in the district who's capital is h ngf ng xi n?
SELECT population FROM table_1300525_1 WHERE pinyin = "Héngfēng Xiàn"
SELECT "population" FROM "table_1300525_1" WHERE "Héngfēng Xiàn" = "pinyin"
0.073242
CREATE TABLE table_name_49 (redline__rpm_ INT, engine_code VARCHAR, year VARCHAR)
What is the average Redline RPM of engines with engine code M57TUD30, made after 2002?
SELECT AVG(redline__rpm_) FROM table_name_49 WHERE engine_code = "m57tud30" AND year > 2002
SELECT AVG("redline__rpm_") FROM "table_name_49" WHERE "engine_code" = "m57tud30" AND "year" > 2002
0.09668
CREATE TABLE visitors (tourist_id DECIMAL, tourist_details TEXT) CREATE TABLE shops (shop_id DECIMAL, shop_details TEXT) CREATE TABLE street_markets (market_id DECIMAL, market_details TEXT) CREATE TABLE ref_attraction_types (attraction_type_code TEXT, attraction_type_description TEXT) 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 museums (museum_id DECIMAL, museum_details TEXT) CREATE TABLE royal_family (royal_family_id DECIMAL, royal_family_details TEXT) CREATE TABLE tourist_attraction_features (tourist_attraction_id DECIMAL, feature_id DECIMAL) CREATE TABLE visits (visit_id DECIMAL, tourist_attraction_id DECIMAL, tourist_id DECIMAL, visit_date TIME, visit_details TEXT) CREATE TABLE locations (location_id DECIMAL, location_name TEXT, address TEXT, other_details TEXT) CREATE TABLE staff (staff_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, other_details TEXT) CREATE TABLE theme_parks (theme_park_id DECIMAL, theme_park_details TEXT) CREATE TABLE features (feature_id DECIMAL, feature_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 ref_hotel_star_ratings (star_rating_code TEXT, star_rating_description TEXT) CREATE TABLE photos (photo_id DECIMAL, tourist_attraction_id DECIMAL, name TEXT, description TEXT, filename TEXT, other_details TEXT)
Find the names of the tourist attractions that is either accessible by walk or at address 660 Shea Crescent.
SELECT T2.name FROM locations AS T1 JOIN tourist_attractions AS T2 ON T1.location_id = T2.location_id WHERE T1.address = "660 Shea Crescent" OR T2.how_to_get_there = "walk"
SELECT "T2"."name" FROM "locations" AS "T1" JOIN "tourist_attractions" AS "T2" ON ("660 Shea Crescent" = "T1"."address" OR "T2"."how_to_get_there" = "walk") AND "T1"."location_id" = "T2"."location_id"
0.195313
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE 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 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
have there been any microbiology tests for patient 90663 on their current hospital visit?
SELECT COUNT(*) > 0 FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663 AND admissions.dischtime IS NULL)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 90663 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "microbiologyevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "microbiologyevents"."hadm_id" WHERE NOT "_u_0"."" IS NULL
0.299805
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name 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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT)
was patient 82159 receiving until 05/2104 any medication?
SELECT COUNT(*) > 0 FROM prescriptions WHERE prescriptions.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 82159) AND STRFTIME('%y-%m', prescriptions.startdate) <= '2104-05'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 82159 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "prescriptions" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "prescriptions"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "prescriptions"."startdate") <= '2104-05'
0.316406
CREATE TABLE table_1733457_1 (bush_percentage VARCHAR, others_number VARCHAR)
Name the bush% for where others # is 90
SELECT bush_percentage FROM table_1733457_1 WHERE others_number = 90
SELECT "bush_percentage" FROM "table_1733457_1" WHERE "others_number" = 90
0.072266
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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 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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE 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 diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
what is the maximum value of the heart rate of patient 10431 until 1941 days ago?
SELECT MAX(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 10431)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'heart rate' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) <= DATETIME(CURRENT_TIME(), '-1941 day')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 10431 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'heart rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT MAX("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime") <= DATETIME(CURRENT_TIME(), '-1941 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.753906
CREATE TABLE table_37092 ("Weight Division" TEXT, "Winner" TEXT, "Loser" TEXT, "Method" TEXT, "Round" FLOAT, "Time" TEXT)
What win method has a time of 2:32?
SELECT "Method" FROM table_37092 WHERE "Time" = '2:32'
SELECT "Method" FROM "table_37092" WHERE "Time" = '2:32'
0.054688
CREATE TABLE table_9777 ("Rank" FLOAT, "Peak Name" TEXT, "Elevation ( ft ) " FLOAT, "Range" TEXT, "Isolation" FLOAT)
WHAT IS THE RANGE WITH ISOLATION SMALLER THAN 2.35, RANK LARGER THAN 38, ELEVATION GREATER THAN 6,080, AND NAMED PLOTT BALSAM?
SELECT "Range" FROM table_9777 WHERE "Isolation" < '2.35' AND "Rank" > '38' AND "Elevation (ft)" > '6,080' AND "Peak Name" = 'plott balsam'
SELECT "Range" FROM "table_9777" WHERE "Elevation (ft)" > '6,080' AND "Isolation" < '2.35' AND "Peak Name" = 'plott balsam' AND "Rank" > '38'
0.137695