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_86 (lost VARCHAR, tries_for VARCHAR)
What is the value for the item 'Lost' when the value 'Tries' is 47?
SELECT lost FROM table_name_86 WHERE tries_for = "47"
SELECT "lost" FROM "table_name_86" WHERE "47" = "tries_for"
0.057617
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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT)
count the number of times patient 029-6419 had been prescribed 0.4 ml syringe : enoxaparin sodium 40 mg/0.4ml sc soln?
SELECT COUNT(*) FROM medication WHERE medication.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '029-6419')) AND medication.drugname = '0.4 ml syringe : enoxaparin sodium 40 mg/0.4ml sc soln'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '029-6419' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "medication" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "medication"."patientunitstayid" WHERE "medication"."drugname" = '0.4 ml syringe : enoxaparin sodium 40 mg/0.4ml sc soln' AND NOT "_u_1"."" IS NULL
0.566406
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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE 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 Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other)
How many questions has this user answered since 2019-03-31?.
SELECT COUNT(a.Id) AS "# answers", SUM(a.ViewCount) AS "# views", SUM(a.Score) AS "# score" FROM Posts AS a WHERE a.OwnerUserId = '##UserId:int##' AND a.CreationDate >= '2019-03-31'
SELECT COUNT("a"."Id") AS "# answers", SUM("a"."ViewCount") AS "# views", SUM("a"."Score") AS "# score" FROM "Posts" AS "a" WHERE "a"."CreationDate" >= '2019-03-31' AND "a"."OwnerUserId" = '##UserId:int##'
0.200195
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 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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE 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 prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL)
hey what was the first cortisol of patient 57050 in this month?
SELECT labevents.valuenum FROM labevents WHERE labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 57050) AND labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'cortisol') AND DATETIME(labevents.charttime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') ORDER BY labevents.charttime LIMIT 1
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 57050 GROUP BY "hadm_id"), "_u_1" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'cortisol' GROUP BY "itemid") SELECT "labevents"."valuenum" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."hadm_id" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."itemid" WHERE DATETIME("labevents"."charttime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-0 month') AND NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL ORDER BY "labevents"."charttime" NULLS FIRST LIMIT 1
0.620117
CREATE TABLE table_10411 ("Class" TEXT, "Type" TEXT, "Quantity" FLOAT, "Date" TEXT, "LNER Class" TEXT, "1946 LNER nos." TEXT)
On what date was the type 2-8-0 with a O4 LNER Class?
SELECT "Date" FROM table_10411 WHERE "Type" = '2-8-0' AND "LNER Class" = 'o4'
SELECT "Date" FROM "table_10411" WHERE "LNER Class" = 'o4' AND "Type" = '2-8-0'
0.077148
CREATE TABLE table_name_32 (lost VARCHAR, losing_bonus VARCHAR, points_for VARCHAR)
WHAT IS THE LOST WITH 1 LOSING BONUS, 148 POINTS?
SELECT lost FROM table_name_32 WHERE losing_bonus = "1" AND points_for = "148"
SELECT "lost" FROM "table_name_32" WHERE "1" = "losing_bonus" AND "148" = "points_for"
0.083984
CREATE TABLE table_18606 ("District" TEXT, "Incumbent" TEXT, "Party" TEXT, "First elected" FLOAT, "Result" TEXT, "Candidates" TEXT)
Who is the sitting Representative In the New York 10 polling area race?
SELECT "Incumbent" FROM table_18606 WHERE "District" = 'New York 10'
SELECT "Incumbent" FROM "table_18606" WHERE "District" = 'New York 10'
0.068359
CREATE TABLE table_name_22 (alvin_greene__d_ VARCHAR, other VARCHAR)
What was the vote for Alvin Green when other was 9%?
SELECT alvin_greene__d_ FROM table_name_22 WHERE other = "9%"
SELECT "alvin_greene__d_" FROM "table_name_22" WHERE "9%" = "other"
0.06543
CREATE TABLE table_25740548_3 (original_air_date VARCHAR, production_code VARCHAR)
How many original air dates are there for the episode with code CA210?
SELECT COUNT(original_air_date) FROM table_25740548_3 WHERE production_code = "CA210"
SELECT COUNT("original_air_date") FROM "table_25740548_3" WHERE "CA210" = "production_code"
0.088867
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 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 program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) 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 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)
What time is 497 offered the next semester ?
SELECT DISTINCT course_offering.end_time, course_offering.friday, course_offering.monday, course_offering.saturday, course_offering.start_time, course_offering.sunday, course_offering.thursday, course_offering.tuesday, course_offering.wednesday FROM course, course_offering, semester WHERE course.course_id = course_offering.course_id AND course.department = 'EECS' AND course.number = 497 AND semester.semester = 'FA' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT DISTINCT "course_offering"."end_time", "course_offering"."friday", "course_offering"."monday", "course_offering"."saturday", "course_offering"."start_time", "course_offering"."sunday", "course_offering"."thursday", "course_offering"."tuesday", "course_offering"."wednesday" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'FA' AND "semester"."year" = 2016 WHERE "course"."department" = 'EECS' AND "course"."number" = 497
0.561523
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)
did patient 52598 have a procedure the last year.
SELECT COUNT(*) > 0 FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 52598) AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 52598 GROUP BY "hadm_id") SELECT COUNT(*) > 0 FROM "procedures_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL
0.368164
CREATE TABLE table_58083 ("Stadium" TEXT, "Capacity" TEXT, "Club" TEXT, "Division" TEXT, "Rank in Respective Divisions" TEXT)
What division has a Rank in Respective Divisions of 5, and is the Altrincham club?
SELECT "Division" FROM table_58083 WHERE "Rank in Respective Divisions" = '5' AND "Club" = 'altrincham'
SELECT "Division" FROM "table_58083" WHERE "Club" = 'altrincham' AND "Rank in Respective Divisions" = '5'
0.102539
CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE 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 inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
for the patients with 30s , what is the top three most frequent diagnosis for the patients?
SELECT d_icd_diagnoses.short_title FROM d_icd_diagnoses WHERE d_icd_diagnoses.icd9_code IN (SELECT t1.icd9_code FROM (SELECT diagnoses_icd.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM diagnoses_icd WHERE diagnoses_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.age BETWEEN 30 AND 39) GROUP BY diagnoses_icd.icd9_code) AS t1 WHERE t1.c1 <= 3)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."age" <= 39 AND "admissions"."age" >= 30 GROUP BY "hadm_id"), "t1" AS (SELECT "diagnoses_icd"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnoses_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "diagnoses_icd"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "diagnoses_icd"."icd9_code"), "_u_1" AS (SELECT "t1"."icd9_code" FROM "t1" AS "t1" WHERE "t1"."c1" <= 3 GROUP BY "icd9_code") SELECT "d_icd_diagnoses"."short_title" FROM "d_icd_diagnoses" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_diagnoses"."icd9_code" WHERE NOT "_u_1"."" IS NULL
0.649414
CREATE TABLE table_28136 ("Result" TEXT, "Date" TEXT, "Race" TEXT, "Venue" TEXT, "Group" TEXT, "Distance" TEXT, "Weight ( kg ) " TEXT, "Jockey" TEXT, "Winner/2nd" TEXT)
What group was sunline in when he was at moonee valley?
SELECT "Group" FROM table_28136 WHERE "Venue" = 'Moonee Valley'
SELECT "Group" FROM "table_28136" WHERE "Venue" = 'Moonee Valley'
0.063477
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 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 less than 56 years who have hyperglycemia primary disease?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "HYPERGLYCEMIA" AND demographic.age < "56"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "56" > "demographic"."age" AND "HYPERGLYCEMIA" = "demographic"."diagnosis"
0.145508
CREATE TABLE table_62786 ("Year" FLOAT, "Chassis" TEXT, "Engine" TEXT, "Start" FLOAT, "Finish" FLOAT, "Team" TEXT)
What year did Team of Andretti Green Racing have a finish smaller than 8 with a Dallara chassis?
SELECT "Year" FROM table_62786 WHERE "Chassis" = 'dallara' AND "Team" = 'andretti green racing' AND "Finish" < '8'
SELECT "Year" FROM "table_62786" WHERE "Chassis" = 'dallara' AND "Finish" < '8' AND "Team" = 'andretti green racing'
0.113281
CREATE TABLE table_76539 ("Tournament" TEXT, "Surface" TEXT, "Week" TEXT, "Winner" TEXT, "Finalist" TEXT, "Semifinalists" TEXT)
What tournament had finalist Monica Seles?
SELECT "Tournament" FROM table_76539 WHERE "Finalist" = 'monica seles'
SELECT "Tournament" FROM "table_76539" WHERE "Finalist" = 'monica seles'
0.070313
CREATE TABLE table_79458 ("Title" TEXT, "Series" TEXT, "Director" TEXT, "Production Number" FLOAT, "Release date" TEXT)
What is the highest production number released on 1955-04-02 with i. freleng as the director?
SELECT MAX("Production Number") FROM table_79458 WHERE "Director" = 'i. freleng' AND "Release date" = '1955-04-02'
SELECT MAX("Production Number") FROM "table_79458" WHERE "Director" = 'i. freleng' AND "Release date" = '1955-04-02'
0.113281
CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId 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 FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount 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 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 VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT)
Last-year comments like 'What have you tried' where an accepted answer is present.
SELECT c.Id AS "comment_link", c.Score, c.CreationDate, LENGTH(Text) FROM Comments AS c INNER JOIN Posts AS p ON c.PostId = p.Id WHERE Text LIKE 'What have you tried%' AND NOT p.AcceptedAnswerId IS NULL AND LENGTH(Text) < 33 AND p.CommentCount < '##CommentThread:int?4##' AND c.CreationDate >= '2014-01-01T00:00:00.000' AND c.CreationDate <= '2014-12-31T23:59:59.999' ORDER BY LENGTH(Text), c.Score DESC, c.CreationDate
SELECT "c"."Id" AS "comment_link", "c"."Score", "c"."CreationDate", LENGTH("Text") FROM "Comments" AS "c" JOIN "Posts" AS "p" ON "c"."PostId" = "p"."Id" AND "p"."CommentCount" < '##CommentThread:int?4##' AND NOT "p"."AcceptedAnswerId" IS NULL WHERE "Text" LIKE 'What have you tried%' AND "c"."CreationDate" <= '2014-12-31T23:59:59.999' AND "c"."CreationDate" >= '2014-01-01T00:00:00.000' AND LENGTH("Text") < 33 ORDER BY LENGTH("Text") NULLS FIRST, "c"."Score" DESC NULLS LAST, "c"."CreationDate" NULLS FIRST
0.496094
CREATE TABLE table_59067 ("Shooter" TEXT, "Event" TEXT, "Rank points" TEXT, "Score points" TEXT, "Total" TEXT)
Who is the shooter that is the Defending Champion?
SELECT "Shooter" FROM table_59067 WHERE "Total" = 'defending champion'
SELECT "Shooter" FROM "table_59067" WHERE "Total" = 'defending champion'
0.070313
CREATE TABLE table_5082 ("Rank" FLOAT, "Player" TEXT, "Country" TEXT, "Earnings ( $ ) " FLOAT, "Events" FLOAT, "Wins" FLOAT)
Which events have a Rank of 1?
SELECT "Events" FROM table_5082 WHERE "Rank" = '1'
SELECT "Events" FROM "table_5082" WHERE "Rank" = '1'
0.050781
CREATE TABLE table_name_61 (driver VARCHAR, grid VARCHAR, constructor VARCHAR, laps VARCHAR)
Which driver for Maserati has more laps than 23 and a grid greater than 7?
SELECT driver FROM table_name_61 WHERE constructor = "maserati" AND laps > 23 AND grid > 7
SELECT "driver" FROM "table_name_61" WHERE "constructor" = "maserati" AND "grid" > 7 AND "laps" > 23
0.097656
CREATE TABLE table_6530 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Record" TEXT, "Game Site" TEXT, "Attendance" FLOAT)
Result of w 24 21, and a Week smaller than 6 had what sum of attendance?
SELECT SUM("Attendance") FROM table_6530 WHERE "Result" = 'w 24–21' AND "Week" < '6'
SELECT SUM("Attendance") FROM "table_6530" WHERE "Result" = 'w 24–21' AND "Week" < '6'
0.083984
CREATE TABLE table_43550 ("Official #" FLOAT, "TF1 #" FLOAT, "French title" TEXT, "English title" TEXT, "Air date ( France ) " TEXT, "Original Beechwood Bunny Tale / Source material" TEXT)
What is the Official # that has a French title of 'Pierre de Lune'?
SELECT "Official #" FROM table_43550 WHERE "French title" = 'pierre de lune'
SELECT "Official #" FROM "table_43550" WHERE "French title" = 'pierre de lune'
0.076172
CREATE TABLE table_10470082_5 (no VARCHAR, villains VARCHAR)
How many have Mrs. briar as a villain
SELECT COUNT(no) FROM table_10470082_5 WHERE villains = "Mrs. Briar"
SELECT COUNT("no") FROM "table_10470082_5" WHERE "Mrs. Briar" = "villains"
0.072266
CREATE TABLE Ref_Incident_Type (incident_type_code VARCHAR, incident_type_description VARCHAR) CREATE TABLE Ref_Detention_Type (detention_type_code VARCHAR, detention_type_description VARCHAR) CREATE TABLE Students_in_Detention (student_id INT, detention_id INT, incident_id INT) CREATE TABLE Students (student_id INT, address_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, date_first_rental DATETIME, date_left_university DATETIME, other_student_details VARCHAR) CREATE TABLE Ref_Address_Types (address_type_code VARCHAR, address_type_description VARCHAR) CREATE TABLE Student_Addresses (student_id INT, address_id INT, date_address_from DATETIME, date_address_to DATETIME, monthly_rental DECIMAL, other_details VARCHAR) CREATE TABLE Detention (detention_id INT, detention_type_code VARCHAR, teacher_id INT, datetime_detention_start DATETIME, datetime_detention_end DATETIME, detention_summary VARCHAR, other_details VARCHAR) CREATE TABLE Teachers (teacher_id INT, address_id INT, first_name VARCHAR, middle_name VARCHAR, last_name VARCHAR, gender VARCHAR, cell_mobile_number VARCHAR, email_address VARCHAR, other_details VARCHAR) CREATE TABLE Assessment_Notes (notes_id INT, student_id INT, teacher_id INT, date_of_notes DATETIME, text_of_notes VARCHAR, other_details VARCHAR) CREATE TABLE Behavior_Incident (incident_id INT, incident_type_code VARCHAR, student_id INT, date_incident_start DATETIME, date_incident_end DATETIME, incident_summary VARCHAR, recommendations VARCHAR, other_details VARCHAR) CREATE TABLE Addresses (address_id INT, line_1 VARCHAR, line_2 VARCHAR, line_3 VARCHAR, city VARCHAR, zip_postcode VARCHAR, state_province_county VARCHAR, country VARCHAR, other_address_details VARCHAR)
Give me the comparison about the average of monthly_rental over the date_address_from , and group by attribute other_details and bin date_address_from by weekday by a bar chart.
SELECT date_address_from, AVG(monthly_rental) FROM Student_Addresses GROUP BY other_details ORDER BY monthly_rental DESC
SELECT "date_address_from", AVG("monthly_rental") FROM "Student_Addresses" GROUP BY "other_details" ORDER BY "monthly_rental" DESC NULLS LAST
0.137695
CREATE TABLE table_name_49 (player VARCHAR, place VARCHAR, country VARCHAR)
Which player from the United States is in a place of T2?
SELECT player FROM table_name_49 WHERE place = "t2" AND country = "united states"
SELECT "player" FROM "table_name_49" WHERE "country" = "united states" AND "place" = "t2"
0.086914
CREATE TABLE table_39359 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
Which average Against has a Difference of 10, and a Lost smaller than 2?
SELECT AVG("Against") FROM table_39359 WHERE "Difference" = '10' AND "Lost" < '2'
SELECT AVG("Against") FROM "table_39359" WHERE "Difference" = '10' AND "Lost" < '2'
0.081055
CREATE TABLE table_name_56 (crowd INT, venue VARCHAR)
How large was the crowd when they played at princes park?
SELECT SUM(crowd) FROM table_name_56 WHERE venue = "princes park"
SELECT SUM("crowd") FROM "table_name_56" WHERE "princes park" = "venue"
0.069336
CREATE TABLE table_name_20 (to_par INT, player VARCHAR)
What is the average To Par, when Player is 'Billy Casper'?
SELECT AVG(to_par) FROM table_name_20 WHERE player = "billy casper"
SELECT AVG("to_par") FROM "table_name_20" WHERE "billy casper" = "player"
0.071289
CREATE TABLE table_name_31 (points_for VARCHAR, played VARCHAR, club VARCHAR)
What points has 18 for the played and bala rfc as the club?
SELECT points_for FROM table_name_31 WHERE played = "18" AND club = "bala rfc"
SELECT "points_for" FROM "table_name_31" WHERE "18" = "played" AND "bala rfc" = "club"
0.083984
CREATE TABLE table_21573750_2 (asian_team_classification VARCHAR, asian_rider_classification VARCHAR)
When samai amari is the asian rider classification how many asian team classifications are there?
SELECT COUNT(asian_team_classification) FROM table_21573750_2 WHERE asian_rider_classification = "Samai Amari"
SELECT COUNT("asian_team_classification") FROM "table_21573750_2" WHERE "Samai Amari" = "asian_rider_classification"
0.113281
CREATE TABLE table_name_81 (birthplace VARCHAR, agency VARCHAR, generation VARCHAR)
What's the birthplace of the third (2009) generation member from the lespros entertainment agency?
SELECT birthplace FROM table_name_81 WHERE agency = "lespros entertainment" AND generation = "third (2009)"
SELECT "birthplace" FROM "table_name_81" WHERE "agency" = "lespros entertainment" AND "generation" = "third (2009)"
0.112305
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 demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
provide the number of patients whose year of birth is less than 2066 and diagnoses short title is wheelchair dependence?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.dob_year < "2066" AND diagnoses.short_title = "Wheelchair dependence"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Wheelchair dependence" = "diagnoses"."short_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "2066" > "demographic"."dob_year"
0.226563
CREATE TABLE table_66429 ("Millewa" TEXT, "Wins" FLOAT, "Forfeits" FLOAT, "Losses" FLOAT, "Draws" FLOAT, "Against" FLOAT)
How many Forfeits have Wins smaller than 8, and Losses larger than 16?
SELECT COUNT("Forfeits") FROM table_66429 WHERE "Wins" < '8' AND "Losses" > '16'
SELECT COUNT("Forfeits") FROM "table_66429" WHERE "Losses" > '16' AND "Wins" < '8'
0.080078
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
How many patients born before 1821 were prescribed nystatin cream?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.dob_year < "1821" AND prescriptions.drug = "Nystatin Cream"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "Nystatin Cream" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "1821" > "demographic"."dob_year"
0.224609
CREATE TABLE table_54746 ("Father" TEXT, "Birth" TEXT, "Marriage" TEXT, "Became Queen" TEXT, "Ceased to be Queen" TEXT, "Death" TEXT, "Spouse" TEXT)
Leopold VI, Duke of Austria is the father-in-law of which person?
SELECT "Spouse" FROM table_54746 WHERE "Father" = 'leopold vi, duke of austria'
SELECT "Spouse" FROM "table_54746" WHERE "Father" = 'leopold vi, duke of austria'
0.079102
CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL)
Group and count the city attribute of the location table to visualize a bar chart.
SELECT CITY, COUNT(CITY) FROM locations GROUP BY CITY
SELECT "CITY", COUNT("CITY") FROM "locations" GROUP BY "CITY"
0.05957
CREATE TABLE table_1341577_14 (party VARCHAR, incumbent VARCHAR)
To what party does Cardiss Collins belong?
SELECT party FROM table_1341577_14 WHERE incumbent = "Cardiss Collins"
SELECT "party" FROM "table_1341577_14" WHERE "Cardiss Collins" = "incumbent"
0.074219
CREATE TABLE publication (Publication_ID INT, Book_ID INT, Publisher TEXT, Publication_Date TEXT, Price FLOAT) CREATE TABLE book (Book_ID INT, Title TEXT, Issues FLOAT, Writer TEXT)
Compute the total the total number across publisher as a pie chart.
SELECT Publisher, COUNT(*) FROM publication GROUP BY Publisher
SELECT "Publisher", COUNT(*) FROM "publication" GROUP BY "Publisher"
0.066406
CREATE TABLE table_29572583_20 (status VARCHAR, seed VARCHAR)
what is the status for seed 14
SELECT status FROM table_29572583_20 WHERE seed = 14
SELECT "status" FROM "table_29572583_20" WHERE "seed" = 14
0.056641
CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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)
what is insurance of subject id 2560?
SELECT demographic.insurance FROM demographic WHERE demographic.subject_id = "2560"
SELECT "demographic"."insurance" FROM "demographic" WHERE "2560" = "demographic"."subject_id"
0.09082
CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost 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_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE 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_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
how many times has patient 1784 produced an urine . output today?
SELECT COUNT(*) FROM outputevents WHERE outputevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 1784)) AND outputevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'urine .' AND d_items.linksto = 'outputevents') AND DATETIME(outputevents.charttime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 1784 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" = 'urine .' AND "d_items"."linksto" = 'outputevents' GROUP BY "itemid") SELECT COUNT(*) FROM "outputevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "outputevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "outputevents"."itemid" WHERE DATETIME("outputevents"."charttime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL
0.761719
CREATE TABLE news_report (journalist_ID INT, Event_ID INT, Work_Type TEXT) CREATE TABLE journalist (journalist_ID INT, Name TEXT, Nationality TEXT, Age TEXT, Years_working INT) CREATE TABLE event (Event_ID INT, Date TEXT, Venue TEXT, Name TEXT, Event_Attendance INT)
Show the names of journalists and the number of events they reported Visualize by bar chart, could you show by the Y in descending?
SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name ORDER BY COUNT(*) DESC
SELECT "T3"."Name", COUNT(*) FROM "news_report" AS "T1" JOIN "event" AS "T2" ON "T1"."Event_ID" = "T2"."Event_ID" JOIN "journalist" AS "T3" ON "T1"."journalist_ID" = "T3"."journalist_ID" GROUP BY "T3"."Name" ORDER BY COUNT(*) DESC NULLS LAST
0.235352
CREATE TABLE table_name_41 (transfer_fee VARCHAR, name VARCHAR, source VARCHAR, country VARCHAR)
What is henry transfer fee at fcbarcelona.cat in fra?
SELECT transfer_fee FROM table_name_41 WHERE source = "fcbarcelona.cat" AND country = "fra" AND name = "henry"
SELECT "transfer_fee" FROM "table_name_41" WHERE "country" = "fra" AND "fcbarcelona.cat" = "source" AND "henry" = "name"
0.117188
CREATE TABLE table_1134091_4 (successor VARCHAR, vacator VARCHAR)
Who was the successor when the vacator was chester e. holifield (d)?
SELECT successor FROM table_1134091_4 WHERE vacator = "Chester E. Holifield (D)"
SELECT "successor" FROM "table_1134091_4" WHERE "Chester E. Holifield (D)" = "vacator"
0.083984
CREATE TABLE table_name_57 (team_2 VARCHAR)
What is 2nd Leg, when Team 2 is 'Dunaferr'?
SELECT 2 AS nd_leg FROM table_name_57 WHERE team_2 = "dunaferr"
SELECT 2 AS "nd_leg" FROM "table_name_57" WHERE "dunaferr" = "team_2"
0.067383
CREATE TABLE table_70316 ("Date" TEXT, "Opponent" TEXT, "Score" TEXT, "Loss" TEXT, "Attendance" FLOAT, "Record" TEXT)
What was the Blue Jays lowest attendance when their record was 52-48?
SELECT MIN("Attendance") FROM table_70316 WHERE "Record" = '52-48'
SELECT MIN("Attendance") FROM "table_70316" WHERE "Record" = '52-48'
0.066406
CREATE TABLE table_name_70 (model_number VARCHAR, part_number_s_ VARCHAR)
What is Model Number, when Part Number(s) is AY80609003987AB?
SELECT model_number FROM table_name_70 WHERE part_number_s_ = "ay80609003987ab"
SELECT "model_number" FROM "table_name_70" WHERE "ay80609003987ab" = "part_number_s_"
0.083008
CREATE TABLE table_204_408 (id DECIMAL, "nation" TEXT, "1986" TEXT, "1989" TEXT, "1991" TEXT, "1997" TEXT, "1999" TEXT, "2000" TEXT, "2003" TEXT, "2005" TEXT, "2007" TEXT, "2009" TEXT, "2011" TEXT, "years" DECIMAL)
who placed first in 2007 ?
SELECT "nation" FROM table_204_408 WHERE "2007" = 1
SELECT "nation" FROM "table_204_408" WHERE "2007" = 1
0.051758
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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 procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
what is admission type of subject name dona cole?
SELECT demographic.admission_type FROM demographic WHERE demographic.name = "Dona Cole"
SELECT "demographic"."admission_type" FROM "demographic" WHERE "Dona Cole" = "demographic"."name"
0.094727
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_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 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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label 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 cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
what did patient 14203 receive for his or her first procedure since 6 years ago?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT procedures_icd.icd9_code FROM procedures_icd WHERE procedures_icd.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 14203) AND DATETIME(procedures_icd.charttime) >= DATETIME(CURRENT_TIME(), '-6 year') ORDER BY procedures_icd.charttime LIMIT 1)
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 14203 GROUP BY "hadm_id") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" WHERE "d_icd_procedures"."icd9_code" IN (SELECT "procedures_icd"."icd9_code" FROM "procedures_icd" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime") >= DATETIME(CURRENT_TIME(), '-6 year') AND NOT "_u_0"."" IS NULL ORDER BY "procedures_icd"."charttime" NULLS FIRST LIMIT 1)
0.511719
CREATE TABLE table_25597 ("No." FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( in millions ) " TEXT, "18-49 Rating/Share" TEXT)
What was the original air date of episode number 1?
SELECT "Original air date" FROM table_25597 WHERE "No." = '1'
SELECT "Original air date" FROM "table_25597" WHERE "No." = '1'
0.061523
CREATE TABLE table_26561 ("DVD Name" TEXT, "Ep #" TEXT, "Region 1 ( US ) " TEXT, "Region 1 ( CAN ) " TEXT, "Region 2 ( UK ) " TEXT, "Region 2 ( Germany ) " TEXT, "Region 4 ( Australia ) " TEXT)
How many region 4 dates are associated with a region 2 date of July 9, 2007?
SELECT COUNT("Region 4 (Australia)") FROM table_26561 WHERE "Region 2 (UK)" = 'July 9, 2007'
SELECT COUNT("Region 4 (Australia)") FROM "table_26561" WHERE "Region 2 (UK)" = 'July 9, 2007'
0.091797
CREATE TABLE table_24074130_5 (surface VARCHAR, against VARCHAR)
What is every surface against Sweden?
SELECT surface FROM table_24074130_5 WHERE against = "Sweden"
SELECT "surface" FROM "table_24074130_5" WHERE "Sweden" = "against"
0.06543
CREATE TABLE table_15247 ("Goal" FLOAT, "Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
What was the final score in a 2002 fifa world cup qualification that was less than 10?
SELECT "Result" FROM table_15247 WHERE "Competition" = '2002 fifa world cup qualification' AND "Goal" < '10'
SELECT "Result" FROM "table_15247" WHERE "Competition" = '2002 fifa world cup qualification' AND "Goal" < '10'
0.107422
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
provide the number of patients whose admission year is less than 2125 and diagnoses long title is unspecified intestinal obstruction?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN diagnoses ON demographic.hadm_id = diagnoses.hadm_id WHERE demographic.admityear < "2125" AND diagnoses.long_title = "Unspecified intestinal obstruction"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "diagnoses" ON "Unspecified intestinal obstruction" = "diagnoses"."long_title" AND "demographic"."hadm_id" = "diagnoses"."hadm_id" WHERE "2125" > "demographic"."admityear"
0.239258
CREATE TABLE election (Date VARCHAR, Vote_Percent VARCHAR)
List the dates and vote percents of elections.
SELECT Date, Vote_Percent FROM election
SELECT "Date", "Vote_Percent" FROM "election"
0.043945
CREATE TABLE table_76012 ("Publication" TEXT, "Country" TEXT, "Accolade" TEXT, "Year" FLOAT, "Rank" TEXT)
Which publication happened in the UK?
SELECT "Publication" FROM table_76012 WHERE "Country" = 'uk'
SELECT "Publication" FROM "table_76012" WHERE "Country" = 'uk'
0.060547
CREATE TABLE table_name_11 (gold INT, nation VARCHAR, total VARCHAR)
How many golds for west germany with over 8 total?
SELECT MIN(gold) FROM table_name_11 WHERE nation = "west germany" AND total > 8
SELECT MIN("gold") FROM "table_name_11" WHERE "nation" = "west germany" AND "total" > 8
0.084961
CREATE TABLE table_74980 ("Round" FLOAT, "Pick #" FLOAT, "Overall" FLOAT, "Name" TEXT, "Position" TEXT, "College" TEXT)
What is Aundray Bruce's Pick #?
SELECT "Pick #" FROM table_74980 WHERE "Name" = 'aundray bruce'
SELECT "Pick #" FROM "table_74980" WHERE "Name" = 'aundray bruce'
0.063477
CREATE TABLE table_14754471_1 (free_reduced_lunch___percentage_ VARCHAR, hispanic___percentage_ VARCHAR)
What percentage of free/reduced lunch are there when the hispanic percentage is 3.7?
SELECT free_reduced_lunch___percentage_ FROM table_14754471_1 WHERE hispanic___percentage_ = "3.7"
SELECT "free_reduced_lunch___percentage_" FROM "table_14754471_1" WHERE "3.7" = "hispanic___percentage_"
0.101563
CREATE TABLE table_52265 ("model" TEXT, "cylinders/ valves" TEXT, "displacement cc" FLOAT, "max. power kW ( PS ) at rpm" TEXT, "max. torque ( Nm ) at rpm" TEXT, "engine code" TEXT, "top speed ( km/h ) " FLOAT, "production period" TEXT)
What is the top speed of the model 1.8 20v t?
SELECT SUM("top speed (km/h)") FROM table_52265 WHERE "model" = '1.8 20v t'
SELECT SUM("top speed (km/h)") FROM "table_52265" WHERE "model" = '1.8 20v t'
0.075195
CREATE TABLE table_25589 ("Stage" FLOAT, "Winner" TEXT, "General classification" TEXT, "Mountains classification" TEXT, "Points classification" TEXT, "Sprints classification" TEXT, "Team classification" TEXT)
If the winner is Bernhard Eisel, what is the stage maximum?
SELECT MAX("Stage") FROM table_25589 WHERE "Winner" = 'Bernhard Eisel'
SELECT MAX("Stage") FROM "table_25589" WHERE "Winner" = 'Bernhard Eisel'
0.070313
CREATE TABLE products (code DECIMAL, name TEXT, price DECIMAL, manufacturer DECIMAL) CREATE TABLE manufacturers (code DECIMAL, name TEXT, headquarter TEXT, founder TEXT, revenue DECIMAL)
Who is the founders of companies whose first letter is S?
SELECT founder FROM manufacturers WHERE name LIKE 'S%'
SELECT "founder" FROM "manufacturers" WHERE "name" LIKE 'S%'
0.058594
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)
Draw a bar chart about the distribution of ACC_Road and the average of Team_ID , and group by attribute ACC_Road, and order in asc by the X-axis.
SELECT ACC_Road, AVG(Team_ID) FROM basketball_match GROUP BY ACC_Road ORDER BY ACC_Road
SELECT "ACC_Road", AVG("Team_ID") FROM "basketball_match" GROUP BY "ACC_Road" ORDER BY "ACC_Road" NULLS FIRST
0.106445
CREATE TABLE table_name_56 (year VARCHAR, champion VARCHAR, runner_up VARCHAR)
When Ilie N stase beat runner-up Peter Fleming what year was it?
SELECT COUNT(year) FROM table_name_56 WHERE champion = "ilie năstase" AND runner_up = "peter fleming"
SELECT COUNT("year") FROM "table_name_56" WHERE "champion" = "ilie năstase" AND "peter fleming" = "runner_up"
0.106445
CREATE TABLE table_train_15 ("id" INT, "granulocyte_deficiency" BOOLEAN, "immune_suppression" BOOLEAN, "hiv_infection" BOOLEAN, "immune_deficiency_disorder" BOOLEAN, "tumor" BOOLEAN, "limited_care" BOOLEAN, "NOUSE" FLOAT)
hiv positive patients.
SELECT * FROM table_train_15 WHERE hiv_infection = 1
SELECT * FROM "table_train_15" WHERE "hiv_infection" = 1
0.054688
CREATE TABLE table_name_72 (format VARCHAR, date VARCHAR)
Which format is released on August 29, 1998?
SELECT format FROM table_name_72 WHERE date = "august 29, 1998"
SELECT "format" FROM "table_name_72" WHERE "august 29, 1998" = "date"
0.067383
CREATE TABLE table_62617 ("Opposing Teams" TEXT, "Against" FLOAT, "Date" TEXT, "Venue" TEXT, "Status" TEXT)
What is Status, when Opposing Teams is 'Scotland'?
SELECT "Status" FROM table_62617 WHERE "Opposing Teams" = 'scotland'
SELECT "Status" FROM "table_62617" WHERE "Opposing Teams" = 'scotland'
0.068359
CREATE TABLE time_slot (time_slot_id VARCHAR, day VARCHAR, start_hr DECIMAL, start_min DECIMAL, end_hr DECIMAL, end_min DECIMAL) CREATE TABLE student (ID VARCHAR, name VARCHAR, dept_name VARCHAR, tot_cred DECIMAL) CREATE TABLE classroom (building VARCHAR, room_number VARCHAR, capacity DECIMAL) CREATE TABLE section (course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, building VARCHAR, room_number VARCHAR, time_slot_id VARCHAR) CREATE TABLE advisor (s_ID VARCHAR, i_ID VARCHAR) CREATE TABLE takes (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL, grade VARCHAR) CREATE TABLE course (course_id VARCHAR, title VARCHAR, dept_name VARCHAR, credits DECIMAL) CREATE TABLE teaches (ID VARCHAR, course_id VARCHAR, sec_id VARCHAR, semester VARCHAR, year DECIMAL) CREATE TABLE prereq (course_id VARCHAR, prereq_id VARCHAR) CREATE TABLE instructor (ID VARCHAR, name VARCHAR, dept_name VARCHAR, salary DECIMAL) CREATE TABLE department (dept_name VARCHAR, building VARCHAR, budget DECIMAL)
Visualize the relationship between ID and salary .
SELECT ID, salary FROM instructor ORDER BY salary
SELECT "ID", "salary" FROM "instructor" ORDER BY "salary" NULLS FIRST
0.067383
CREATE TABLE table_204_114 (id DECIMAL, "pos" TEXT, "rider" TEXT, "manufacturer" TEXT, "time/retired" TEXT, "grid" DECIMAL, "points" DECIMAL)
what is the difference in points scored between erwan nigon and dirk heidolf ?
SELECT ABS((SELECT "points" FROM table_204_114 WHERE "rider" = 'erwan nigon') - (SELECT "points" FROM table_204_114 WHERE "rider" = 'dirk heidolf'))
SELECT ABS((SELECT "points" FROM "table_204_114" WHERE "rider" = 'erwan nigon') - (SELECT "points" FROM "table_204_114" WHERE "rider" = 'dirk heidolf'))
0.148438
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 gsi (course_offering_id INT, student_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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT)
For elective classes , which ones offered before noon are considered upper level ?
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, program_course, semester WHERE course_offering.end_time <= '12:00:00' AND course.course_id = course_offering.course_id AND program_course.category LIKE '%ULCS%' AND program_course.course_id = course.course_id AND semester.semester = 'WN' AND semester.semester_id = course_offering.semester AND semester.year = 2016
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" AND "course_offering"."end_time" <= '12:00:00' JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%ULCS%' JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND "semester"."semester" = 'WN' AND "semester"."year" = 2016
0.461914
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE 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 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)
had any volume (ml) fentanyl been given to patient 021-32860 since 05/2104?
SELECT COUNT(*) > 0 FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '021-32860')) AND intakeoutput.cellpath LIKE '%intake%' AND intakeoutput.celllabel = 'volume (ml) fentanyl' AND STRFTIME('%y-%m', intakeoutput.intakeoutputtime) >= '2104-05'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '021-32860' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) > 0 FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'volume (ml) fentanyl' AND "intakeoutput"."cellpath" LIKE '%intake%' AND NOT "_u_1"."" IS NULL AND STRFTIME('%y-%m', "intakeoutput"."intakeoutputtime") >= '2104-05'
0.658203
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE 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)
what is the drug type and name for the drug code tacr1?
SELECT prescriptions.drug_type, prescriptions.drug FROM prescriptions WHERE prescriptions.formulary_drug_cd = "TACR1"
SELECT "prescriptions"."drug_type", "prescriptions"."drug" FROM "prescriptions" WHERE "TACR1" = "prescriptions"."formulary_drug_cd"
0.12793
CREATE TABLE table_name_77 (country VARCHAR, player VARCHAR)
What country does Rocco Mediate play for?
SELECT country FROM table_name_77 WHERE player = "rocco mediate"
SELECT "country" FROM "table_name_77" WHERE "player" = "rocco mediate"
0.068359
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)
Give me the comparison about the sum of Team_ID over the All_Home , and group by attribute All_Home by a bar chart.
SELECT All_Home, SUM(Team_ID) FROM basketball_match GROUP BY All_Home
SELECT "All_Home", SUM("Team_ID") FROM "basketball_match" GROUP BY "All_Home"
0.075195
CREATE TABLE table_28731 ("Institution" TEXT, "Location" TEXT, "Team Nickname" TEXT, "Years" TEXT, "New Conference" TEXT, "New Classification" TEXT)
How many new conferences are in the NCLL deep south conference?
SELECT COUNT("New Conference") FROM table_28731 WHERE "New Classification" = 'NCLL Deep South Conference'
SELECT COUNT("New Conference") FROM "table_28731" WHERE "New Classification" = 'NCLL Deep South Conference'
0.104492
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
among patients who had a hospital stay of more than 8 days, how many of them belonged to white ethnic origin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.ethnicity = "WHITE" AND demographic.days_stay > "8"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "8" < "demographic"."days_stay" AND "WHITE" = "demographic"."ethnicity"
0.142578
CREATE TABLE table_name_74 (state VARCHAR, circuit VARCHAR)
In which state can you find the Sandown circuit?
SELECT state FROM table_name_74 WHERE circuit = "sandown"
SELECT "state" FROM "table_name_74" WHERE "circuit" = "sandown"
0.061523
CREATE TABLE table_name_84 (surface VARCHAR, opponent_in_the_final VARCHAR)
On which surface did Mathieu play against Antonio Vei ?
SELECT surface FROM table_name_84 WHERE opponent_in_the_final = "antonio veić"
SELECT "surface" FROM "table_name_84" WHERE "antonio veić" = "opponent_in_the_final"
0.082031
CREATE TABLE screen_mode (graphics_mode DECIMAL, char_cells TEXT, pixels TEXT, hardware_colours DECIMAL, used_kb DECIMAL, map TEXT, type TEXT) CREATE TABLE chip_model (model_name TEXT, launch_year DECIMAL, ram_mib DECIMAL, rom_mib DECIMAL, slots TEXT, wifi TEXT, bluetooth TEXT) CREATE TABLE phone (company_name TEXT, hardware_model_name TEXT, accreditation_type TEXT, accreditation_level TEXT, date TEXT, chip_model TEXT, screen_mode TEXT)
List the hardware model name for the phones that were produced by 'Nokia Corporation' or whose screen mode type is 'Graphics.
SELECT DISTINCT T2.hardware_model_name FROM screen_mode AS T1 JOIN phone AS T2 ON T1.graphics_mode = T2.screen_mode WHERE T1.type = "Graphics" OR t2.company_name = "Nokia Corporation"
SELECT DISTINCT "T2"."hardware_model_name" FROM "screen_mode" AS "T1" JOIN "phone" AS "T2" ON "T1"."graphics_mode" = "T2"."screen_mode" WHERE "Graphics" = "T1"."type" OR "Nokia Corporation" = "t2"."company_name"
0.206055
CREATE TABLE table_21154679_1 (torque VARCHAR, model VARCHAR)
What is the s7 4.0 tfsi quattro engine torque?
SELECT torque FROM table_21154679_1 WHERE model = "S7 4.0 TFSI quattro"
SELECT "torque" FROM "table_21154679_1" WHERE "S7 4.0 TFSI quattro" = "model"
0.075195
CREATE TABLE table_61987 ("Player" TEXT, "Country" TEXT, "Year ( s ) won" TEXT, "Total" FLOAT, "To par" FLOAT)
WHAT YEAR HAS A TO PAR SMALLER THAN 16, TOTAL 151?
SELECT "Year(s) won" FROM table_61987 WHERE "To par" < '16' AND "Total" = '151'
SELECT "Year(s) won" FROM "table_61987" WHERE "To par" < '16' AND "Total" = '151'
0.079102
CREATE TABLE table_name_48 (notes VARCHAR, rank VARCHAR, time VARCHAR)
What are the notes for the person ranked larger than 2, and a time of 1:48.179?
SELECT notes FROM table_name_48 WHERE rank > 2 AND time = "1:48.179"
SELECT "notes" FROM "table_name_48" WHERE "1:48.179" = "time" AND "rank" > 2
0.074219
CREATE TABLE table_45086 ("Position" FLOAT, "Team" TEXT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Goals For" FLOAT, "Goals Against" FLOAT, "Goal Difference" TEXT, "Points 1" FLOAT)
What is the fewest goals for when goal difference is +10 and goals against is more than 61?
SELECT MIN("Goals For") FROM table_45086 WHERE "Goal Difference" = '+10' AND "Goals Against" > '61'
SELECT MIN("Goals For") FROM "table_45086" WHERE "Goal Difference" = '+10' AND "Goals Against" > '61'
0.098633
CREATE TABLE table_1146 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Record" TEXT, "Game Site" TEXT, "Attendance" FLOAT)
Name the record when attendance 42827
SELECT "Record" FROM table_1146 WHERE "Attendance" = '42827'
SELECT "Record" FROM "table_1146" WHERE "Attendance" = '42827'
0.060547
CREATE TABLE table_40683 ("Tournament" TEXT, "Wins" FLOAT, "Top-5" FLOAT, "Top-10" FLOAT, "Top-25" FLOAT, "Events" FLOAT, "Cuts made" FLOAT)
What is the Wins with a Top-25 of 3, and a Top-5 larger than 1?
SELECT AVG("Wins") FROM table_40683 WHERE "Top-25" = '3' AND "Top-5" > '1'
SELECT AVG("Wins") FROM "table_40683" WHERE "Top-25" = '3' AND "Top-5" > '1'
0.074219
CREATE TABLE table_203_400 (id DECIMAL, "district" TEXT, "vacator" TEXT, "reason for change" TEXT, "successor" TEXT, "date successor\ seated" TEXT)
what are the total number of successors that are listed as being a democrat -lrb- d -rrb- ?
SELECT COUNT(*) FROM table_203_400 WHERE "successor" = 'd'
SELECT COUNT(*) FROM "table_203_400" WHERE "successor" = 'd'
0.058594
CREATE TABLE table_61586 ("Year" FLOAT, "Award" TEXT, "Category" TEXT, "Nominated" TEXT, "Result" TEXT)
What is the category that came before 2011?
SELECT "Category" FROM table_61586 WHERE "Year" < '2011'
SELECT "Category" FROM "table_61586" WHERE "Year" < '2011'
0.056641
CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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 job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees whose salary is in the range of 8000 and 12000 and commission is not null or department number does not equal to 40, find job_id and the average of department_id , and group by attribute job_id, and visualize them by a bar chart, could you rank in ascending by the names?
SELECT JOB_ID, AVG(DEPARTMENT_ID) FROM employees WHERE SALARY BETWEEN 8000 AND 12000 AND COMMISSION_PCT <> "null" OR DEPARTMENT_ID <> 40 GROUP BY JOB_ID ORDER BY JOB_ID
SELECT "JOB_ID", AVG("DEPARTMENT_ID") FROM "employees" WHERE ("COMMISSION_PCT" <> "null" OR "DEPARTMENT_ID" <> 40) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" <= 12000) AND ("DEPARTMENT_ID" <> 40 OR "SALARY" >= 8000) GROUP BY "JOB_ID" ORDER BY "JOB_ID" NULLS FIRST
0.25293
CREATE TABLE table_203_372 (id DECIMAL, "from" DECIMAL, "to" DECIMAL, "name" TEXT, "party" TEXT, "position" DECIMAL)
which party won the most number of time ?
SELECT "party" FROM table_203_372 GROUP BY "party" ORDER BY COUNT(*) DESC LIMIT 1
SELECT "party" FROM "table_203_372" GROUP BY "party" ORDER BY COUNT(*) DESC NULLS LAST LIMIT 1
0.091797
CREATE TABLE table_23284271_10 (team VARCHAR, high_rebounds VARCHAR)
Which team has dirk nowitski (13) as high rebounds?
SELECT team FROM table_23284271_10 WHERE high_rebounds = "Dirk Nowitski (13)"
SELECT "team" FROM "table_23284271_10" WHERE "Dirk Nowitski (13)" = "high_rebounds"
0.081055
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT)
how many patients whose discharge location is home health care and procedure short title is endosc destr stomach les?
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.short_title = "Endosc destr stomach les"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Endosc destr stomach les" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "HOME HEALTH CARE" = "demographic"."discharge_location"
0.253906
CREATE TABLE table_50602 ("Oklahoma vs." TEXT, "Overall Record" TEXT, "at Norman" TEXT, "at Opponent's Venue" TEXT, "at Neutral Site" TEXT, "Last 5 Meetings" TEXT, "Last 10 Meetings" TEXT, "Current Streak" TEXT, "Since Beginning of Big 12" TEXT)
What is Oklahoma vs. when Current Streak is l 1, and Neutral Site is osu, 7-6?
SELECT "Oklahoma vs." FROM table_50602 WHERE "Current Streak" = 'l 1' AND "at Neutral Site" = 'osu, 7-6'
SELECT "Oklahoma vs." FROM "table_50602" WHERE "Current Streak" = 'l 1' AND "at Neutral Site" = 'osu, 7-6'
0.103516
CREATE TABLE Customers (customer_id INT, payment_method_code VARCHAR, customer_number VARCHAR, customer_name VARCHAR, customer_address VARCHAR, customer_phone VARCHAR, customer_email VARCHAR) CREATE TABLE Customer_Address_History (customer_id INT, address_id INT, date_from DATETIME, date_to DATETIME) CREATE TABLE Order_Items (order_item_id INT, order_id INT, product_id INT, order_quantity VARCHAR) CREATE TABLE Contacts (contact_id INT, customer_id INT, gender VARCHAR, first_name VARCHAR, last_name VARCHAR, contact_phone VARCHAR) CREATE TABLE Products (product_id INT, product_type_code VARCHAR, product_name VARCHAR, product_price DOUBLE) CREATE TABLE Addresses (address_id INT, line_1_number_building VARCHAR, city VARCHAR, zip_postcode VARCHAR, state_province_county VARCHAR, country VARCHAR) CREATE TABLE Customer_Orders (order_id INT, customer_id INT, order_date DATETIME, order_status_code VARCHAR)
Show the number of customer address history in each day and group by date to with a line chart, and could you rank X in descending order?
SELECT date_to, COUNT(date_to) FROM Customer_Address_History AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id JOIN Addresses AS T3 ON T1.address_id = T3.address_id GROUP BY date_to ORDER BY date_to DESC
SELECT "date_to", COUNT("date_to") FROM "Customer_Address_History" AS "T1" JOIN "Customers" AS "T2" ON "T1"."customer_id" = "T2"."customer_id" JOIN "Addresses" AS "T3" ON "T1"."address_id" = "T3"."address_id" GROUP BY "date_to" ORDER BY "date_to" DESC NULLS LAST
0.255859
CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE 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)
Show me a bar chart for what are all the employee ids and the names of the countries in which they work?, show Y from high to low order.
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) DESC
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") DESC NULLS LAST
0.333984
CREATE TABLE table_name_11 (year INT, finish VARCHAR, percentage VARCHAR)
What is the average Year for the Finish of lost 2001 alcs and the Percentage is over 0.716?
SELECT AVG(year) FROM table_name_11 WHERE finish = "lost 2001 alcs" AND percentage > 0.716
SELECT AVG("year") FROM "table_name_11" WHERE "finish" = "lost 2001 alcs" AND "percentage" > 0.716
0.095703
CREATE TABLE table_57569 ("Coach" TEXT, "Season" TEXT, "Record" TEXT, "Home" TEXT, "Away" TEXT, "Win %" FLOAT, "Average ( Total ) Home Attendance" TEXT)
What was the away score with a win% of 0.75 and average total/home attendance of 4,686 (18,744)?
SELECT "Away" FROM table_57569 WHERE "Win %" = '0.75' AND "Average (Total) Home Attendance" = '4,686 (18,744)'
SELECT "Away" FROM "table_57569" WHERE "Average (Total) Home Attendance" = '4,686 (18,744)' AND "Win %" = '0.75'
0.109375
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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime 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 diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME)
what were the five most commonly prescribed drugs at the same time in this year for patients who were prescribed famotidine (pf) 20 mg/2 ml iv soln?
SELECT t3.drugname FROM (SELECT t2.drugname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'famotidine (pf) 20 mg/2 ml iv soln' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE DATETIME(t1.drugstarttime) = DATETIME(t2.drugstarttime) GROUP BY t2.drugname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')), "t3" AS (SELECT "t2"."drugname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "patient"."uniquepid" = "t2"."uniquepid" AND DATETIME("medication"."drugstarttime") = DATETIME("t2"."drugstarttime") WHERE "medication"."drugname" = 'famotidine (pf) 20 mg/2 ml iv soln' AND DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') GROUP BY "t2"."drugname") SELECT "t3"."drugname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5
0.901367