schema
stringlengths
28
5.65k
question
stringlengths
0
990
rejected
stringlengths
2
4.44k
chosen
stringlengths
4
9.17k
weight
float64
0
8.95
CREATE TABLE table_name_98 (silver INT, rank VARCHAR, total VARCHAR)
What is the sum of silvers for teams with ranks over 3 and totals under 2?
SELECT SUM(silver) FROM table_name_98 WHERE rank > 3 AND total < 2
SELECT SUM("silver") FROM "table_name_98" WHERE "rank" > 3 AND "total" < 2
0.072266
CREATE TABLE table_49116 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Decision" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
Which Date has a Score of 4 2?
SELECT "Date" FROM table_49116 WHERE "Score" = '4–2'
SELECT "Date" FROM "table_49116" WHERE "Score" = '4–2'
0.052734
CREATE TABLE table_name_83 (outgoing_manager VARCHAR, position_in_table VARCHAR)
Which outgoing manager has tabled 16th position?
SELECT outgoing_manager FROM table_name_83 WHERE position_in_table = "16th"
SELECT "outgoing_manager" FROM "table_name_83" WHERE "16th" = "position_in_table"
0.079102
CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT)
Which class is the hardest ?
SELECT DISTINCT course.name, course.number, program_course.workload FROM course, program_course WHERE course.department = 'EECS' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MAX(PROGRAM_COURSEalias1.workload) FROM course AS COURSEalias1, program_course AS PROGRAM_COURSEalias1 WHERE COURSEalias1.course_id = PROGRAM_COURSEalias1.course_id AND COURSEalias1.department = 'EECS')
WITH "_u_0" AS (SELECT MAX("PROGRAM_COURSEalias1"."workload") FROM "course" AS "COURSEalias1" JOIN "program_course" AS "PROGRAM_COURSEalias1" ON "COURSEalias1"."course_id" = "PROGRAM_COURSEalias1"."course_id" WHERE "COURSEalias1"."department" = 'EECS') SELECT DISTINCT "course"."name", "course"."number", "program_course"."workload" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "program_course"."workload" WHERE "course"."department" = 'EECS'
0.512695
CREATE TABLE table_14959246_2 (attendance VARCHAR, date VARCHAR)
What was the attendance at the game played on December 10, 1972?
SELECT attendance FROM table_14959246_2 WHERE date = "December 10, 1972"
SELECT "attendance" FROM "table_14959246_2" WHERE "December 10, 1972" = "date"
0.076172
CREATE TABLE table_name_26 (silver INT, rank VARCHAR, bronze VARCHAR)
Tell me the lowest silver for rank of 9 and bronze less than 2
SELECT MIN(silver) FROM table_name_26 WHERE rank = 9 AND bronze < 2
SELECT MIN("silver") FROM "table_name_26" WHERE "bronze" < 2 AND "rank" = 9
0.073242
CREATE TABLE table_54858 ("Player" TEXT, "Height" TEXT, "School" TEXT, "Hometown" TEXT, "College" TEXT, "NBA Draft" TEXT)
Tell me the school that jason fraser went to
SELECT "School" FROM table_54858 WHERE "Player" = 'jason fraser'
SELECT "School" FROM "table_54858" WHERE "Player" = 'jason fraser'
0.064453
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
what is the daily average urine output that patient 003-17096 has had since 03/06/2105?
SELECT AVG(intakeoutput.cellvaluenumeric) FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '003-17096')) AND intakeoutput.celllabel = 'urine' AND intakeoutput.cellpath LIKE '%output%' AND STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime) >= '2105-03-06' GROUP BY STRFTIME('%y-%m-%d', intakeoutput.intakeoutputtime)
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '003-17096' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT AVG("intakeoutput"."cellvaluenumeric") FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'urine' AND "intakeoutput"."cellpath" LIKE '%output%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime") >= '2105-03-06' GROUP BY STRFTIME('%y-%m-%d', "intakeoutput"."intakeoutputtime")
0.738281
CREATE TABLE table_name_85 (year INT, community_award VARCHAR)
Which Year has a Community Award of jarrod harbrow?
SELECT SUM(year) FROM table_name_85 WHERE community_award = "jarrod harbrow"
SELECT SUM("year") FROM "table_name_85" WHERE "community_award" = "jarrod harbrow"
0.080078
CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
what are the methods of consumption of send 500mg vial?
SELECT DISTINCT prescriptions.route FROM prescriptions WHERE prescriptions.drug = 'send 500mg vial'
SELECT DISTINCT "prescriptions"."route" FROM "prescriptions" WHERE "prescriptions"."drug" = 'send 500mg vial'
0.106445
CREATE TABLE table_63918 ("Rank" FLOAT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
What is the Total number of medals for the Nation with 7 or less Bronze medals and 1 Silver medal with a Rank of 9 or larger?
SELECT MIN("Total") FROM table_63918 WHERE "Bronze" < '7' AND "Silver" = '1' AND "Rank" > '9'
SELECT MIN("Total") FROM "table_63918" WHERE "Bronze" < '7' AND "Rank" > '9' AND "Silver" = '1'
0.092773
CREATE TABLE table_23202 ("Institution" TEXT, "Location" TEXT, "Nickname" TEXT, "Founded" FLOAT, "Type" TEXT, "Enrollment" FLOAT, "Joined" TEXT)
Name the most founded for sea gulls
SELECT MAX("Founded") FROM table_23202 WHERE "Nickname" = 'Sea Gulls'
SELECT MAX("Founded") FROM "table_23202" WHERE "Nickname" = 'Sea Gulls'
0.069336
CREATE TABLE table_3588 ("Year" FLOAT, "Starts" FLOAT, "Wins" FLOAT, "Top 10" FLOAT, "Avg. Start" TEXT, "Avg. Finish" TEXT, "Winnings" TEXT, "Position" TEXT, "Team ( s ) " TEXT)
How many positions are there for RB1 Motorsports?
SELECT COUNT("Position") FROM table_3588 WHERE "Team(s)" = 'RB1 Motorsports'
SELECT COUNT("Position") FROM "table_3588" WHERE "Team(s)" = 'RB1 Motorsports'
0.076172
CREATE TABLE table_40076 ("Ring name" TEXT, "Current rank" TEXT, "Debut" TEXT, "Stable" TEXT, "Birthplace" TEXT)
What is Current Rank, when Ring Name is Kimurayama Mamoru?
SELECT "Current rank" FROM table_40076 WHERE "Ring name" = 'kimurayama mamoru'
SELECT "Current rank" FROM "table_40076" WHERE "Ring name" = 'kimurayama mamoru'
0.078125
CREATE TABLE table_12226390_4 (no_in_season INT, written_by VARCHAR)
What episode was written by Bobby Bell and Bill Lee?
SELECT MAX(no_in_season) FROM table_12226390_4 WHERE written_by = "Bobby Bell and Bill Lee"
SELECT MAX("no_in_season") FROM "table_12226390_4" WHERE "Bobby Bell and Bill Lee" = "written_by"
0.094727
CREATE TABLE table_29803475_2 (no_in_series INT, us_viewers__million_ VARCHAR)
What is the lowest number in series when U.S. viewers is 0.23 million?
SELECT MIN(no_in_series) FROM table_29803475_2 WHERE us_viewers__million_ = "0.23"
SELECT MIN("no_in_series") FROM "table_29803475_2" WHERE "0.23" = "us_viewers__million_"
0.085938
CREATE TABLE table_45691 ("Game" FLOAT, "December" FLOAT, "Opponent" TEXT, "Score" TEXT, "Record" TEXT)
What is Record, when Game is '36'?
SELECT "Record" FROM table_45691 WHERE "Game" = '36'
SELECT "Record" FROM "table_45691" WHERE "Game" = '36'
0.052734
CREATE TABLE hall_of_fame (player_id TEXT, yearid DECIMAL, votedby TEXT, ballots TEXT, needed TEXT, votes TEXT, inducted TEXT, category TEXT, needed_note TEXT) CREATE TABLE player_award (player_id TEXT, award_id TEXT, year DECIMAL, league_id TEXT, tie TEXT, notes TEXT) CREATE TABLE player (player_id TEXT, birth_year TEXT, birth_month TEXT, birth_day TEXT, birth_country TEXT, birth_state TEXT, birth_city TEXT, death_year TEXT, death_month TEXT, death_day TEXT, death_country TEXT, death_state TEXT, death_city TEXT, name_first TEXT, name_last TEXT, name_given TEXT, weight TEXT) CREATE TABLE salary (year DECIMAL, team_id TEXT, league_id TEXT, player_id TEXT, salary DECIMAL) CREATE TABLE player_award_vote (award_id TEXT, year DECIMAL, league_id TEXT, player_id TEXT, points_won DECIMAL, points_max DECIMAL, votes_first TEXT)
Which Country are most baseball players from?
SELECT birth_country FROM player GROUP BY birth_country ORDER BY COUNT(*) DESC LIMIT 1
SELECT "birth_country" FROM "player" GROUP BY "birth_country" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.100586
CREATE TABLE table_19982699_1 (_number INT, producer VARCHAR, television_premiere VARCHAR)
How many numbers have Charles Salmon as the producer and January 27, 2007 was the television premiere?
SELECT MIN(_number) FROM table_19982699_1 WHERE producer = "Charles Salmon" AND television_premiere = "January 27, 2007"
SELECT MIN("_number") FROM "table_19982699_1" WHERE "Charles Salmon" = "producer" AND "January 27, 2007" = "television_premiere"
0.125
CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR) CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT) CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT) CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR) CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME) CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT)
Draw a bar chart for how many sections does each course have?
SELECT CRS_CODE, COUNT(*) FROM CLASS GROUP BY CRS_CODE
SELECT "CRS_CODE", COUNT(*) FROM "CLASS" GROUP BY "CRS_CODE"
0.058594
CREATE TABLE table_name_32 (memory VARCHAR, turbo VARCHAR, release_date VARCHAR)
What Memory has a Turbo of 2/2/4/5 and the Release date of May 2010?
SELECT memory FROM table_name_32 WHERE turbo = "2/2/4/5" AND release_date = "may 2010"
SELECT "memory" FROM "table_name_32" WHERE "2/2/4/5" = "turbo" AND "may 2010" = "release_date"
0.091797
CREATE TABLE table_name_34 (attendance INT, date VARCHAR)
What's the average attendance on january 6, 2008?
SELECT AVG(attendance) FROM table_name_34 WHERE date = "january 6, 2008"
SELECT AVG("attendance") FROM "table_name_34" WHERE "date" = "january 6, 2008"
0.076172
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT)
Posts containing the given word.
SELECT DISTINCT p.Id AS "post_link", p.OwnerUserId AS "user_link", p.LastActivityDate, p.CreationDate, url = 'site://posts/' + CAST(p.Id AS TEXT) + '/revisions' FROM Posts AS p JOIN PostHistory AS ph ON (ph.PostId = p.Id) WHERE (p.Body LIKE '%##word?\let##%') ORDER BY p.LastActivityDate DESC LIMIT 100
SELECT DISTINCT "p"."Id" AS "post_link", "p"."OwnerUserId" AS "user_link", "p"."LastActivityDate", "p"."CreationDate", "url" = CONCAT(CONCAT('site://posts/', CAST("p"."Id" AS TEXT)), '/revisions') FROM "Posts" AS "p" JOIN "PostHistory" AS "ph" ON "p"."Id" = "ph"."PostId" WHERE "p"."Body" LIKE '%##word?\let##%' ORDER BY "p"."LastActivityDate" DESC NULLS LAST LIMIT 100
0.360352
CREATE TABLE table_27944 ("meas. num" FLOAT, "passed" TEXT, "YES votes" FLOAT, "NO votes" FLOAT, "% YES" TEXT, "Const. Amd.?" TEXT, "type" TEXT, "description" TEXT)
How many type classifications are given to the measure with the description, calling convention to revise state constitution?
SELECT COUNT("type") FROM table_27944 WHERE "description" = 'Calling Convention to revise State Constitution'
SELECT COUNT("type") FROM "table_27944" WHERE "description" = 'Calling Convention to revise State Constitution'
0.108398
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
how many days have elapsed since patient 027-203413 received a lab test of bedside glucose for the first time in this hospital encounter?
SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', lab.labresulttime)) FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-203413' AND patient.hospitaldischargetime IS NULL)) AND lab.labname = 'bedside glucose' ORDER BY lab.labresulttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."hospitaldischargetime" IS NULL AND "patient"."uniquepid" = '027-203413' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT 1 * (STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "lab"."labresulttime")) FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'bedside glucose' AND NOT "_u_1"."" IS NULL ORDER BY "lab"."labresulttime" NULLS FIRST LIMIT 1
0.669922
CREATE TABLE table_name_64 (date VARCHAR, opera VARCHAR, internet_explorer VARCHAR)
Which date has an Opera usage percentage of 5.1% and Internet Explorer usage of 59.5%?
SELECT date FROM table_name_64 WHERE opera = "5.1%" AND internet_explorer = "59.5%"
SELECT "date" FROM "table_name_64" WHERE "5.1%" = "opera" AND "59.5%" = "internet_explorer"
0.088867
CREATE TABLE table_30905 ("Episode" FLOAT, "Title" TEXT, "Writer" TEXT, "Director" TEXT, "Original airdate" TEXT, "Ratings ( Kanto ) " TEXT)
Who was the writer for episode 3?
SELECT "Writer" FROM table_30905 WHERE "Episode" = '3'
SELECT "Writer" FROM "table_30905" WHERE "Episode" = '3'
0.054688
CREATE TABLE table_300283_1 (ine_code INT, official_name VARCHAR)
What is the INE code of the municipality whose official name is Berantevilla?
SELECT MAX(ine_code) FROM table_300283_1 WHERE official_name = "Berantevilla"
SELECT MAX("ine_code") FROM "table_300283_1" WHERE "Berantevilla" = "official_name"
0.081055
CREATE TABLE table_name_70 (result VARCHAR, week VARCHAR, attendance VARCHAR)
What was the Result of the game after Week 9 with an Attendance of 69,714?
SELECT result FROM table_name_70 WHERE week > 9 AND attendance = "69,714"
SELECT "result" FROM "table_name_70" WHERE "69,714" = "attendance" AND "week" > 9
0.079102
CREATE TABLE table_1108394_6 (manhattan VARCHAR, staten_island VARCHAR)
What was the total number in Manhattan when Staten Island was 12,658?
SELECT COUNT(manhattan) FROM table_1108394_6 WHERE staten_island = "12,658"
SELECT COUNT("manhattan") FROM "table_1108394_6" WHERE "12,658" = "staten_island"
0.079102
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
How is Phenylephrine administered?
SELECT prescriptions.route FROM prescriptions WHERE prescriptions.drug = "PHENYLEPHrine"
SELECT "prescriptions"."route" FROM "prescriptions" WHERE "PHENYLEPHrine" = "prescriptions"."drug"
0.095703
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 TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
in the case of the patients who were diagnosed with chronic obst asthma nos in this year, what was the top four most common drugs that followed during the same month?
SELECT t3.drug FROM (SELECT t2.drug, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'chronic obst asthma nos') AND DATETIME(diagnoses_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE DATETIME(prescriptions.startdate, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND DATETIME(t1.charttime, 'start of month') = DATETIME(t2.startdate, 'start of month') GROUP BY t2.drug) AS t3 WHERE t3.c1 <= 4
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."drug", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" WHERE DATETIME("prescriptions"."startdate", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')), "t3" AS (SELECT "t2"."drug", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'chronic obst asthma nos' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."startdate" AND DATETIME("diagnoses_icd"."charttime", 'start of month') = DATETIME("t2"."startdate", 'start of month') WHERE DATETIME("diagnoses_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY "t2"."drug") SELECT "t3"."drug" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4
1.040039
CREATE TABLE table_name_45 (latitude VARCHAR, ansi_code VARCHAR, township VARCHAR, land___sqmi__ VARCHAR, geo_id VARCHAR)
What is the total latitude of the greenland township with more than 34.846 sqmi of land, a geo id less than 3805529660, and an ANSI code greater than 1036405?
SELECT COUNT(latitude) FROM table_name_45 WHERE land___sqmi__ > 34.846 AND geo_id < 3805529660 AND township = "greenland" AND ansi_code > 1036405
SELECT COUNT("latitude") FROM "table_name_45" WHERE "ansi_code" > 1036405 AND "geo_id" < 3805529660 AND "greenland" = "township" AND "land___sqmi__" > 34.846
0.15332
CREATE TABLE table_43528 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
What was the results against the Philadelphia Eagles?
SELECT "Result" FROM table_43528 WHERE "Opponent" = 'philadelphia eagles'
SELECT "Result" FROM "table_43528" WHERE "Opponent" = 'philadelphia eagles'
0.073242
CREATE TABLE table_name_39 (adelaide VARCHAR, sydney VARCHAR, perth VARCHAR, auckland VARCHAR, melbourne VARCHAR)
Which Adelaide has an Auckland of yes, a Melbourne of yes, a Perth of yes, and a Sydney of cancelled?
SELECT adelaide FROM table_name_39 WHERE auckland = "yes" AND melbourne = "yes" AND perth = "yes" AND sydney = "cancelled"
SELECT "adelaide" FROM "table_name_39" WHERE "auckland" = "yes" AND "cancelled" = "sydney" AND "melbourne" = "yes" AND "perth" = "yes"
0.130859
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) 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)
Find employee with ID and name of the country presently where (s)he is working Visualize by bar chart, could you rank in ascending by the Y?
SELECT COUNTRY_NAME, SUM(EMPLOYEE_ID) FROM employees AS T1 JOIN departments AS T2 ON T1.DEPARTMENT_ID = T2.DEPARTMENT_ID JOIN locations AS T3 ON T2.LOCATION_ID = T3.LOCATION_ID JOIN countries AS T4 ON T3.COUNTRY_ID = T4.COUNTRY_ID GROUP BY COUNTRY_NAME ORDER BY SUM(EMPLOYEE_ID)
SELECT "COUNTRY_NAME", SUM("EMPLOYEE_ID") FROM "employees" AS "T1" JOIN "departments" AS "T2" ON "T1"."DEPARTMENT_ID" = "T2"."DEPARTMENT_ID" JOIN "locations" AS "T3" ON "T2"."LOCATION_ID" = "T3"."LOCATION_ID" JOIN "countries" AS "T4" ON "T3"."COUNTRY_ID" = "T4"."COUNTRY_ID" GROUP BY "COUNTRY_NAME" ORDER BY SUM("EMPLOYEE_ID") NULLS FIRST
0.330078
CREATE TABLE table_203_3 (id DECIMAL, "province" TEXT, "capital" TEXT, "population" DECIMAL, "density" TEXT, "municipalities" TEXT, "legal districts" DECIMAL)
is almer a or c rdoba 's density 72.4 / km2 ?
SELECT "province" FROM table_203_3 WHERE "density" = 72.4 AND "province" IN ('almeria', 'cordoba')
SELECT "province" FROM "table_203_3" WHERE "density" = 72.4 AND "province" IN ('almeria', 'cordoba')
0.097656
CREATE TABLE table_54471 ("Rank" FLOAT, "Player" TEXT, "Country" TEXT, "Earnings ( $ ) " FLOAT, "Events" FLOAT, "Wins" FLOAT)
What are the earnings for jim colbert with under 4 wins?
SELECT COUNT("Earnings ( $ )") FROM table_54471 WHERE "Player" = 'jim colbert' AND "Wins" < '4'
SELECT COUNT("Earnings ( $ )") FROM "table_54471" WHERE "Player" = 'jim colbert' AND "Wins" < '4'
0.094727
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is the number of patients whose primary disease is sdh?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "SDH"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "SDH" = "demographic"."diagnosis"
0.105469
CREATE TABLE table_train_163 ("id" INT, "pulse_oximetry" INT, "hemoglobin_a1c_hba1c" FLOAT, "body_weight" FLOAT, "allergy_to_adhesive" BOOLEAN, "creatinine_clearance_cl" FLOAT, "NOUSE" FLOAT)
weight > 136.4 kg or < 42 kg
SELECT * FROM table_train_163 WHERE body_weight > 136.4 OR body_weight < 42
SELECT * FROM "table_train_163" WHERE "body_weight" < 42 OR "body_weight" > 136.4
0.079102
CREATE TABLE table_name_18 (year VARCHAR, record VARCHAR)
Name the total number of years for a 39-31 record
SELECT COUNT(year) FROM table_name_18 WHERE record = "39-31"
SELECT COUNT("year") FROM "table_name_18" WHERE "39-31" = "record"
0.064453
CREATE TABLE table_28634206_1 (miss_universe VARCHAR, country VARCHAR)
How many miss universes did south africa have?
SELECT COUNT(miss_universe) FROM table_28634206_1 WHERE country = "South Africa"
SELECT COUNT("miss_universe") FROM "table_28634206_1" WHERE "South Africa" = "country"
0.083984
CREATE TABLE table_22297198_3 (manner_of_departure VARCHAR, outgoing_manager VARCHAR)
Why did Majid bagherinia leave?
SELECT manner_of_departure FROM table_22297198_3 WHERE outgoing_manager = "Majid Bagherinia"
SELECT "manner_of_departure" FROM "table_22297198_3" WHERE "Majid Bagherinia" = "outgoing_manager"
0.095703
CREATE TABLE table_name_79 (listed VARCHAR, built VARCHAR)
What is the date Listed of the Bridge Built in 1864?
SELECT listed FROM table_name_79 WHERE built = "1864"
SELECT "listed" FROM "table_name_79" WHERE "1864" = "built"
0.057617
CREATE TABLE table_78556 ("Position" FLOAT, "Club" TEXT, "Played" FLOAT, "Points" FLOAT, "Wins" FLOAT, "Draws" FLOAT, "Losses" FLOAT, "Goals for" FLOAT, "Goals against" FLOAT, "Goal Difference" FLOAT)
Which Losses have a Goal Difference of -16, and less than 8 wins?
SELECT MIN("Losses") FROM table_78556 WHERE "Goal Difference" = '-16' AND "Wins" < '8'
SELECT MIN("Losses") FROM "table_78556" WHERE "Goal Difference" = '-16' AND "Wins" < '8'
0.085938
CREATE TABLE table_22705 ("Producer" TEXT, "Product" TEXT, "Samples taken" FLOAT, "Samples failed" FLOAT, "Melamine content ( mg/kg ) " TEXT)
What is the smallest amount sampled of product ?
SELECT MIN("Samples taken") FROM table_22705 WHERE "Product" = '蒙牛牌嬰幼兒配方乳粉'
SELECT MIN("Samples taken") FROM "table_22705" WHERE "Product" = '蒙牛牌嬰幼兒配方乳粉'
0.075195
CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT)
Number of users with 20k+ rep. Number of users with 20k+ rep
SELECT COUNT(*) FROM Users WHERE Reputation >= '##N:int?20000##'
SELECT COUNT(*) FROM "Users" WHERE "Reputation" >= '##N:int?20000##'
0.066406
CREATE TABLE table_name_23 (cat_no VARCHAR, label_s_ VARCHAR, release_format VARCHAR)
What is the cat no for the label mute and the standard cd format?
SELECT cat_no FROM table_name_23 WHERE label_s_ = "mute" AND release_format = "standard cd"
SELECT "cat_no" FROM "table_name_23" WHERE "label_s_" = "mute" AND "release_format" = "standard cd"
0.09668
CREATE TABLE Addresses (address_id INT, line_1_number_building VARCHAR, city VARCHAR, zip_postcode VARCHAR, state_province_county VARCHAR, country VARCHAR) CREATE TABLE Lessons (lesson_id INT, customer_id INT, lesson_status_code VARCHAR, staff_id INT, vehicle_id INT, lesson_date DATETIME, lesson_time VARCHAR, price DOUBLE) CREATE TABLE Vehicles (vehicle_id INT, vehicle_details VARCHAR) CREATE TABLE Staff (staff_id INT, staff_address_id INT, nickname VARCHAR, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, date_of_birth DATETIME, date_joined_staff DATETIME, date_left_staff DATETIME) CREATE TABLE Customer_Payments (customer_id INT, datetime_payment DATETIME, payment_method_code VARCHAR, amount_payment DOUBLE) CREATE TABLE Customers (customer_id INT, customer_address_id INT, customer_status_code VARCHAR, date_became_customer DATETIME, date_of_birth DATETIME, first_name VARCHAR, last_name VARCHAR, amount_outstanding DOUBLE, email_address VARCHAR, phone_number VARCHAR, cell_mobile_phone_number VARCHAR)
What is the date of birth of every customer whose status code is 'Good Customer', and count them by a bar chart, and order by the Y-axis from high to low please.
SELECT date_of_birth, COUNT(date_of_birth) FROM Customers WHERE customer_status_code = 'Good Customer' ORDER BY COUNT(date_of_birth) DESC
SELECT "date_of_birth", COUNT("date_of_birth") FROM "Customers" WHERE "customer_status_code" = 'Good Customer' ORDER BY COUNT("date_of_birth") DESC NULLS LAST
0.154297
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients have stayed in the hospital for more than 3 days with a drug name phenylephrine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.days_stay > "3" AND prescriptions.drug = "PHENYLEPHrine"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "PHENYLEPHrine" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "3" < "demographic"."days_stay"
0.22168
CREATE TABLE county (county_id DECIMAL, county_name TEXT, population DECIMAL, zip_code TEXT) CREATE TABLE party (party_id DECIMAL, year DECIMAL, party TEXT, governor TEXT, lieutenant_governor TEXT, comptroller TEXT, attorney_general TEXT, us_senate TEXT) CREATE TABLE election (election_id DECIMAL, counties_represented TEXT, district DECIMAL, delegate TEXT, party DECIMAL, first_elected DECIMAL, committee TEXT)
Return the maximum and minimum population among all counties.
SELECT MAX(population), MIN(population) FROM county
SELECT MAX("population"), MIN("population") FROM "county"
0.055664
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME)
Users with over 5000 rep in both SO and ELU.
SELECT COUNT(*) FROM "stackoverflow".Users AS s WHERE s.Reputation > 5000
SELECT COUNT(*) FROM "stackoverflow"."Users" AS "s" WHERE "s"."Reputation" > 5000
0.079102
CREATE TABLE table_name_9 (record VARCHAR, game VARCHAR, opponent VARCHAR)
Can you tell me the Record that has the Game larger than 15, and the Opponent of edmonton oilers?
SELECT record FROM table_name_9 WHERE game > 15 AND opponent = "edmonton oilers"
SELECT "record" FROM "table_name_9" WHERE "edmonton oilers" = "opponent" AND "game" > 15
0.085938
CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, 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 TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL)
Meta posts with more than one required tag.
SELECT c.PostId AS "post_link", REPLACE(REPLACE(REPLACE(p.Tags, ' ', ' '), '><', ' '), '!= ', '') AS "tags" FROM (SELECT PostId, COUNT(*) AS "count" FROM PostTags WHERE TagId = @TagId1 OR TagId = @TagId2 OR TagId = @TagId3 OR TagId = @TagId4 GROUP BY PostId) AS c LEFT JOIN Posts AS p ON p.Id = c.PostId WHERE c.Count >= 2 ORDER BY c.PostId
WITH "c" AS (SELECT "PostId" FROM "PostTags" WHERE "TagId" = $TagId1 OR "TagId" = $TagId2 OR "TagId" = $TagId3 OR "TagId" = $TagId4 GROUP BY "PostId") SELECT "c"."PostId" AS "post_link", REPLACE(REPLACE(REPLACE("p"."Tags", ' ', ' '), '><', ' '), '!= ', '') AS "tags" FROM "c" AS "c" LEFT JOIN "Posts" AS "p" ON "c"."PostId" = "p"."Id" WHERE "c"."Count" >= 2 ORDER BY "c"."PostId" NULLS FIRST
0.381836
CREATE TABLE table_32500 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What was Fitzroy's score when they were the away team?
SELECT "Away team score" FROM table_32500 WHERE "Away team" = 'fitzroy'
SELECT "Away team score" FROM "table_32500" WHERE "Away team" = 'fitzroy'
0.071289
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
tell me the number of patients admitted before 2155 who had homocysteine lab test.
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2155" AND lab.label = "Homocysteine"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Homocysteine" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2155" > "demographic"."admityear"
0.195313
CREATE TABLE table_name_27 (Id VARCHAR)
What is the highest 1985 value that has a 1990 value of 93?
SELECT MAX(1985) FROM table_name_27 WHERE 1990 = 93
SELECT MAX(1985) FROM "table_name_27" WHERE FALSE
0.047852
CREATE TABLE table_80293 ("Year" FLOAT, "Builder" TEXT, "Type" TEXT, "LB&SCR No." TEXT, "SR No." TEXT)
Name the LB&SCR number that has SR number of 8597 8600
SELECT "LB&SCR No." FROM table_80293 WHERE "SR No." = '8597–8600'
SELECT "LB&SCR No." FROM "table_80293" WHERE "SR No." = '8597–8600'
0.06543
CREATE TABLE Staff (nickname VARCHAR, first_name VARCHAR, last_name VARCHAR)
What is the nickname of staff with first name as Janessa and last name as Sawayn?
SELECT nickname FROM Staff WHERE first_name = "Janessa" AND last_name = "Sawayn"
SELECT "nickname" FROM "Staff" WHERE "Janessa" = "first_name" AND "Sawayn" = "last_name"
0.085938
CREATE TABLE table_26866233_1 (writer VARCHAR, director VARCHAR)
The episode where the director is Gene Reynolds has who as the writer?
SELECT writer FROM table_26866233_1 WHERE director = "Gene Reynolds"
SELECT "writer" FROM "table_26866233_1" WHERE "Gene Reynolds" = "director"
0.072266
CREATE TABLE table_name_65 (number_of_contestants VARCHAR, winner VARCHAR)
How many contestants were there in a season where alejandra espinoza won?
SELECT COUNT(number_of_contestants) FROM table_name_65 WHERE winner = "alejandra espinoza"
SELECT COUNT("number_of_contestants") FROM "table_name_65" WHERE "alejandra espinoza" = "winner"
0.09375
CREATE TABLE table_name_64 (school_club_team VARCHAR, player VARCHAR)
Which School/Club Team does Andrew Jones play for?
SELECT school_club_team FROM table_name_64 WHERE player = "andrew jones"
SELECT "school_club_team" FROM "table_name_64" WHERE "andrew jones" = "player"
0.076172
CREATE TABLE Catalogs (catalog_id INT, catalog_name VARCHAR, catalog_publisher VARCHAR, date_of_publication DATETIME, date_of_latest_revision DATETIME) CREATE TABLE Catalog_Contents_Additional_Attributes (catalog_entry_id INT, catalog_level_number INT, attribute_id INT, attribute_value VARCHAR) CREATE TABLE Catalog_Structure (catalog_level_number INT, catalog_id INT, catalog_level_name VARCHAR) CREATE TABLE Catalog_Contents (catalog_entry_id INT, catalog_level_number INT, parent_entry_id INT, previous_entry_id INT, next_entry_id INT, catalog_entry_name VARCHAR, product_stock_number VARCHAR, price_in_dollars DOUBLE, price_in_euros DOUBLE, price_in_pounds DOUBLE, capacity VARCHAR, length VARCHAR, height VARCHAR, width VARCHAR) CREATE TABLE Attribute_Definitions (attribute_id INT, attribute_name VARCHAR, attribute_data_type VARCHAR)
Find the name and level of catalog structure with level between 5 and 10.
SELECT catalog_level_name, catalog_level_number FROM Catalog_Structure WHERE catalog_level_number BETWEEN 5 AND 10
SELECT "catalog_level_name", "catalog_level_number" FROM "Catalog_Structure" WHERE "catalog_level_number" <= 10 AND "catalog_level_number" >= 5
0.139648
CREATE TABLE table_name_14 (pieces INT, start VARCHAR, release VARCHAR)
What is the average number of pieces for boards that started in 1941 and were released after 2001?
SELECT AVG(pieces) FROM table_name_14 WHERE start = "1941" AND release > 2001
SELECT AVG("pieces") FROM "table_name_14" WHERE "1941" = "start" AND "release" > 2001
0.083008
CREATE TABLE table_name_78 (time VARCHAR, rank VARCHAR)
What's the time of Rank 3?
SELECT time FROM table_name_78 WHERE rank = 3
SELECT "time" FROM "table_name_78" WHERE "rank" = 3
0.049805
CREATE TABLE table_6576 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Won by 2 or more goals difference" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
Which Played is the highest one that has Points of 5, and a Drawn smaller than 1?
SELECT MAX("Played") FROM table_6576 WHERE "Points" = '5' AND "Drawn" < '1'
SELECT MAX("Played") FROM "table_6576" WHERE "Drawn" < '1' AND "Points" = '5'
0.075195
CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT)
what is the cost of a round trip flight from PITTSBURGH to ATLANTA beginning on 4 25 and returning on may sixth
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day AS DATE_DAY_0, date_day AS DATE_DAY_1, days AS DAYS_0, days AS DAYS_1, fare, fare_basis, flight, flight_fare WHERE ((CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'ATLANTA' AND DATE_DAY_1.day_number = 25 AND DATE_DAY_1.month_number = 4 AND DATE_DAY_1.year = 1991 AND DAYS_1.day_name = DATE_DAY_1.day_name AND flight.flight_days = DAYS_1.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PITTSBURGH' AND DATE_DAY_0.day_number = 25 AND DATE_DAY_0.month_number = 4 AND DATE_DAY_0.year = 1991 AND DAYS_0.day_name = DATE_DAY_0.day_name AND fare_basis.basis_days = DAYS_0.days_code AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND NOT fare.round_trip_cost IS NULL
SELECT DISTINCT "fare"."fare_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" AS "DATE_DAY_0" ON "DATE_DAY_0"."day_number" = 25 AND "DATE_DAY_0"."month_number" = 4 AND "DATE_DAY_0"."year" = 1991 JOIN "date_day" AS "DATE_DAY_1" ON "DATE_DAY_1"."day_number" = 25 AND "DATE_DAY_1"."month_number" = 4 AND "DATE_DAY_1"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PITTSBURGH' JOIN "days" AS "DAYS_0" ON "DATE_DAY_0"."day_name" = "DAYS_0"."day_name" JOIN "days" AS "DAYS_1" ON "DATE_DAY_1"."day_name" = "DAYS_1"."day_name" JOIN "fare_basis" ON "DAYS_0"."days_code" = "fare_basis"."basis_days" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "DAYS_1"."days_code" = "flight"."flight_days" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'ATLANTA' JOIN "fare" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare"."fare_id" = "flight_fare"."fare_id" AND NOT "fare"."round_trip_cost" IS NULL
1.239258
CREATE TABLE table_name_67 (capacity__thousands_of_metric_tons_ VARCHAR, county VARCHAR, mine VARCHAR)
What is the capacity of the Pinto Valley mine in Gila county?
SELECT capacity__thousands_of_metric_tons_ FROM table_name_67 WHERE county = "gila" AND mine = "pinto valley"
SELECT "capacity__thousands_of_metric_tons_" FROM "table_name_67" WHERE "county" = "gila" AND "mine" = "pinto valley"
0.114258
CREATE TABLE table_29459 ("Team" TEXT, "Outgoing manager" TEXT, "Manner of departure" TEXT, "Date of vacancy" TEXT, "Replaced by" TEXT, "Date of appointment" TEXT, "Position in table" TEXT)
Who was the outgoing manager of the team in 15th position that was sacked?
SELECT "Outgoing manager" FROM table_29459 WHERE "Manner of departure" = 'Sacked' AND "Position in table" = '15th'
SELECT "Outgoing manager" FROM "table_29459" WHERE "Manner of departure" = 'Sacked' AND "Position in table" = '15th'
0.113281
CREATE TABLE PersonFriend (name VARCHAR, friend VARCHAR, year INT) CREATE TABLE Person (name VARCHAR, age INT, city TEXT, gender TEXT, job TEXT)
how old is the youngest person for each job?, and show y-axis in descending order.
SELECT job, MIN(age) FROM Person GROUP BY job ORDER BY MIN(age) DESC
SELECT "job", MIN("age") FROM "Person" GROUP BY "job" ORDER BY MIN("age") DESC NULLS LAST
0.086914
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what was the four most commonly taken laboratory tests in 2101 for patients of the age 20s?
SELECT t1.labname FROM (SELECT lab.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age BETWEEN 20 AND 29) AND STRFTIME('%y', lab.labresulttime) = '2101' GROUP BY lab.labname) AS t1 WHERE t1.c1 <= 4
WITH "_u_0" AS (SELECT "patient"."patientunitstayid" FROM "patient" WHERE "patient"."age" <= 29 AND "patient"."age" >= 20 GROUP BY "patientunitstayid"), "t1" AS (SELECT "lab"."labname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "lab" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "lab"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL AND STRFTIME('%y', "lab"."labresulttime") = '2101' GROUP BY "lab"."labname") SELECT "t1"."labname" FROM "t1" AS "t1" WHERE "t1"."c1" <= 4
0.480469
CREATE TABLE table_26161 ("Episode" TEXT, "First broadcast" TEXT, "Davids team" TEXT, "Lees team" TEXT, "Scores" TEXT)
When bill oddie and frank skinner are both on the davids team what is the episode?
SELECT "Episode" FROM table_26161 WHERE "Davids team" = 'Bill Oddie and Frank Skinner'
SELECT "Episode" FROM "table_26161" WHERE "Davids team" = 'Bill Oddie and Frank Skinner'
0.085938
CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT) CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT)
Bar chart of acc_percent from each all neutral, could you order bars in descending order?
SELECT All_Neutral, ACC_Percent FROM basketball_match ORDER BY All_Neutral DESC
SELECT "All_Neutral", "ACC_Percent" FROM "basketball_match" ORDER BY "All_Neutral" DESC NULLS LAST
0.095703
CREATE TABLE table_203_770 (id DECIMAL, "ages attained ( years ) " TEXT, "catholic" TEXT, "protestant and other christian" TEXT, "other religion" TEXT, "none or not stated" TEXT)
at least of 50 % of the population is protestant , starting at which age range ?
SELECT "ages attained (years)" FROM table_203_770 WHERE "protestant and other christian" = 50
SELECT "ages attained (years)" FROM "table_203_770" WHERE "protestant and other christian" = 50
0.092773
CREATE TABLE table_204_521 (id DECIMAL, "rank" DECIMAL, "name" TEXT, "nationality" TEXT, "time ( hand ) " TEXT, "notes" TEXT)
how many athletes were faster than bill chisholm ?
SELECT COUNT("name") FROM table_204_521 WHERE "time (hand)" < (SELECT "time (hand)" FROM table_204_521 WHERE "name" = 'bill chisholm')
SELECT COUNT("name") FROM "table_204_521" WHERE "time (hand)" < (SELECT "time (hand)" FROM "table_204_521" WHERE "name" = 'bill chisholm')
0.134766
CREATE TABLE table_51419 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
How many attended the game when the home team's score is 5.6 (36)?
SELECT "Crowd" FROM table_51419 WHERE "Home team score" = '5.6 (36)'
SELECT "Crowd" FROM "table_51419" WHERE "Home team score" = '5.6 (36)'
0.068359
CREATE TABLE table_203_8 (id DECIMAL, "player" TEXT, "rec." DECIMAL, "yards" DECIMAL, "avg." DECIMAL, "td's" DECIMAL, "long" DECIMAL)
what is the difference between the highest average and the lowest avaerage ?
SELECT MAX("avg.") - MIN("avg.") FROM table_203_8
SELECT MAX("avg.") - MIN("avg.") FROM "table_203_8"
0.049805
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
when was the first time that the arterial bp [diastolic] of patient 1561 was measured or taken since 12/31/2102?
SELECT chartevents.charttime FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1561)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'arterial bp [diastolic]' AND d_items.linksto = 'chartevents') AND STRFTIME('%y-%m-%d', chartevents.charttime) >= '2102-12-31' ORDER BY chartevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 1561 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'arterial bp [diastolic]' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT "chartevents"."charttime" FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%y-%m-%d', "chartevents"."charttime") >= '2102-12-31' ORDER BY "chartevents"."charttime" NULLS FIRST LIMIT 1
0.802734
CREATE TABLE table_11152 ("State" TEXT, "Interview" FLOAT, "Swimsuit" FLOAT, "Evening Gown" FLOAT, "Average" FLOAT)
Which is the largest average number when the swimsuit is 9.4 and the evening gown stat is less than 9.486?
SELECT MAX("Average") FROM table_11152 WHERE "Swimsuit" = '9.4' AND "Evening Gown" < '9.486'
SELECT MAX("Average") FROM "table_11152" WHERE "Evening Gown" < '9.486' AND "Swimsuit" = '9.4'
0.091797
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients died and were diagnosed with sec neuroend tumor-liver?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.expire_flag = "1" AND diagnoses.short_title = "Sec neuroend tumor-liver"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Sec neuroend tumor-liver" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "1" = "demographic"."expire_flag"
0.229492
CREATE TABLE table_1914090_2 (europe INT, africa VARCHAR)
What is the minimum number of members Europe had at the time Africa had 7375139?
SELECT MIN(europe) FROM table_1914090_2 WHERE africa = 7375139
SELECT MIN("europe") FROM "table_1914090_2" WHERE "africa" = 7375139
0.066406
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
provide the number of patients whose gender is f and primary disease is bradycardia?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.diagnosis = "BRADYCARDIA"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "BRADYCARDIA" = "demographic"."diagnosis" AND "F" = "demographic"."gender"
0.145508
CREATE TABLE table_name_31 (silver INT, total VARCHAR, gold VARCHAR)
Which Silver has a Total of 11, and a Gold smaller than 8?
SELECT MIN(silver) FROM table_name_31 WHERE total = 11 AND gold < 8
SELECT MIN("silver") FROM "table_name_31" WHERE "gold" < 8 AND "total" = 11
0.073242
CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT)
what was the top four diagnosis with the highest three year mortality rate?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t4.icd9_code FROM (SELECT t3.icd9_code, DENSE_RANK() OVER (ORDER BY t3.c1 DESC) AS c2 FROM (SELECT t2.icd9_code, 100 - SUM(CASE WHEN patients.dod IS NULL THEN 1 WHEN STRFTIME('%j', patients.dod) - STRFTIME('%j', t2.charttime) > 3 * 365 THEN 1 ELSE 0 END) * 100 / COUNT(*) AS c1 FROM (SELECT t1.subject_id, t1.icd9_code, t1.charttime FROM (SELECT admissions.subject_id, diagnoses_icd.icd9_code, diagnoses_icd.charttime FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id GROUP BY admissions.subject_id, diagnoses_icd.icd9_code HAVING MIN(diagnoses_icd.charttime) = diagnoses_icd.charttime) AS t1 WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', t1.charttime) > 3 * 365) AS t2 JOIN patients ON t2.subject_id = patients.subject_id GROUP BY t2.icd9_code) AS t3) AS t4 WHERE t4.c2 <= 4)
WITH "t1" AS (SELECT "admissions"."subject_id", "diagnoses_icd"."icd9_code", "diagnoses_icd"."charttime" FROM "diagnoses_icd" JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" GROUP BY "admissions"."subject_id", "diagnoses_icd"."icd9_code" HAVING "diagnoses_icd"."charttime" = MIN("diagnoses_icd"."charttime")), "t3" AS (SELECT "t1"."icd9_code", 100 - SUM(CASE WHEN "patients"."dod" IS NULL THEN 1 WHEN STRFTIME('%j', "patients"."dod") - STRFTIME('%j', "t1"."charttime") > 1095 THEN 1 ELSE 0 END) * 100 / NULLIF(COUNT(*), 0) AS "c1" FROM "t1" AS "t1" JOIN "patients" ON "patients"."subject_id" = "t1"."subject_id" WHERE STRFTIME('%j', CURRENT_TIME()) - STRFTIME('%j', "t1"."charttime") > 1095 GROUP BY "t1"."icd9_code"), "t4" AS (SELECT "t3"."icd9_code", DENSE_RANK() OVER (ORDER BY "t3"."c1" DESC NULLS LAST) AS "c2" FROM "t3" AS "t3"), "_u_0" AS (SELECT "t4"."icd9_code" FROM "t4" AS "t4" WHERE "t4"."c2" <= 4 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_0"."" IS NULL
1.09082
CREATE TABLE table_1342013_31 (district VARCHAR, incumbent VARCHAR)
What district did incumbent Ralph A. Gamble represent?
SELECT district FROM table_1342013_31 WHERE incumbent = "Ralph A. Gamble"
SELECT "district" FROM "table_1342013_31" WHERE "Ralph A. Gamble" = "incumbent"
0.077148
CREATE TABLE table_name_44 (bronze VARCHAR, nation VARCHAR, silver VARCHAR)
The Soviet Union has won more than 2 Silver, but how many Bronzes?
SELECT COUNT(bronze) FROM table_name_44 WHERE nation = "soviet union" AND silver > 2
SELECT COUNT("bronze") FROM "table_name_44" WHERE "nation" = "soviet union" AND "silver" > 2
0.089844
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
during the previous year what were the top three most frequent diagnoses that patients were diagnosed with within the same hospital visit after being diagnosed with cardiac arrest - witnessed, < 15 minutes cpr?
SELECT t3.diagnosisname FROM (SELECT t2.diagnosisname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'cardiac arrest - witnessed, < 15 minutes cpr' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, diagnosis.diagnosisname, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.diagnosistime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.diagnosisname) AS t3 WHERE t3.c1 <= 3
WITH "t2" AS (SELECT "patient"."uniquepid", "diagnosis"."diagnosisname", "diagnosis"."diagnosistime", "patient"."patienthealthsystemstayid" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."diagnosisname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."diagnosistime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'cardiac arrest - witnessed, < 15 minutes cpr' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."diagnosisname") SELECT "t3"."diagnosisname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 3
1.019531
CREATE TABLE injury_accident (game_id DECIMAL, id DECIMAL, player TEXT, injury TEXT, number_of_matches TEXT, source TEXT) CREATE TABLE stadium (id DECIMAL, name TEXT, home_games DECIMAL, average_attendance DECIMAL, total_attendance DECIMAL, capacity_percentage DECIMAL) CREATE TABLE game (stadium_id DECIMAL, id DECIMAL, season DECIMAL, date TEXT, home_team TEXT, away_team TEXT, score TEXT, competition TEXT)
How many games are held after season 2007?
SELECT COUNT(*) FROM game WHERE season > 2007
SELECT COUNT(*) FROM "game" WHERE "season" > 2007
0.047852
CREATE TABLE table_name_83 (name VARCHAR, overall VARCHAR, college VARCHAR)
What is Name, when Overall is less than 175, and when College is 'Georgia'?
SELECT name FROM table_name_83 WHERE overall < 175 AND college = "georgia"
SELECT "name" FROM "table_name_83" WHERE "college" = "georgia" AND "overall" < 175
0.080078
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients whose discharge location is home health care and procedure long title is insertion of non-drug-eluting coronary artery stent(s)?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.discharge_location = "HOME HEALTH CARE" AND procedures.long_title = "Insertion of non-drug-eluting coronary artery stent(s)"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Insertion of non-drug-eluting coronary artery stent(s)" = "procedures"."long_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "HOME HEALTH CARE" = "demographic"."discharge_location"
0.282227
CREATE TABLE table_204_341 (id DECIMAL, "name in english" TEXT, "name in turkish" TEXT, "area ( km2 ) " TEXT, "depth" TEXT, "location ( districts and/or provinces ) " TEXT)
at most , what 's the biggest depth ?
SELECT "depth" FROM table_204_341 ORDER BY "depth" DESC LIMIT 1
SELECT "depth" FROM "table_204_341" ORDER BY "depth" DESC NULLS LAST LIMIT 1
0.074219
CREATE TABLE table_name_98 (gold INT, total VARCHAR, silver VARCHAR)
What's the lowest gold with a total over 15 and less than 16 silver?
SELECT MIN(gold) FROM table_name_98 WHERE total > 15 AND silver < 16
SELECT MIN("gold") FROM "table_name_98" WHERE "silver" < 16 AND "total" > 15
0.074219
CREATE TABLE table_train_26 ("id" INT, "gender" TEXT, "pregnancy_or_lactation" BOOLEAN, "allergy_to_penicillin" BOOLEAN, "active_infection" BOOLEAN, "allergy_to_cephalosporin" BOOLEAN, "receiving_anticoagulants" BOOLEAN, "age" FLOAT, "NOUSE" FLOAT)
documented or suspected infection
SELECT * FROM table_train_26 WHERE active_infection = 1
SELECT * FROM "table_train_26" WHERE "active_infection" = 1
0.057617
CREATE TABLE table_70067 ("Rank" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
Which average bronze had a silver greater than 2 and a gold larger than 7?
SELECT AVG("Bronze") FROM table_70067 WHERE "Silver" > '2' AND "Gold" > '7'
SELECT AVG("Bronze") FROM "table_70067" WHERE "Gold" > '7' AND "Silver" > '2'
0.075195
CREATE TABLE table_16824 ("Model name" TEXT, "Power ( ps ) " FLOAT, "Torque ( Nm@rpm ) " TEXT, "Displacement ( cm\\u00b3 ) " FLOAT, "Engine code" TEXT, "Comment" TEXT)
what's the model name with engine code being b5254 t4
SELECT "Model name" FROM table_16824 WHERE "Engine code" = 'B5254 T4'
SELECT "Model name" FROM "table_16824" WHERE "Engine code" = 'B5254 T4'
0.069336
CREATE TABLE university (School_ID INT, School TEXT, Location TEXT, Founded FLOAT, Affiliation TEXT, Enrollment FLOAT, Nickname TEXT, Primary_conference TEXT) CREATE TABLE basketball_match (Team_ID INT, School_ID INT, Team_Name TEXT, ACC_Regular_Season TEXT, ACC_Percent TEXT, ACC_Home TEXT, ACC_Road TEXT, All_Games TEXT, All_Games_Percent INT, All_Home TEXT, All_Road TEXT, All_Neutral TEXT)
Give me the comparison about Team_ID over the All_Home , and group by attribute ACC_Home by a bar chart.
SELECT All_Home, Team_ID FROM basketball_match GROUP BY ACC_Home, All_Home
SELECT "All_Home", "Team_ID" FROM "basketball_match" GROUP BY "ACC_Home", "All_Home"
0.082031
CREATE TABLE table_72882 ("Game" FLOAT, "Date" TEXT, "Team" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location Attendance" TEXT, "Record" TEXT)
What was the score in game 81?
SELECT "Score" FROM table_72882 WHERE "Game" = '81'
SELECT "Score" FROM "table_72882" WHERE "Game" = '81'
0.051758
CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
how much is the daily average weight of patient 21079 since 14 months ago?
SELECT AVG(chartevents.valuenum) FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 21079)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'admit wt' AND d_items.linksto = 'chartevents') AND DATETIME(chartevents.charttime) >= DATETIME(CURRENT_TIME(), '-14 month') GROUP BY STRFTIME('%y-%m-%d', chartevents.charttime)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 21079 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'admit wt' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT AVG("chartevents"."valuenum") FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE DATETIME("chartevents"."charttime") >= DATETIME(CURRENT_TIME(), '-14 month') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL GROUP BY STRFTIME('%y-%m-%d', "chartevents"."charttime")
0.807617
CREATE TABLE table_12792876_4 (tries_against VARCHAR, points VARCHAR)
Name the tries against for 87 points
SELECT tries_against FROM table_12792876_4 WHERE points = "87"
SELECT "tries_against" FROM "table_12792876_4" WHERE "87" = "points"
0.066406
CREATE TABLE table_name_69 (silver INT, gold VARCHAR, bronze VARCHAR)
How many silvers have 2 as gold, and a bronze less than 2?
SELECT SUM(silver) FROM table_name_69 WHERE gold = 2 AND bronze < 2
SELECT SUM("silver") FROM "table_name_69" WHERE "bronze" < 2 AND "gold" = 2
0.073242