schema
stringlengths 28
6.63k
| question
stringlengths 0
990
| rejected
stringlengths 2
4.44k
| chosen
stringlengths 4
9.17k
| weight
float64 0
8.95
|
---|---|---|---|---|
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE PostTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress VARCHAR(MAX))
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name VARCHAR(MAX), Body VARCHAR(MAX), IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle VARCHAR(MAX), MarkdownInputGuidance VARCHAR(MAX), MarkdownPostOwnerGuidance VARCHAR(MAX), MarkdownPrivilegedUserGuidance VARCHAR(MAX), MarkdownConcensusDescription VARCHAR(MAX), CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE FlagTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment VARCHAR(MAX), Text VARCHAR(MAX), Title VARCHAR(MAX), Tags VARCHAR(MAX), RevisionGUID other)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body VARCHAR(MAX), OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name VARCHAR(MAX), Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment VARCHAR(MAX))
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName VARCHAR(MAX), LastAccessDate TIME, WebsiteUrl VARCHAR(MAX), Location VARCHAR(MAX), AboutMe VARCHAR(MAX), Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl VARCHAR(MAX), EmailHash VARCHAR(MAX), AccountId DECIMAL)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName VARCHAR(MAX), TargetTagName VARCHAR(MAX), CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName VARCHAR(MAX), Comment VARCHAR(MAX), Text VARCHAR(MAX), ContentLicense VARCHAR(MAX))
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX), PostTypeId DECIMAL)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text VARCHAR(MAX), CreationDate TIME, UserDisplayName VARCHAR(MAX), UserId DECIMAL, ContentLicense VARCHAR(MAX))
CREATE TABLE VoteTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE Tags (Id DECIMAL, TagName VARCHAR(MAX), Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
| Top 10 users based on repo and upvotes. | SELECT DisplayName, LastAccessDate, Reputation, UpVotes, DownVotes FROM Users ORDER BY Reputation DESC, UpVotes DESC LIMIT 10 | SELECT "DisplayName", "LastAccessDate", "Reputation", "UpVotes", "DownVotes" FROM "Users" ORDER BY "Reputation" DESC NULLS LAST, "UpVotes" DESC NULLS LAST LIMIT 10 | 0.15918 |
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 regions (REGION_ID DECIMAL, REGION_NAME VARCHAR)
CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
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 jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
| Give me a bar chart that groups and count the job id for all employees in the Finance department, and rank by the y-axis in descending. | SELECT JOB_ID, COUNT(JOB_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID WHERE T2.DEPARTMENT_NAME = 'Finance' GROUP BY JOB_ID ORDER BY COUNT(JOB_ID) DESC | SELECT "JOB_ID", COUNT("JOB_ID") FROM "employees" AS "T1" JOIN "departments" AS "T2" ON "T1"."department_id" = "T2"."department_id" AND "T2"."department_name" = 'Finance' GROUP BY "JOB_ID" ORDER BY COUNT("JOB_ID") DESC NULLS LAST | 0.223633 |
CREATE TABLE table_name_12 (team VARCHAR, class VARCHAR, points VARCHAR, year VARCHAR)
| Name the Team which has Points larger than 9, and a Year larger than 1971, and a Class of 250cc? | SELECT team FROM table_name_12 WHERE points > 9 AND year > 1971 AND class = "250cc" | SELECT "team" FROM "table_name_12" WHERE "250cc" = "class" AND "points" > 9 AND "year" > 1971 | 0.09082 |
CREATE TABLE table_7039 ("Year" REAL, "Dates" VARCHAR(MAX), "Champion" VARCHAR(MAX), "Country" VARCHAR(MAX), "Score" VARCHAR(MAX), "Margin of victory" VARCHAR(MAX), "Tournament Location" VARCHAR(MAX), "Purse ( US$ ) " REAL, "Winner's share" REAL)
| Which county has 2011 as the year? | SELECT "Country" FROM table_7039 WHERE "Year" = '2011' | SELECT "Country" FROM "table_7039" WHERE "Year" = '2011' | 0.054688 |
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 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 jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL)
CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL)
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL)
| Compute the number of each type of job ids for employees who make more than the highest-earning employee with title PU_MAN, with a bar chart, and rank by the bars from low to high. | SELECT JOB_ID, COUNT(JOB_ID) FROM employees WHERE SALARY > (SELECT MAX(SALARY) FROM employees WHERE JOB_ID = 'PU_MAN') GROUP BY JOB_ID ORDER BY JOB_ID | SELECT "JOB_ID", COUNT("JOB_ID") FROM "employees" WHERE "SALARY" > (SELECT MAX("SALARY") FROM "employees" WHERE "JOB_ID" = 'PU_MAN') GROUP BY "JOB_ID" ORDER BY "JOB_ID" NULLS FIRST | 0.175781 |
CREATE TABLE university (School_ID INTEGER, School VARCHAR(MAX), Location VARCHAR(MAX), Founded REAL, Affiliation VARCHAR(MAX), Enrollment REAL, Nickname VARCHAR(MAX), Primary_conference VARCHAR(MAX))
CREATE TABLE basketball_match (Team_ID INTEGER, School_ID INTEGER, Team_Name VARCHAR(MAX), ACC_Regular_Season VARCHAR(MAX), ACC_Percent VARCHAR(MAX), ACC_Home VARCHAR(MAX), ACC_Road VARCHAR(MAX), All_Games VARCHAR(MAX), All_Games_Percent INTEGER, All_Home VARCHAR(MAX), All_Road VARCHAR(MAX), All_Neutral VARCHAR(MAX))
| Give me the comparison about School_ID over the All_Neutral by a bar chart, and I want to display bar in ascending order. | SELECT All_Neutral, School_ID FROM basketball_match ORDER BY All_Neutral | SELECT "All_Neutral", "School_ID" FROM "basketball_match" ORDER BY "All_Neutral" NULLS FIRST | 0.089844 |
CREATE TABLE table_17435 ("#" REAL, "President" VARCHAR(MAX), "Date of birth" VARCHAR(MAX), "Date of inauguration" VARCHAR(MAX), "Age at inauguration" VARCHAR(MAX), "End of term" VARCHAR(MAX), "Length of retirement" VARCHAR(MAX), "Date of death" VARCHAR(MAX), "Lifespan" VARCHAR(MAX))
| who is the the president with date of inauguration being 4june1979 | SELECT "President" FROM table_17435 WHERE "Date of inauguration" = '4June1979' | SELECT "President" FROM "table_17435" WHERE "Date of inauguration" = '4June1979' | 0.078125 |
CREATE TABLE table_20872722_1 (position VARCHAR, weight VARCHAR)
| Which position has 225lb as weight? | SELECT position FROM table_20872722_1 WHERE weight = "225lb" | SELECT "position" FROM "table_20872722_1" WHERE "225lb" = "weight" | 0.064453 |
CREATE TABLE table_21090 ("Name" VARCHAR(MAX), "Latitude" VARCHAR(MAX), "Longitude" VARCHAR(MAX), "Diameter ( km ) " VARCHAR(MAX), "Year named" REAL, "Name origin" VARCHAR(MAX))
| Name the name origin for 54.0e | SELECT "Name origin" FROM table_21090 WHERE "Longitude" = '54.0E' | SELECT "Name origin" FROM "table_21090" WHERE "Longitude" = '54.0E' | 0.06543 |
CREATE TABLE course (course_id VARCHAR, title VARCHAR, dept_name VARCHAR, credits DECIMAL)
CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR)
CREATE TABLE section (course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, building VARCHAR, room_number VARCHAR, time_slot_id VARCHAR)
CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget DECIMAL)
CREATE TABLE student (ID VARCHAR, name VARCHAR, dept_name VARCHAR, tot_cred DECIMAL)
CREATE TABLE teaches (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL)
CREATE TABLE time_slot (time_slot_id VARCHAR, day VARCHAR, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL)
CREATE TABLE takes (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, grade VARCHAR)
CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity DECIMAL)
CREATE TABLE advisor (s_ID VARCHAR, i_ID VARCHAR)
CREATE TABLE instructor (ID VARCHAR, name VARCHAR, dept_name VARCHAR, salary DECIMAL)
| How many courses are provided in each year? binning by year and visualize with a grouping line chart by different semesters . | SELECT year, COUNT(*) FROM section GROUP BY semester | SELECT "year", COUNT(*) FROM "section" GROUP BY "semester" | 0.056641 |
CREATE TABLE table_27496 ("Year" REAL, "Population" REAL, "Index" REAL, "Violent" REAL, "Property" REAL, "Murder" REAL, "Forcible rape" REAL, "Robbery" REAL, "Aggravated assault" REAL, "Burglary" REAL, "Larceny Theft" REAL, "Vehicle Theft" REAL)
| How many violent catagories are listed for the year forcible rapes were 1156? | SELECT COUNT("Violent") FROM table_27496 WHERE "Forcible rape" = '1156' | SELECT COUNT("Violent") FROM "table_27496" WHERE "Forcible rape" = '1156' | 0.071289 |
CREATE TABLE patient (uniquepid VARCHAR(MAX), patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender VARCHAR(MAX), age VARCHAR(MAX), ethnicity VARCHAR(MAX), hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource VARCHAR(MAX), unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus VARCHAR(MAX))
CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname VARCHAR(MAX), diagnosistime TIME, icd9code VARCHAR(MAX))
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname VARCHAR(MAX), labresult DECIMAL, labresulttime TIME)
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname VARCHAR(MAX), 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 cost (costid DECIMAL, uniquepid VARCHAR(MAX), patienthealthsystemstayid DECIMAL, eventtype VARCHAR(MAX), eventid DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath VARCHAR(MAX), celllabel VARCHAR(MAX), cellvaluenumeric DECIMAL, intakeoutputtime TIME)
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname VARCHAR(MAX), dosage VARCHAR(MAX), routeadmin VARCHAR(MAX), drugstarttime TIME, drugstoptime TIME)
CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite VARCHAR(MAX), organism VARCHAR(MAX), culturetakentime TIME)
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname VARCHAR(MAX), allergyname VARCHAR(MAX), allergytime TIME)
| count the number of patients who have received a laboratory cortisol test in 2104. | SELECT COUNT(DISTINCT patient.uniquepid) FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'cortisol' AND STRFTIME('%y', lab.labresulttime) = '2104') | WITH "_u_0" AS (SELECT "lab"."patientunitstayid" FROM "lab" WHERE "lab"."labname" = 'cortisol' AND STRFTIME('%y', "lab"."labresulttime") = '2104' GROUP BY "patientunitstayid") SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL | 0.327148 |
CREATE TABLE table_11474 ("Home team" VARCHAR(MAX), "Home team score" VARCHAR(MAX), "Away team" VARCHAR(MAX), "Away team score" VARCHAR(MAX), "Venue" VARCHAR(MAX), "Crowd" REAL, "Date" VARCHAR(MAX))
| When Richmond is the Away team, what did they score? | SELECT "Away team score" FROM table_11474 WHERE "Away team" = 'richmond' | SELECT "Away team score" FROM "table_11474" WHERE "Away team" = 'richmond' | 0.072266 |
CREATE TABLE table_1590652_4 (no INTEGER, tournament VARCHAR)
| Name the most number when tournament is madrid masters | SELECT MAX(no) FROM table_1590652_4 WHERE tournament = "Madrid Masters" | SELECT MAX("no") FROM "table_1590652_4" WHERE "Madrid Masters" = "tournament" | 0.075195 |
CREATE TABLE table_name_40 (pick VARCHAR, round VARCHAR, player VARCHAR)
| Which pick's round was 5 when Kellen Davis was a player? | SELECT pick FROM table_name_40 WHERE round = "5" AND player = "kellen davis" | SELECT "pick" FROM "table_name_40" WHERE "5" = "round" AND "kellen davis" = "player" | 0.082031 |
CREATE TABLE table_77424 ("Place" VARCHAR(MAX), "Player" VARCHAR(MAX), "Country" VARCHAR(MAX), "Score" VARCHAR(MAX), "To par" REAL, "Money ( $ ) " REAL)
| What is the highest To Par, when Place is '1'? | SELECT MAX("To par") FROM table_77424 WHERE "Place" = '1' | SELECT MAX("To par") FROM "table_77424" WHERE "Place" = '1' | 0.057617 |
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment VARCHAR(MAX), Text VARCHAR(MAX), Title VARCHAR(MAX), Tags VARCHAR(MAX), RevisionGUID other)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body VARCHAR(MAX), OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName VARCHAR(MAX), Comment VARCHAR(MAX), Text VARCHAR(MAX), ContentLicense VARCHAR(MAX))
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress VARCHAR(MAX))
CREATE TABLE Tags (Id DECIMAL, TagName VARCHAR(MAX), Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment VARCHAR(MAX))
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX), PostTypeId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle VARCHAR(MAX), MarkdownInputGuidance VARCHAR(MAX), MarkdownPostOwnerGuidance VARCHAR(MAX), MarkdownPrivilegedUserGuidance VARCHAR(MAX), MarkdownConcensusDescription VARCHAR(MAX), CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName VARCHAR(MAX), LastAccessDate TIME, WebsiteUrl VARCHAR(MAX), Location VARCHAR(MAX), AboutMe VARCHAR(MAX), Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl VARCHAR(MAX), EmailHash VARCHAR(MAX), AccountId DECIMAL)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text VARCHAR(MAX), CreationDate TIME, UserDisplayName VARCHAR(MAX), UserId DECIMAL, ContentLicense VARCHAR(MAX))
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name VARCHAR(MAX), Body VARCHAR(MAX), IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name VARCHAR(MAX), Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE FlagTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName VARCHAR(MAX), TargetTagName VARCHAR(MAX), CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE VoteTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
| select * from Posts where id = 1. | SELECT * FROM Posts WHERE Id = 1 | SELECT * FROM "Posts" WHERE "Id" = 1 | 0.035156 |
CREATE TABLE table_10129 ("Home team" VARCHAR(MAX), "Home team score" VARCHAR(MAX), "Away team" VARCHAR(MAX), "Away team score" VARCHAR(MAX), "Venue" VARCHAR(MAX), "Crowd" REAL, "Date" VARCHAR(MAX))
| What was total size of the crowd at a home game for north melbourne? | SELECT SUM("Crowd") FROM table_10129 WHERE "Home team" = 'north melbourne' | SELECT SUM("Crowd") FROM "table_10129" WHERE "Home team" = 'north melbourne' | 0.074219 |
CREATE TABLE table_name_57 (champion VARCHAR, runner_up VARCHAR)
| Who was the champion when atl tico wanderers was the runner-up? | SELECT champion FROM table_name_57 WHERE runner_up = "atlético wanderers" | SELECT "champion" FROM "table_name_57" WHERE "atlético wanderers" = "runner_up" | 0.077148 |
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| give me the number of patients whose marital status is married and lab test chart time is 2165-06-23 22:30:00? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.marital_status = "MARRIED" AND lab.charttime = "2165-06-23 22:30:00" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "2165-06-23 22:30:00" = "lab"."charttime" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "MARRIED" = "demographic"."marital_status" | 0.213867 |
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
| count the number of patients whose drug code is vera120sr? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.formulary_drug_cd = "VERA120SR" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "VERA120SR" = "prescriptions"."formulary_drug_cd" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" | 0.193359 |
CREATE TABLE table_35409 ("Year" REAL, "Jewish" REAL, "Muslim" REAL, "Christian" REAL, "Druze" REAL, "Total" REAL)
| What is the average muslim that has a druze less than 2,534, a year prior to 2005, and a jewish greater than 100,657? | SELECT AVG("Muslim") FROM table_35409 WHERE "Druze" < '2,534' AND "Year" = '2005' AND "Jewish" > '100,657' | SELECT AVG("Muslim") FROM "table_35409" WHERE "Druze" < '2,534' AND "Jewish" > '100,657' AND "Year" = '2005' | 0.105469 |
CREATE TABLE table_name_41 (seat_percentage VARCHAR, vote_percentage VARCHAR)
| What seat has a vote percentage of 100.0% | SELECT seat_percentage FROM table_name_41 WHERE vote_percentage = "100.0%" | SELECT "seat_percentage" FROM "table_name_41" WHERE "100.0%" = "vote_percentage" | 0.078125 |
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body VARCHAR(MAX), OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name VARCHAR(MAX), Body VARCHAR(MAX), IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name VARCHAR(MAX), Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE VoteTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment VARCHAR(MAX))
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle VARCHAR(MAX), MarkdownInputGuidance VARCHAR(MAX), MarkdownPostOwnerGuidance VARCHAR(MAX), MarkdownPrivilegedUserGuidance VARCHAR(MAX), MarkdownConcensusDescription VARCHAR(MAX), CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE Tags (Id DECIMAL, TagName VARCHAR(MAX), Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text VARCHAR(MAX), CreationDate TIME, UserDisplayName VARCHAR(MAX), UserId DECIMAL, ContentLicense VARCHAR(MAX))
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX), PostTypeId DECIMAL)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName VARCHAR(MAX), LastAccessDate TIME, WebsiteUrl VARCHAR(MAX), Location VARCHAR(MAX), AboutMe VARCHAR(MAX), Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl VARCHAR(MAX), EmailHash VARCHAR(MAX), AccountId DECIMAL)
CREATE TABLE FlagTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName VARCHAR(MAX), Comment VARCHAR(MAX), Text VARCHAR(MAX), ContentLicense VARCHAR(MAX))
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName VARCHAR(MAX), TargetTagName VARCHAR(MAX), CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment VARCHAR(MAX), Text VARCHAR(MAX), Title VARCHAR(MAX), Tags VARCHAR(MAX), RevisionGUID other)
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress VARCHAR(MAX))
CREATE TABLE PostTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
| Gold badges (sans tag badges). | SELECT UserId AS "user_link", COUNT(*) FROM Badges WHERE Name IN ('Socratic', 'Stellar Question', 'Great Question', 'Famous Question', 'Illuminator', 'Great Answer', 'Populist', 'Reversal', 'Unsung Hero', 'Fanatic', 'Legendary', 'Marshal', 'Constable', 'Sheriff', 'Steward', 'Copy Editor', 'Electorate', 'Publicist') GROUP BY UserId ORDER BY COUNT(*) DESC LIMIT 20 | SELECT "UserId" AS "user_link", COUNT(*) FROM "Badges" WHERE "Name" IN ('Socratic', 'Stellar Question', 'Great Question', 'Famous Question', 'Illuminator', 'Great Answer', 'Populist', 'Reversal', 'Unsung Hero', 'Fanatic', 'Legendary', 'Marshal', 'Constable', 'Sheriff', 'Steward', 'Copy Editor', 'Electorate', 'Publicist') GROUP BY "UserId" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 20 | 0.374023 |
CREATE TABLE table_25691838_6 (original_airdate VARCHAR, episode__number VARCHAR)
| What was the original airdate of episode #733? | SELECT original_airdate FROM table_25691838_6 WHERE episode__number = 733 | SELECT "original_airdate" FROM "table_25691838_6" WHERE "episode__number" = 733 | 0.077148 |
CREATE TABLE table_36853 ("City" VARCHAR(MAX), "State/Territory" VARCHAR(MAX), "IATA" VARCHAR(MAX), "ICAO" VARCHAR(MAX), "Airport" VARCHAR(MAX), "Begin" VARCHAR(MAX))
| Which airport has perth as the city? | SELECT "Airport" FROM table_36853 WHERE "City" = 'perth' | SELECT "Airport" FROM "table_36853" WHERE "City" = 'perth' | 0.056641 |
CREATE TABLE table_55513 ("Driver" VARCHAR(MAX), "Constructor" VARCHAR(MAX), "Laps" REAL, "Time/Retired" VARCHAR(MAX), "Grid" REAL)
| what is the laps when the grid is less than 2? | SELECT "Laps" FROM table_55513 WHERE "Grid" < '2' | SELECT "Laps" FROM "table_55513" WHERE "Grid" < '2' | 0.049805 |
CREATE TABLE Transactions (transaction_id INTEGER, investor_id INTEGER, transaction_type_code VARCHAR, date_of_transaction TIMESTAMP, amount_of_transaction DECIMAL, share_count VARCHAR, other_details VARCHAR)
CREATE TABLE Ref_Transaction_Types (transaction_type_code VARCHAR, transaction_type_description VARCHAR)
CREATE TABLE Purchases (purchase_transaction_id INTEGER, purchase_details VARCHAR)
CREATE TABLE Lots (lot_id INTEGER, investor_id INTEGER, lot_details VARCHAR)
CREATE TABLE Transactions_Lots (transaction_id INTEGER, lot_id INTEGER)
CREATE TABLE Investors (investor_id INTEGER, Investor_details VARCHAR)
CREATE TABLE Sales (sales_transaction_id INTEGER, sales_details VARCHAR)
| Bin all date of transactions into the weekday interval, and compute the average of the share count for each bin Return the result using a bar chart, show in ascending by the total number please. | SELECT date_of_transaction, AVG(share_count) FROM Transactions ORDER BY AVG(share_count) | SELECT "date_of_transaction", AVG("share_count") FROM "Transactions" ORDER BY AVG("share_count") NULLS FIRST | 0.105469 |
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
| count the maximum days of hospital stay for patients aged 64 and above . | SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.age >= "64" | SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "64" <= "demographic"."age" | 0.087891 |
CREATE TABLE table_58104 ("Year" REAL, "Driver" VARCHAR(MAX), "Constructor" VARCHAR(MAX), "Location" VARCHAR(MAX), "Report" VARCHAR(MAX))
| What was the constructor of the car that Hermann Lang drove after 1935? | SELECT "Constructor" FROM table_58104 WHERE "Year" > '1935' AND "Driver" = 'hermann lang' | SELECT "Constructor" FROM "table_58104" WHERE "Driver" = 'hermann lang' AND "Year" > '1935' | 0.088867 |
CREATE TABLE table_name_99 (attendance INTEGER, venue VARCHAR, series VARCHAR)
| Name the most that attendend when the venue was td banknorth garden and the series of montreal leads 3-1 | SELECT MAX(attendance) FROM table_name_99 WHERE venue = "td banknorth garden" AND series = "montreal leads 3-1" | SELECT MAX("attendance") FROM "table_name_99" WHERE "montreal leads 3-1" = "series" AND "td banknorth garden" = "venue" | 0.116211 |
CREATE TABLE table_11058032_1 (no_in_series VARCHAR, us_viewers__millions_ VARCHAR)
| How many episodes had 16.03 million viewers? | SELECT COUNT(no_in_series) FROM table_11058032_1 WHERE us_viewers__millions_ = "16.03" | SELECT COUNT("no_in_series") FROM "table_11058032_1" WHERE "16.03" = "us_viewers__millions_" | 0.089844 |
CREATE TABLE table_20275 ("Name" VARCHAR(MAX), "Overs Bowled" VARCHAR(MAX), "Maidens" REAL, "Runs Conceded" REAL, "Wickets" REAL, "Extras" REAL, "E.R." VARCHAR(MAX))
| Name the wickets when overs bowled is 9 | SELECT "Wickets" FROM table_20275 WHERE "Overs Bowled" = '9' | SELECT "Wickets" FROM "table_20275" WHERE "Overs Bowled" = '9' | 0.060547 |
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
| look for the number of patients taking drug via pr route who were admitted before 2155. | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.admityear < "2155" AND prescriptions.route = "PR" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "PR" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "2155" > "demographic"."admityear" | 0.214844 |
CREATE TABLE table_13483 ("Place" VARCHAR(MAX), "Player" VARCHAR(MAX), "Country" VARCHAR(MAX), "Score" REAL, "To par" VARCHAR(MAX))
| What player has a score less than 66, and a Place of t2, in the United States? | SELECT "Player" FROM table_13483 WHERE "Score" < '66' AND "Place" = 't2' AND "Country" = 'united states' | SELECT "Player" FROM "table_13483" WHERE "Country" = 'united states' AND "Place" = 't2' AND "Score" < '66' | 0.103516 |
CREATE TABLE table_name_95 (date VARCHAR, record VARCHAR)
| On what date was the Record 41 32 6? | SELECT date FROM table_name_95 WHERE record = "41–32–6" | SELECT "date" FROM "table_name_95" WHERE "41–32–6" = "record" | 0.05957 |
CREATE TABLE has_amenity (dormid VARCHAR, amenid VARCHAR)
CREATE TABLE dorm_amenity (amenid VARCHAR)
CREATE TABLE dorm (dorm_name VARCHAR, student_capacity VARCHAR, dormid VARCHAR)
| Find the name and capacity of the dorm with least number of amenities. | SELECT T1.dorm_name, T1.student_capacity FROM dorm AS T1 JOIN has_amenity AS T2 ON T1.dormid = T2.dormid JOIN dorm_amenity AS T3 ON T2.amenid = T3.amenid GROUP BY T2.dormid ORDER BY COUNT(*) LIMIT 1 | SELECT "T1"."dorm_name", "T1"."student_capacity" FROM "dorm" AS "T1" JOIN "has_amenity" AS "T2" ON "T1"."dormid" = "T2"."dormid" JOIN "dorm_amenity" AS "T3" ON "T2"."amenid" = "T3"."amenid" GROUP BY "T2"."dormid" ORDER BY COUNT(*) NULLS FIRST LIMIT 1 | 0.244141 |
CREATE TABLE table_16071 ("Round" REAL, "Choice" REAL, "Overall" REAL, "Player name" VARCHAR(MAX), "Position" VARCHAR(MAX), "College" VARCHAR(MAX))
| Where is the college where Keith Hartwig plays? | SELECT "College" FROM table_16071 WHERE "Player name" = 'Keith Hartwig' | SELECT "College" FROM "table_16071" WHERE "Player name" = 'Keith Hartwig' | 0.071289 |
CREATE TABLE table_name_62 (gold INTEGER, silver VARCHAR, total VARCHAR, rank VARCHAR)
| What is the lowest amount of gold a team with less than 2 total medals, ranked 17, and more than 0 silver medals, has? | SELECT MIN(gold) FROM table_name_62 WHERE total < 2 AND rank = 17 AND silver > 0 | SELECT MIN("gold") FROM "table_name_62" WHERE "rank" = 17 AND "silver" > 0 AND "total" < 2 | 0.087891 |
CREATE TABLE table_name_76 (tally VARCHAR, opposition VARCHAR)
| Name the Tally of an Opposition of westmeath? | SELECT tally FROM table_name_76 WHERE opposition = "westmeath" | SELECT "tally" FROM "table_name_76" WHERE "opposition" = "westmeath" | 0.066406 |
CREATE TABLE table_name_25 (incorporated INTEGER, company VARCHAR)
| What is the average incorporataed year of the Air India Charters company? | SELECT AVG(incorporated) FROM table_name_25 WHERE company = "air india charters" | SELECT AVG("incorporated") FROM "table_name_25" WHERE "air india charters" = "company" | 0.083984 |
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
| how many patients whose primary disease is gangrene? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "GANGRENE" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "GANGRENE" = "demographic"."diagnosis" | 0.110352 |
CREATE TABLE table_46459 ("Date" VARCHAR(MAX), "Visitor" VARCHAR(MAX), "Score" VARCHAR(MAX), "Home" VARCHAR(MAX), "Attendance" REAL, "Record" VARCHAR(MAX), "Points" REAL)
| What was the score of the game where Philadelphia was the visitor? | SELECT "Score" FROM table_46459 WHERE "Visitor" = 'philadelphia' | SELECT "Score" FROM "table_46459" WHERE "Visitor" = 'philadelphia' | 0.064453 |
CREATE TABLE table_51654 ("Race" VARCHAR(MAX), "Circuit" VARCHAR(MAX), "Date" VARCHAR(MAX), "Pole position" VARCHAR(MAX), "Fastest lap" VARCHAR(MAX), "Winning driver" VARCHAR(MAX), "Constructor" VARCHAR(MAX), "Tyre" VARCHAR(MAX), "Report" VARCHAR(MAX))
| Which race did Alberto Ascari have both the Pole position and the win, but Luigi Villoresi set the fastest lap time? | SELECT "Race" FROM table_51654 WHERE "Pole position" = 'alberto ascari' AND "Winning driver" = 'alberto ascari' AND "Fastest lap" = 'luigi villoresi' | SELECT "Race" FROM "table_51654" WHERE "Fastest lap" = 'luigi villoresi' AND "Pole position" = 'alberto ascari' AND "Winning driver" = 'alberto ascari' | 0.147461 |
CREATE TABLE Roles (Role_Code CHAR, Role_Name VARCHAR, Role_Description VARCHAR)
CREATE TABLE Document_Locations (Document_ID INTEGER, Location_Code CHAR, Date_in_Location_From TIMESTAMP, Date_in_Locaton_To TIMESTAMP)
CREATE TABLE Employees (Employee_ID INTEGER, Role_Code CHAR, Employee_Name VARCHAR, Gender_MFU CHAR, Date_of_Birth TIMESTAMP, Other_Details VARCHAR)
CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR)
CREATE TABLE Documents_to_be_Destroyed (Document_ID INTEGER, Destruction_Authorised_by_Employee_ID INTEGER, Destroyed_by_Employee_ID INTEGER, Planned_Destruction_Date TIMESTAMP, Actual_Destruction_Date TIMESTAMP, Other_Details VARCHAR)
CREATE TABLE All_Documents (Document_ID INTEGER, Date_Stored TIMESTAMP, Document_Type_Code CHAR, Document_Name CHAR, Document_Description CHAR, Other_Details VARCHAR)
CREATE TABLE Ref_Locations (Location_Code CHAR, Location_Name VARCHAR, Location_Description VARCHAR)
CREATE TABLE Ref_Calendar (Calendar_Date TIMESTAMP, Day_Number INTEGER)
| Show the number of documents in different starting date and bin starting date by year interval with a line chart. | SELECT Date_in_Location_From, COUNT(Date_in_Location_From) FROM Document_Locations | SELECT "Date_in_Location_From", COUNT("Date_in_Location_From") FROM "Document_Locations" | 0.085938 |
CREATE TABLE table_53721 ("Date" VARCHAR(MAX), "Visitor" VARCHAR(MAX), "Score" VARCHAR(MAX), "Home" VARCHAR(MAX), "Decision" VARCHAR(MAX), "Attendance" REAL, "Record" VARCHAR(MAX))
| What was the record when the home team is Washington? | SELECT "Record" FROM table_53721 WHERE "Home" = 'washington' | SELECT "Record" FROM "table_53721" WHERE "Home" = 'washington' | 0.060547 |
CREATE TABLE table_64004 ("Wimmera FL" VARCHAR(MAX), "Wins" REAL, "Byes" REAL, "Losses" REAL, "Draws" REAL, "Against" REAL)
| What's the total losses when there are 8 wins and less than 2 byes? | SELECT SUM("Losses") FROM table_64004 WHERE "Wins" = '8' AND "Byes" < '2' | SELECT SUM("Losses") FROM "table_64004" WHERE "Byes" < '2' AND "Wins" = '8' | 0.073242 |
CREATE TABLE class_of_service (booking_class VARCHAR, rank INTEGER, class_description VARCHAR(MAX))
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
CREATE TABLE state (state_code VARCHAR(MAX), state_name VARCHAR(MAX), country_name VARCHAR(MAX))
CREATE TABLE flight_stop (flight_id INTEGER, stop_number INTEGER, stop_days VARCHAR(MAX), stop_airport VARCHAR(MAX), arrival_time INTEGER, arrival_airline VARCHAR(MAX), arrival_flight_number INTEGER, departure_time INTEGER, departure_airline VARCHAR(MAX), departure_flight_number INTEGER, stop_time INTEGER)
CREATE TABLE code_description (code VARCHAR, description VARCHAR(MAX))
CREATE TABLE fare (fare_id INTEGER, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code VARCHAR(MAX), fare_airline VARCHAR(MAX), restriction_code VARCHAR(MAX), one_direction_cost INTEGER, round_trip_cost INTEGER, round_trip_required VARCHAR)
CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INTEGER, propulsion VARCHAR, wide_body VARCHAR, wing_span INTEGER, length INTEGER, weight INTEGER, capacity INTEGER, pay_load INTEGER, cruising_speed INTEGER, range_miles INTEGER, pressurized VARCHAR)
CREATE TABLE flight (aircraft_code_sequence VARCHAR(MAX), airline_code VARCHAR, airline_flight VARCHAR(MAX), arrival_time INTEGER, connections INTEGER, departure_time INTEGER, dual_carrier VARCHAR(MAX), flight_days VARCHAR(MAX), flight_id INTEGER, flight_number INTEGER, from_airport VARCHAR, meal_code VARCHAR(MAX), stops INTEGER, time_elapsed INTEGER, to_airport VARCHAR)
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INTEGER, direction VARCHAR, minutes_distant INTEGER)
CREATE TABLE flight_fare (flight_id INTEGER, fare_id INTEGER)
CREATE TABLE airport (airport_code VARCHAR, airport_name VARCHAR(MAX), airport_location VARCHAR(MAX), state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INTEGER)
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INTEGER, high_flight_number INTEGER, dual_airline VARCHAR, service_name VARCHAR(MAX))
CREATE TABLE time_zone (time_zone_code VARCHAR(MAX), time_zone_name VARCHAR(MAX), hours_from_gmt INTEGER)
CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR)
CREATE TABLE date_day (month_number INTEGER, day_number INTEGER, year INTEGER, day_name VARCHAR)
CREATE TABLE month (month_number INTEGER, month_name VARCHAR(MAX))
CREATE TABLE airline (airline_code VARCHAR, airline_name VARCHAR(MAX), note VARCHAR(MAX))
CREATE TABLE ground_service (city_code VARCHAR(MAX), airport_code VARCHAR(MAX), transport_type VARCHAR(MAX), ground_fare INTEGER)
CREATE TABLE food_service (meal_code VARCHAR(MAX), meal_number INTEGER, compartment VARCHAR(MAX), meal_description VARCHAR)
CREATE TABLE time_interval (period VARCHAR(MAX), begin_time INTEGER, end_time INTEGER)
CREATE TABLE restriction (restriction_code VARCHAR(MAX), advance_purchase INTEGER, stopovers VARCHAR(MAX), saturday_stay_required VARCHAR(MAX), minimum_stay INTEGER, maximum_stay INTEGER, application VARCHAR(MAX), no_discounts VARCHAR(MAX))
CREATE TABLE fare_basis (fare_basis_code VARCHAR(MAX), booking_class VARCHAR(MAX), class_type VARCHAR(MAX), premium VARCHAR(MAX), economy VARCHAR(MAX), discounted VARCHAR(MAX), night VARCHAR(MAX), season VARCHAR(MAX), basis_days VARCHAR(MAX))
CREATE TABLE flight_leg (flight_id INTEGER, leg_number INTEGER, leg_flight INTEGER)
| i'd like to see all flights from PITTSBURGH to PHILADELPHIA again | SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'PHILADELPHIA' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code | SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PITTSBURGH' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'PHILADELPHIA' | 0.501953 |
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype VARCHAR(MAX), careunit VARCHAR(MAX), wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type VARCHAR(MAX), event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX), linksto VARCHAR(MAX))
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit VARCHAR(MAX), last_careunit VARCHAR(MAX), first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX))
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc VARCHAR(MAX), org_name VARCHAR(MAX))
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug VARCHAR(MAX), dose_val_rx VARCHAR(MAX), dose_unit_rx VARCHAR(MAX), route VARCHAR(MAX))
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender VARCHAR(MAX), dob TIME, dod TIME)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), insurance VARCHAR(MAX), language VARCHAR(MAX), marital_status VARCHAR(MAX), ethnicity VARCHAR(MAX), age DECIMAL)
| when did patient 25103 since 05/2103 first receive the stool microbiology test? | SELECT microbiologyevents.charttime FROM microbiologyevents WHERE microbiologyevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 25103) AND microbiologyevents.spec_type_desc = 'stool' AND STRFTIME('%y-%m', microbiologyevents.charttime) >= '2103-05' ORDER BY microbiologyevents.charttime LIMIT 1 | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25103 GROUP BY "hadm_id") SELECT "microbiologyevents"."charttime" FROM "microbiologyevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "microbiologyevents"."hadm_id" WHERE "microbiologyevents"."spec_type_desc" = 'stool' AND NOT "_u_0"."" IS NULL AND STRFTIME('%y-%m', "microbiologyevents"."charttime") >= '2103-05' ORDER BY "microbiologyevents"."charttime" NULLS FIRST LIMIT 1 | 0.461914 |
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| what is admission time and diagnoses short title of subject id 2560? | SELECT demographic.admittime, diagnoses.short_title FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.subject_id = "2560" | SELECT "demographic"."admittime", "diagnoses"."short_title" FROM "demographic" JOIN "diagnoses" ON "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "2560" = "demographic"."subject_id" | 0.183594 |
CREATE TABLE player (player_id DECIMAL, name VARCHAR(MAX), position VARCHAR(MAX), club_id DECIMAL, apps DECIMAL, tries DECIMAL, goals VARCHAR(MAX), points DECIMAL)
CREATE TABLE competition_result (competition_id DECIMAL, club_id_1 DECIMAL, club_id_2 DECIMAL, score VARCHAR(MAX))
CREATE TABLE competition (competition_id DECIMAL, year DECIMAL, competition_type VARCHAR(MAX), country VARCHAR(MAX))
CREATE TABLE club (club_id DECIMAL, name VARCHAR(MAX), region VARCHAR(MAX), start_year VARCHAR(MAX))
CREATE TABLE club_rank (rank DECIMAL, club_id DECIMAL, gold DECIMAL, silver DECIMAL, bronze DECIMAL, total DECIMAL)
| What is the most common competition type? | SELECT competition_type FROM competition GROUP BY competition_type ORDER BY COUNT(*) DESC LIMIT 1 | SELECT "competition_type" FROM "competition" GROUP BY "competition_type" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1 | 0.111328 |
CREATE TABLE table_80107 ("Episode" VARCHAR(MAX), "First aired" VARCHAR(MAX), "Entrepreneur ( s ) " VARCHAR(MAX), "Company or product name" VARCHAR(MAX), "Money requested ( \\u00a3 ) " VARCHAR(MAX), "Description of product" VARCHAR(MAX), "Investing Dragon ( s ) " VARCHAR(MAX))
| How much money did the company Neurotica request? | SELECT "Money requested (\u00a3)" FROM table_80107 WHERE "Company or product name" = 'neurotica' | SELECT "Money requested (\u00a3)" FROM "table_80107" WHERE "Company or product name" = 'neurotica' | 0.095703 |
CREATE TABLE table_11264 ("Date" VARCHAR(MAX), "Opponent" VARCHAR(MAX), "Score" VARCHAR(MAX), "Loss" VARCHAR(MAX), "Attendance" VARCHAR(MAX), "Record" VARCHAR(MAX))
| with a record of 68-80 what was the loss? | SELECT "Loss" FROM table_11264 WHERE "Record" = '68-80' | SELECT "Loss" FROM "table_11264" WHERE "Record" = '68-80' | 0.055664 |
CREATE TABLE Staff (staff_id INTEGER, gender VARCHAR, first_name VARCHAR, last_name VARCHAR, email_address VARCHAR, phone_number VARCHAR)
CREATE TABLE Customers (customer_id INTEGER, customer_type_code VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, town_city VARCHAR, state VARCHAR, email_address VARCHAR, phone_number VARCHAR)
CREATE TABLE Complaints (complaint_id INTEGER, product_id INTEGER, customer_id INTEGER, complaint_outcome_code VARCHAR, complaint_status_code VARCHAR, complaint_type_code VARCHAR, date_complaint_raised TIMESTAMP, date_complaint_closed TIMESTAMP, staff_id INTEGER)
CREATE TABLE Products (product_id INTEGER, parent_product_id INTEGER, product_category_code VARCHAR, date_product_first_available TIMESTAMP, date_product_discontinued TIMESTAMP, product_name VARCHAR, product_description VARCHAR, product_price DECIMAL)
| A pie chart about the average price of products that have each category code. | SELECT product_category_code, AVG(product_price) FROM Products GROUP BY product_category_code | SELECT "product_category_code", AVG("product_price") FROM "Products" GROUP BY "product_category_code" | 0.098633 |
CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR)
CREATE TABLE ground_service (city_code VARCHAR(MAX), airport_code VARCHAR(MAX), transport_type VARCHAR(MAX), ground_fare INTEGER)
CREATE TABLE restriction (restriction_code VARCHAR(MAX), advance_purchase INTEGER, stopovers VARCHAR(MAX), saturday_stay_required VARCHAR(MAX), minimum_stay INTEGER, maximum_stay INTEGER, application VARCHAR(MAX), no_discounts VARCHAR(MAX))
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR)
CREATE TABLE flight_leg (flight_id INTEGER, leg_number INTEGER, leg_flight INTEGER)
CREATE TABLE food_service (meal_code VARCHAR(MAX), meal_number INTEGER, compartment VARCHAR(MAX), meal_description VARCHAR)
CREATE TABLE code_description (code VARCHAR, description VARCHAR(MAX))
CREATE TABLE flight (aircraft_code_sequence VARCHAR(MAX), airline_code VARCHAR, airline_flight VARCHAR(MAX), arrival_time INTEGER, connections INTEGER, departure_time INTEGER, dual_carrier VARCHAR(MAX), flight_days VARCHAR(MAX), flight_id INTEGER, flight_number INTEGER, from_airport VARCHAR, meal_code VARCHAR(MAX), stops INTEGER, time_elapsed INTEGER, to_airport VARCHAR)
CREATE TABLE date_day (month_number INTEGER, day_number INTEGER, year INTEGER, day_name VARCHAR)
CREATE TABLE flight_stop (flight_id INTEGER, stop_number INTEGER, stop_days VARCHAR(MAX), stop_airport VARCHAR(MAX), arrival_time INTEGER, arrival_airline VARCHAR(MAX), arrival_flight_number INTEGER, departure_time INTEGER, departure_airline VARCHAR(MAX), departure_flight_number INTEGER, stop_time INTEGER)
CREATE TABLE month (month_number INTEGER, month_name VARCHAR(MAX))
CREATE TABLE fare (fare_id INTEGER, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code VARCHAR(MAX), fare_airline VARCHAR(MAX), restriction_code VARCHAR(MAX), one_direction_cost INTEGER, round_trip_cost INTEGER, round_trip_required VARCHAR)
CREATE TABLE airline (airline_code VARCHAR, airline_name VARCHAR(MAX), note VARCHAR(MAX))
CREATE TABLE days (days_code VARCHAR, day_name VARCHAR)
CREATE TABLE state (state_code VARCHAR(MAX), state_name VARCHAR(MAX), country_name VARCHAR(MAX))
CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INTEGER, high_flight_number INTEGER, dual_airline VARCHAR, service_name VARCHAR(MAX))
CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR)
CREATE TABLE airport (airport_code VARCHAR, airport_name VARCHAR(MAX), airport_location VARCHAR(MAX), state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INTEGER)
CREATE TABLE time_interval (period VARCHAR(MAX), begin_time INTEGER, end_time INTEGER)
CREATE TABLE time_zone (time_zone_code VARCHAR(MAX), time_zone_name VARCHAR(MAX), hours_from_gmt INTEGER)
CREATE TABLE fare_basis (fare_basis_code VARCHAR(MAX), booking_class VARCHAR(MAX), class_type VARCHAR(MAX), premium VARCHAR(MAX), economy VARCHAR(MAX), discounted VARCHAR(MAX), night VARCHAR(MAX), season VARCHAR(MAX), basis_days VARCHAR(MAX))
CREATE TABLE flight_fare (flight_id INTEGER, fare_id INTEGER)
CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INTEGER, propulsion VARCHAR, wide_body VARCHAR, wing_span INTEGER, length INTEGER, weight INTEGER, capacity INTEGER, pay_load INTEGER, cruising_speed INTEGER, range_miles INTEGER, pressurized VARCHAR)
CREATE TABLE class_of_service (booking_class VARCHAR, rank INTEGER, class_description VARCHAR(MAX))
CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INTEGER, direction VARCHAR, minutes_distant INTEGER)
| what is the seating capacity of the 757 | SELECT DISTINCT aircraft_code FROM aircraft WHERE aircraft_code = '757' | SELECT DISTINCT "aircraft_code" FROM "aircraft" WHERE "aircraft_code" = '757' | 0.075195 |
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| provide the number of patients whose year of birth is less than 2087 and procedure icd9 code is 966? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.dob_year < "2087" AND procedures.icd9_code = "966" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "966" = "procedures"."icd9_code" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "2087" > "demographic"."dob_year" | 0.209961 |
CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR)
CREATE TABLE time_slot (time_slot_id VARCHAR, day VARCHAR, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL)
CREATE TABLE takes (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, grade VARCHAR)
CREATE TABLE student (ID VARCHAR, name VARCHAR, dept_name VARCHAR, tot_cred DECIMAL)
CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget DECIMAL)
CREATE TABLE course (course_id VARCHAR, title VARCHAR, dept_name VARCHAR, credits DECIMAL)
CREATE TABLE teaches (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL)
CREATE TABLE instructor (ID VARCHAR, name VARCHAR, dept_name VARCHAR, salary DECIMAL)
CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity DECIMAL)
CREATE TABLE advisor (s_ID VARCHAR, i_ID VARCHAR)
CREATE TABLE section (course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, building VARCHAR, room_number VARCHAR, time_slot_id VARCHAR)
| How many departments whose budget is more than the average budget in each building? Show me a bar chart, could you show by the bar in descending? | SELECT building, COUNT(building) FROM department WHERE budget > (SELECT AVG(budget) FROM department) GROUP BY building ORDER BY building DESC | SELECT "building", COUNT("building") FROM "department" WHERE "budget" > (SELECT AVG("budget") FROM "department") GROUP BY "building" ORDER BY "building" DESC NULLS LAST | 0.164063 |
CREATE TABLE table_19753079_36 (incumbent VARCHAR, candidates VARCHAR)
| Name the incumbent for sue myrick (r) 69.0% jeff doctor (d) 31.0% | SELECT incumbent FROM table_19753079_36 WHERE candidates = "Sue Myrick (R) 69.0% Jeff Doctor (D) 31.0%" | SELECT "incumbent" FROM "table_19753079_36" WHERE "Sue Myrick (R) 69.0% Jeff Doctor (D) 31.0%" = "candidates" | 0.106445 |
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX), linksto VARCHAR(MAX))
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc VARCHAR(MAX), org_name VARCHAR(MAX))
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender VARCHAR(MAX), dob TIME, dod TIME)
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), insurance VARCHAR(MAX), language VARCHAR(MAX), marital_status VARCHAR(MAX), ethnicity VARCHAR(MAX), age DECIMAL)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug VARCHAR(MAX), dose_val_rx VARCHAR(MAX), dose_unit_rx VARCHAR(MAX), route VARCHAR(MAX))
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX))
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype VARCHAR(MAX), careunit VARCHAR(MAX), wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type VARCHAR(MAX), event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
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 VARCHAR(MAX), charttime TIME)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit VARCHAR(MAX), last_careunit VARCHAR(MAX), 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 VARCHAR(MAX), charttime TIME)
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL)
| count the number of patients who this year had an intake of d5 normal saline. | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE admissions.hadm_id IN (SELECT icustays.hadm_id FROM icustays WHERE icustays.icustay_id IN (SELECT inputevents_cv.icustay_id FROM inputevents_cv WHERE inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'd5 normal saline' AND d_items.linksto = 'inputevents_cv') AND DATETIME(inputevents_cv.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year'))) | WITH "_u_0" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'd5 normal saline' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid"), "_u_1" AS (SELECT "inputevents_cv"."icustay_id" FROM "inputevents_cv" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "inputevents_cv"."itemid" WHERE DATETIME("inputevents_cv"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "icustays"."hadm_id" FROM "icustays" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "icustays"."icustay_id" WHERE NOT "_u_1"."" IS NULL GROUP BY "hadm_id") SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "admissions"."hadm_id" WHERE NOT "_u_2"."" IS NULL | 0.779297 |
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 VARCHAR(MAX), MarkdownInputGuidance VARCHAR(MAX), MarkdownPostOwnerGuidance VARCHAR(MAX), MarkdownPrivilegedUserGuidance VARCHAR(MAX), MarkdownConcensusDescription VARCHAR(MAX), CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName VARCHAR(MAX), TargetTagName VARCHAR(MAX), CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment VARCHAR(MAX), Text VARCHAR(MAX), Title VARCHAR(MAX), Tags VARCHAR(MAX), RevisionGUID other)
CREATE TABLE Tags (Id DECIMAL, TagName VARCHAR(MAX), Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE FlagTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE VoteTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName VARCHAR(MAX), LastAccessDate TIME, WebsiteUrl VARCHAR(MAX), Location VARCHAR(MAX), AboutMe VARCHAR(MAX), Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl VARCHAR(MAX), EmailHash VARCHAR(MAX), AccountId DECIMAL)
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text VARCHAR(MAX), CreationDate TIME, UserDisplayName VARCHAR(MAX), UserId DECIMAL, ContentLicense VARCHAR(MAX))
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name VARCHAR(MAX), Body VARCHAR(MAX), IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body VARCHAR(MAX), OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX), PostTypeId DECIMAL)
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment VARCHAR(MAX))
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name VARCHAR(MAX), Date TIME, Class DECIMAL, TagBased BOOLEAN)
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress VARCHAR(MAX))
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName VARCHAR(MAX), Comment VARCHAR(MAX), Text VARCHAR(MAX), ContentLicense VARCHAR(MAX))
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
| Number of Active Posts by Quarter. | SELECT TIME_TO_STR(p.LastActivityDate, '%q') AS q, YEAR(p.LastActivityDate) AS y, COUNT(p.Id) AS NumPosts, Tags FROM Posts AS p JOIN PostTags AS pt ON p.Id = pt.PostId WHERE YEAR(p.LastActivityDate) = 2016 GROUP BY TIME_TO_STR(p.LastActivityDate, '%q'), YEAR(p.LastActivityDate), Tags ORDER BY y, q, NumPosts DESC | SELECT TO_CHAR("p"."lastactivitydate", '%q') AS "q", YEAR("p"."lastactivitydate") AS "y", COUNT("p"."id") AS "NumPosts", "Tags" FROM "Posts" AS "p" JOIN "PostTags" AS "pt" ON "p"."id" = "pt"."postid" WHERE YEAR("p"."lastactivitydate") = 2016 GROUP BY TO_CHAR("p"."lastactivitydate", '%q'), YEAR("p"."lastactivitydate"), "Tags" ORDER BY "y" NULLS FIRST, "q" NULLS FIRST, "NumPosts" DESC NULLS LAST | 0.386719 |
CREATE TABLE table_name_64 (points INTEGER, game VARCHAR, january VARCHAR)
| Which Points is the highest one that has a Game smaller than 43, and a January larger than 8? | SELECT MAX(points) FROM table_name_64 WHERE game < 43 AND january > 8 | SELECT MAX("points") FROM "table_name_64" WHERE "game" < 43 AND "january" > 8 | 0.075195 |
CREATE TABLE table_10497 ("Title" VARCHAR(MAX), "Format" VARCHAR(MAX), "Label" VARCHAR(MAX), "Catalog number" VARCHAR(MAX), "Formats" VARCHAR(MAX), "Year" REAL)
| Tell me the label for digital format with nebula remixes | SELECT "Label" FROM table_10497 WHERE "Formats" = 'digital' AND "Title" = 'nebula remixes' | SELECT "Label" FROM "table_10497" WHERE "Formats" = 'digital' AND "Title" = 'nebula remixes' | 0.089844 |
CREATE TABLE table_31531 ("Player" VARCHAR(MAX), "Nationality" VARCHAR(MAX), "Position" VARCHAR(MAX), "Years in Toronto" VARCHAR(MAX), "School/Club Team" VARCHAR(MAX))
| What is the nationality of school/club team of barton cc (ks)? | SELECT "Nationality" FROM table_31531 WHERE "School/Club Team" = 'barton cc (ks)' | SELECT "Nationality" FROM "table_31531" WHERE "School/Club Team" = 'barton cc (ks)' | 0.081055 |
CREATE TABLE table_1341718_14 (first_elected INTEGER, district VARCHAR)
| what was the year first elected for district illinois 7? | SELECT MAX(first_elected) FROM table_1341718_14 WHERE district = "Illinois 7" | SELECT MAX("first_elected") FROM "table_1341718_14" WHERE "Illinois 7" = "district" | 0.081055 |
CREATE TABLE table_26267607_2 (pole_position VARCHAR, winning_driver VARCHAR, circuit VARCHAR)
| In the circuit Showevent Olympiastadion M nchen, where the winning driver is Bruno Spengler, what is the pole position? | SELECT pole_position FROM table_26267607_2 WHERE winning_driver = "Bruno Spengler" AND circuit = "Showevent Olympiastadion München" | SELECT "pole_position" FROM "table_26267607_2" WHERE "Bruno Spengler" = "winning_driver" AND "Showevent Olympiastadion München" = "circuit" | 0.135742 |
CREATE TABLE PostTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName VARCHAR(MAX), LastAccessDate TIME, WebsiteUrl VARCHAR(MAX), Location VARCHAR(MAX), AboutMe VARCHAR(MAX), Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl VARCHAR(MAX), EmailHash VARCHAR(MAX), AccountId DECIMAL)
CREATE TABLE Tags (Id DECIMAL, TagName VARCHAR(MAX), Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle VARCHAR(MAX), MarkdownInputGuidance VARCHAR(MAX), MarkdownPostOwnerGuidance VARCHAR(MAX), MarkdownPrivilegedUserGuidance VARCHAR(MAX), MarkdownConcensusDescription VARCHAR(MAX), CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL)
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name VARCHAR(MAX), Body VARCHAR(MAX), IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body VARCHAR(MAX), OwnerUserId DECIMAL, DeletionUserId DECIMAL)
CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName VARCHAR(MAX), TargetTagName VARCHAR(MAX), CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
CREATE TABLE VoteTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE CloseReasonTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL)
CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL)
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME)
CREATE TABLE FlagTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress VARCHAR(MAX))
CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment VARCHAR(MAX))
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX), PostTypeId DECIMAL)
CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL)
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL)
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment VARCHAR(MAX), Text VARCHAR(MAX), Title VARCHAR(MAX), Tags VARCHAR(MAX), RevisionGUID other)
CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name VARCHAR(MAX), Description VARCHAR(MAX))
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text VARCHAR(MAX), CreationDate TIME, UserDisplayName VARCHAR(MAX), UserId DECIMAL, ContentLicense VARCHAR(MAX))
CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body VARCHAR(MAX), OwnerUserId DECIMAL, OwnerDisplayName VARCHAR(MAX), LastEditorUserId DECIMAL, LastEditorDisplayName VARCHAR(MAX), LastEditDate TIME, LastActivityDate TIME, Title VARCHAR(MAX), Tags VARCHAR(MAX), AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense VARCHAR(MAX))
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName VARCHAR(MAX), Comment VARCHAR(MAX), Text VARCHAR(MAX), ContentLicense VARCHAR(MAX))
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name VARCHAR(MAX))
CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL)
CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name VARCHAR(MAX), Date TIME, Class DECIMAL, TagBased BOOLEAN)
| Users by number of bounties offered. | SELECT OwnerUserId, COUNT(Id) AS NumBounties FROM PostNotices WHERE PostNoticeTypeId / 10 = 1 GROUP BY OwnerUserId ORDER BY NumBounties DESC | SELECT "OwnerUserId", COUNT("Id") AS "NumBounties" FROM "PostNotices" WHERE "PostNoticeTypeId" / NULLIF(10, 0) = 1 GROUP BY "OwnerUserId" ORDER BY "NumBounties" DESC NULLS LAST | 0.171875 |
CREATE TABLE table_17623902_1 (original_air_date VARCHAR, written_by VARCHAR)
| What was the original air date of this episode that was written by Debbie Sarjeant? | SELECT original_air_date FROM table_17623902_1 WHERE written_by = "Debbie Sarjeant" | SELECT "original_air_date" FROM "table_17623902_1" WHERE "Debbie Sarjeant" = "written_by" | 0.086914 |
CREATE TABLE room (roomnumber DECIMAL, roomtype VARCHAR(MAX), blockfloor DECIMAL, blockcode DECIMAL, unavailable BOOLEAN)
CREATE TABLE trained_in (physician DECIMAL, treatment DECIMAL, certificationdate TIME, certificationexpires TIME)
CREATE TABLE block (blockfloor DECIMAL, blockcode DECIMAL)
CREATE TABLE physician (employeeid DECIMAL, name VARCHAR(MAX), position VARCHAR(MAX), ssn DECIMAL)
CREATE TABLE affiliated_with (physician DECIMAL, department DECIMAL, primaryaffiliation BOOLEAN)
CREATE TABLE undergoes (patient DECIMAL, procedures DECIMAL, stay DECIMAL, dateundergoes TIME, physician DECIMAL, assistingnurse DECIMAL)
CREATE TABLE stay (stayid DECIMAL, patient DECIMAL, room DECIMAL, staystart TIME, stayend TIME)
CREATE TABLE medication (code DECIMAL, name VARCHAR(MAX), brand VARCHAR(MAX), description VARCHAR(MAX))
CREATE TABLE prescribes (physician DECIMAL, patient DECIMAL, medication DECIMAL, date TIME, appointment DECIMAL, dose VARCHAR(MAX))
CREATE TABLE on_call (nurse DECIMAL, blockfloor DECIMAL, blockcode DECIMAL, oncallstart TIME, oncallend TIME)
CREATE TABLE nurse (employeeid DECIMAL, name VARCHAR(MAX), position VARCHAR(MAX), registered BOOLEAN, ssn DECIMAL)
CREATE TABLE appointment (appointmentid DECIMAL, patient DECIMAL, prepnurse DECIMAL, physician DECIMAL, start TIME, end TIME, examinationroom VARCHAR(MAX))
CREATE TABLE department (departmentid DECIMAL, name VARCHAR(MAX), head DECIMAL)
CREATE TABLE procedures (code DECIMAL, name VARCHAR(MAX), cost DECIMAL)
CREATE TABLE patient (ssn DECIMAL, name VARCHAR(MAX), address VARCHAR(MAX), phone VARCHAR(MAX), insuranceid DECIMAL, pcp DECIMAL)
| Find the ids of the nurses who are on call in block floor 1 and block code 1. | SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1 | SELECT "nurse" FROM "on_call" WHERE "blockcode" = 1 AND "blockfloor" = 1 | 0.070313 |
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX), linksto VARCHAR(MAX))
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug VARCHAR(MAX), dose_val_rx VARCHAR(MAX), dose_unit_rx VARCHAR(MAX), route VARCHAR(MAX))
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit VARCHAR(MAX), last_careunit VARCHAR(MAX), first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc VARCHAR(MAX), org_name VARCHAR(MAX))
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_labitems (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX))
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), insurance VARCHAR(MAX), language VARCHAR(MAX), marital_status VARCHAR(MAX), ethnicity VARCHAR(MAX), age DECIMAL)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype VARCHAR(MAX), careunit VARCHAR(MAX), 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 VARCHAR(MAX))
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type VARCHAR(MAX), event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender VARCHAR(MAX), dob TIME, dod TIME)
| what were the numbers of patients admitted to hospital since 2104? | SELECT COUNT(DISTINCT admissions.subject_id) FROM admissions WHERE STRFTIME('%y', admissions.admittime) >= '2104' | SELECT COUNT(DISTINCT "admissions"."subject_id") FROM "admissions" WHERE STRFTIME('%y', "admissions"."admittime") >= '2104' | 0.120117 |
CREATE TABLE table_204_110 (id DECIMAL, "year" DECIMAL, "champion" VARCHAR(MAX), "city" VARCHAR(MAX), "llws" VARCHAR(MAX), "record" VARCHAR(MAX))
| which was the only champion to obtain sixth place in the llws ? | SELECT "champion" FROM table_204_110 WHERE "llws" = 'sixth place' | SELECT "champion" FROM "table_204_110" WHERE "llws" = 'sixth place' | 0.06543 |
CREATE TABLE table_203_580 (id DECIMAL, "title" VARCHAR(MAX), "release" DECIMAL, "genre" VARCHAR(MAX), "computer" VARCHAR(MAX), "console" VARCHAR(MAX), "handheld" VARCHAR(MAX), "smartphone" VARCHAR(MAX))
| whats the number of games released in 1998 ? | SELECT COUNT("title") FROM table_203_580 WHERE "release" = 1998 | SELECT COUNT("title") FROM "table_203_580" WHERE "release" = 1998 | 0.063477 |
CREATE TABLE table_name_97 (pole_position VARCHAR, round INTEGER)
| Tell me the pole position with round less than 2 | SELECT pole_position FROM table_name_97 WHERE round < 2 | SELECT "pole_position" FROM "table_name_97" WHERE "round" < 2 | 0.05957 |
CREATE TABLE table_19233 ("Team" VARCHAR(MAX), "Intercontinental" VARCHAR(MAX), "Recopa 1996" VARCHAR(MAX), "Supercopa 1996" VARCHAR(MAX), "CONMEBOL 1996" VARCHAR(MAX), "Copa Libertadores 1997" VARCHAR(MAX))
| what is the racing club where copa libertadores 1997? | SELECT "Copa Libertadores 1997" FROM table_19233 WHERE "Team" = 'Racing Club' | SELECT "Copa Libertadores 1997" FROM "table_19233" WHERE "Team" = 'Racing Club' | 0.077148 |
CREATE TABLE table_name_62 (main_contestant VARCHAR, scores_by_each_individual_judge VARCHAR)
| Who is the main contestant with scores by each individual judge of 8 + 7 + 7 = 21? | SELECT main_contestant FROM table_name_62 WHERE scores_by_each_individual_judge = 8 + 7 + 7 = 21 | SELECT "main_contestant" FROM "table_name_62" WHERE "scores_by_each_individual_judge" = FALSE | 0.09082 |
CREATE TABLE table_18381 ("District" VARCHAR(MAX), "Incumbent" VARCHAR(MAX), "Party" VARCHAR(MAX), "First elected" REAL, "Result" VARCHAR(MAX), "Candidates" VARCHAR(MAX))
| What was the result when Ray Roberts was elected? | SELECT "Result" FROM table_18381 WHERE "Incumbent" = 'Ray Roberts' | SELECT "Result" FROM "table_18381" WHERE "Incumbent" = 'Ray Roberts' | 0.066406 |
CREATE TABLE table_17671 ("Year" VARCHAR(MAX), "Division" REAL, "League" VARCHAR(MAX), "Regular Season" VARCHAR(MAX), "Playoffs" VARCHAR(MAX), "Open Cup" VARCHAR(MAX))
| What was the regular season listing in 2007? | SELECT "Regular Season" FROM table_17671 WHERE "Year" = '2007' | SELECT "Regular Season" FROM "table_17671" WHERE "Year" = '2007' | 0.0625 |
CREATE TABLE table_name_90 (seine_saint_denis VARCHAR, paris VARCHAR)
| WHAT IS A Seine-Saint-Denis WITH A PARIS OF 12.1%? | SELECT seine_saint_denis FROM table_name_90 WHERE paris = "12.1%" | SELECT "seine_saint_denis" FROM "table_name_90" WHERE "12.1%" = "paris" | 0.069336 |
CREATE TABLE table_17933600_2 (team VARCHAR, outgoing_manage VARCHAR)
| What team(s) had an outgoing manager of jo o alves? | SELECT team FROM table_17933600_2 WHERE outgoing_manage = "João Alves" | SELECT "team" FROM "table_17933600_2" WHERE "João Alves" = "outgoing_manage" | 0.074219 |
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
| How many patients died in or before the year 2112 with an item id 51352? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.dod_year <= "2112.0" AND lab.itemid = "51352" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51352" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2112.0" >= "demographic"."dod_year" | 0.191406 |
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
| count the number of patients whose diagnoses long title is cardiogenic shock? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE diagnoses.long_title = "Cardiogenic shock" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Cardiogenic shock" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" | 0.182617 |
CREATE TABLE table_21054 ("Poll Source" VARCHAR(MAX), "Dates administered" VARCHAR(MAX), "Democrat: Carl Levin" VARCHAR(MAX), "Republican: Jack Hoogendyk" VARCHAR(MAX), "Lead Margin" REAL)
| What poll source had an administered date on July 10, 2008? | SELECT "Poll Source" FROM table_21054 WHERE "Dates administered" = 'July 10, 2008' | SELECT "Poll Source" FROM "table_21054" WHERE "Dates administered" = 'July 10, 2008' | 0.082031 |
CREATE TABLE table_21191496_1 (report VARCHAR, circuit VARCHAR)
| When autodromo nazionale monza is the circuit what is the report? | SELECT report FROM table_21191496_1 WHERE circuit = "Autodromo Nazionale Monza" | SELECT "report" FROM "table_21191496_1" WHERE "Autodromo Nazionale Monza" = "circuit" | 0.083008 |
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| give me the number of patients whose age is less than 89 and admission year is less than 2195? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.age < "89" AND demographic.admityear < "2195" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2195" > "demographic"."admityear" AND "89" > "demographic"."age" | 0.136719 |
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit VARCHAR(MAX), last_careunit VARCHAR(MAX), 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 VARCHAR(MAX), charttime TIME)
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX), linksto VARCHAR(MAX))
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type VARCHAR(MAX), event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug VARCHAR(MAX), dose_val_rx VARCHAR(MAX), dose_unit_rx VARCHAR(MAX), route VARCHAR(MAX))
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender VARCHAR(MAX), dob TIME, dod TIME)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype VARCHAR(MAX), careunit VARCHAR(MAX), 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 VARCHAR(MAX))
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX))
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc VARCHAR(MAX), org_name VARCHAR(MAX))
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), insurance VARCHAR(MAX), language VARCHAR(MAX), marital_status VARCHAR(MAX), ethnicity VARCHAR(MAX), age DECIMAL)
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| on the last icu visit when did patient 25433 get tpn for the last time? | 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 = 25433) AND NOT icustays.outtime IS NULL ORDER BY icustays.intime DESC LIMIT 1) AND inputevents_cv.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'tpn' AND d_items.linksto = 'inputevents_cv') ORDER BY inputevents_cv.charttime DESC LIMIT 1 | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 25433 GROUP BY "hadm_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'tpn' AND "d_items"."linksto" = 'inputevents_cv' GROUP BY "itemid") SELECT "inputevents_cv"."charttime" FROM "inputevents_cv" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "inputevents_cv"."itemid" WHERE "inputevents_cv"."icustay_id" IN (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 AND NOT "icustays"."outtime" IS NULL ORDER BY "icustays"."intime" DESC NULLS LAST LIMIT 1) AND NOT "_u_2"."" IS NULL ORDER BY "inputevents_cv"."charttime" DESC NULLS LAST LIMIT 1 | 0.735352 |
CREATE TABLE table_39537 ("Rank" REAL, "Name" VARCHAR(MAX), "Nationality" VARCHAR(MAX), "1st ( m ) " REAL, "2nd ( m ) " REAL, "Points" REAL, "Overall WC points ( Rank ) " VARCHAR(MAX))
| Which Points is the highest one that has a Nationality of aut, and a Name of thomas morgenstern? | SELECT MAX("Points") FROM table_39537 WHERE "Nationality" = 'aut' AND "Name" = 'thomas morgenstern' | SELECT MAX("Points") FROM "table_39537" WHERE "Name" = 'thomas morgenstern' AND "Nationality" = 'aut' | 0.098633 |
CREATE TABLE table_37791 ("County" VARCHAR(MAX), "Irish name" VARCHAR(MAX), "County town" VARCHAR(MAX), "Most populous city/town" VARCHAR(MAX), "Province" VARCHAR(MAX), "Region" VARCHAR(MAX))
| Most populous city/town of clonmel, and a Irish name of tiobraid rann (contae thiobraid rann) is which region? | SELECT "Region" FROM table_37791 WHERE "Most populous city/town" = 'clonmel' AND "Irish name" = 'tiobraid árann (contae thiobraid árann)' | SELECT "Region" FROM "table_37791" WHERE "Irish name" = 'tiobraid árann (contae thiobraid árann)' AND "Most populous city/town" = 'clonmel' | 0.135742 |
CREATE TABLE table_name_16 (preservation VARCHAR, episode VARCHAR)
| Has Episode 1b-16 (42) been preserved? | SELECT preservation FROM table_name_16 WHERE episode = "1b-16 (42)" | SELECT "preservation" FROM "table_name_16" WHERE "1b-16 (42)" = "episode" | 0.071289 |
CREATE TABLE table_name_2 (circuit VARCHAR)
| Name the 125cc winner with circuit of estoril | SELECT 125 AS cc_winner FROM table_name_2 WHERE circuit = "estoril" | SELECT 125 AS "cc_winner" FROM "table_name_2" WHERE "circuit" = "estoril" | 0.071289 |
CREATE TABLE table_17330069_1 (fin_pos VARCHAR, points VARCHAR)
| If the points is 15, what is the fin. pos? | SELECT COUNT(fin_pos) FROM table_17330069_1 WHERE points = "15" | SELECT COUNT("fin_pos") FROM "table_17330069_1" WHERE "15" = "points" | 0.067383 |
CREATE TABLE table_22325 ("No." REAL, "#" REAL, "Title" VARCHAR(MAX), "Directed by" VARCHAR(MAX), "Written by" VARCHAR(MAX), "Canadian air date" VARCHAR(MAX), "U.S. air date" VARCHAR(MAX), "Production code" REAL, "Canadian viewers ( million ) " VARCHAR(MAX))
| How many air dates where directed by jim donovan? | SELECT COUNT("U.S. air date") FROM table_22325 WHERE "Directed by" = 'Jim Donovan' | SELECT COUNT("U.S. air date") FROM "table_22325" WHERE "Directed by" = 'Jim Donovan' | 0.082031 |
CREATE TABLE table_19930660_3 (first_broadcast VARCHAR, rufus_guest VARCHAR)
| When is the first broadcast for episodes where Rufus's guest is Jack Whitehall? | SELECT first_broadcast FROM table_19930660_3 WHERE rufus_guest = "Jack Whitehall" | SELECT "first_broadcast" FROM "table_19930660_3" WHERE "Jack Whitehall" = "rufus_guest" | 0.084961 |
CREATE TABLE table_29781 ("Game" REAL, "Date" VARCHAR(MAX), "Team" VARCHAR(MAX), "Score" VARCHAR(MAX), "High points" VARCHAR(MAX), "High rebounds" VARCHAR(MAX), "High assists" VARCHAR(MAX), "Location Attendance" VARCHAR(MAX), "Record" VARCHAR(MAX))
| What was the date when Boston was the team? | SELECT "Date" FROM table_29781 WHERE "Team" = 'Boston' | SELECT "Date" FROM "table_29781" WHERE "Team" = 'Boston' | 0.054688 |
CREATE TABLE table_203_862 (id DECIMAL, "draw" DECIMAL, "artist" VARCHAR(MAX), "song" VARCHAR(MAX), "points" DECIMAL, "place" VARCHAR(MAX))
| how many points does the artist rita have ? | SELECT "points" FROM table_203_862 WHERE "artist" = 'rita' | SELECT "points" FROM "table_203_862" WHERE "artist" = 'rita' | 0.058594 |
CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug VARCHAR(MAX), dose_val_rx VARCHAR(MAX), dose_unit_rx VARCHAR(MAX), route VARCHAR(MAX))
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender VARCHAR(MAX), dob TIME, dod TIME)
CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit VARCHAR(MAX), last_careunit VARCHAR(MAX), first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc VARCHAR(MAX), org_name VARCHAR(MAX))
CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type VARCHAR(MAX), event_id DECIMAL, chargetime TIME, cost DECIMAL)
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code VARCHAR(MAX), charttime TIME)
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom VARCHAR(MAX))
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 VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), insurance VARCHAR(MAX), language VARCHAR(MAX), marital_status VARCHAR(MAX), ethnicity VARCHAR(MAX), age DECIMAL)
CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype VARCHAR(MAX), careunit VARCHAR(MAX), wardid DECIMAL, intime TIME, outtime TIME)
CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX), linksto VARCHAR(MAX))
CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label VARCHAR(MAX))
CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| show me the top four most common diagnoses for patients 50s of age a year before? | SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 50 AND 59) AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 4) | WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."age" <= 59 AND "admissions"."age" >= 50 GROUP BY "hadm_id"), "t1" AS (SELECT "diagnoses_icd"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "diagnoses_icd"."hadm_id" WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL GROUP BY "diagnoses_icd"."icd9_code"), "_u_1" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_1"."" IS NULL | 0.760742 |
CREATE TABLE demographic (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), name VARCHAR(MAX), marital_status VARCHAR(MAX), age VARCHAR(MAX), dob VARCHAR(MAX), gender VARCHAR(MAX), language VARCHAR(MAX), religion VARCHAR(MAX), admission_type VARCHAR(MAX), days_stay VARCHAR(MAX), insurance VARCHAR(MAX), ethnicity VARCHAR(MAX), expire_flag VARCHAR(MAX), admission_location VARCHAR(MAX), discharge_location VARCHAR(MAX), diagnosis VARCHAR(MAX), dod VARCHAR(MAX), dob_year VARCHAR(MAX), dod_year VARCHAR(MAX), admittime VARCHAR(MAX), dischtime VARCHAR(MAX), admityear VARCHAR(MAX))
CREATE TABLE lab (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), itemid VARCHAR(MAX), charttime VARCHAR(MAX), flag VARCHAR(MAX), value_unit VARCHAR(MAX), label VARCHAR(MAX), fluid VARCHAR(MAX))
CREATE TABLE procedures (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
CREATE TABLE prescriptions (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icustay_id VARCHAR(MAX), drug_type VARCHAR(MAX), drug VARCHAR(MAX), formulary_drug_cd VARCHAR(MAX), route VARCHAR(MAX), drug_dose VARCHAR(MAX))
CREATE TABLE diagnoses (subject_id VARCHAR(MAX), hadm_id VARCHAR(MAX), icd9_code VARCHAR(MAX), short_title VARCHAR(MAX), long_title VARCHAR(MAX))
| how many patients are married and diagnosed with acute or chronic diastolic heart failure? | SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.marital_status = "MARRIED" AND diagnoses.long_title = "Acute on chronic diastolic heart failure" | SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Acute on chronic diastolic heart failure" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "MARRIED" = "demographic"."marital_status" | 0.25293 |
CREATE TABLE table_name_84 (bodyweight INTEGER, snatch INTEGER)
| What lowest Bodyweight has a Snatch smaller than 55? | SELECT MIN(bodyweight) FROM table_name_84 WHERE snatch < 55 | SELECT MIN("bodyweight") FROM "table_name_84" WHERE "snatch" < 55 | 0.063477 |
CREATE TABLE record (ID INTEGER, Result VARCHAR(MAX), Swimmer_ID INTEGER, Event_ID INTEGER)
CREATE TABLE event (ID INTEGER, Name VARCHAR(MAX), Stadium_ID INTEGER, Year VARCHAR(MAX))
CREATE TABLE stadium (ID INTEGER, name VARCHAR(MAX), Capacity INTEGER, City VARCHAR(MAX), Country VARCHAR(MAX), Opening_year INTEGER)
CREATE TABLE swimmer (ID INTEGER, name VARCHAR(MAX), Nationality VARCHAR(MAX), meter_100 REAL, meter_200 VARCHAR(MAX), meter_300 VARCHAR(MAX), meter_400 VARCHAR(MAX), meter_500 VARCHAR(MAX), meter_600 VARCHAR(MAX), meter_700 VARCHAR(MAX), Time VARCHAR(MAX))
| Visualize a bar chart about the distribution of meter_300 and meter_100 , and list Y-axis in descending order. | SELECT meter_300, meter_100 FROM swimmer ORDER BY meter_100 DESC | SELECT "meter_300", "meter_100" FROM "swimmer" ORDER BY "meter_100" DESC NULLS LAST | 0.081055 |
CREATE TABLE Companies (Headquarters VARCHAR)
| Show the headquarters shared by more than two companies. | SELECT Headquarters FROM Companies GROUP BY Headquarters HAVING COUNT(*) > 2 | SELECT "Headquarters" FROM "Companies" GROUP BY "Headquarters" HAVING COUNT(*) > 2 | 0.080078 |
CREATE TABLE table_18946749_2 (elevation__m_ INTEGER, peak VARCHAR)
| What is the elevation (m) of the Mount Wilhelm peak? | SELECT MAX(elevation__m_) FROM table_18946749_2 WHERE peak = "Mount Wilhelm" | SELECT MAX("elevation__m_") FROM "table_18946749_2" WHERE "Mount Wilhelm" = "peak" | 0.080078 |
CREATE TABLE table_30222 ("Series #" REAL, "Title" VARCHAR(MAX), "Directed by" VARCHAR(MAX), "Written by" VARCHAR(MAX), "Original air date" VARCHAR(MAX), "Production code" VARCHAR(MAX), "U.S. viewers ( million ) " VARCHAR(MAX))
| What series number is the episode with production code bdf101? | SELECT MAX("Series #") FROM table_30222 WHERE "Production code" = 'BDF101' | SELECT MAX("Series #") FROM "table_30222" WHERE "Production code" = 'BDF101' | 0.074219 |