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_55171 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
What date did Carlton play as the away team?
SELECT "Date" FROM table_55171 WHERE "Away team" = 'carlton'
SELECT "Date" FROM "table_55171" WHERE "Away team" = 'carlton'
0.060547
CREATE TABLE table_name_11 (places INT, nation VARCHAR, points VARCHAR)
What is the fewest number of places for a skater from Norway with fewer than 1524.9 points?
SELECT MIN(places) FROM table_name_11 WHERE nation = "norway" AND points < 1524.9
SELECT MIN("places") FROM "table_name_11" WHERE "nation" = "norway" AND "points" < 1524.9
0.086914
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
when did patient 004-34650 first receive bedside glucose lab test in 05/last year?
SELECT lab.labresulttime FROM lab WHERE lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-34650')) AND lab.labname = 'bedside glucose' AND DATETIME(lab.labresulttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', lab.labresulttime) = '05' ORDER BY lab.labresulttime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '004-34650' 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 "lab"."labresulttime" FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'bedside glucose' AND DATETIME("lab"."labresulttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "lab"."labresulttime") = '05' ORDER BY "lab"."labresulttime" NULLS FIRST LIMIT 1
0.723633
CREATE TABLE table_67955 ("Year" FLOAT, "Population ( Region total ) " FLOAT, "Population ( Stanthorpe ) " FLOAT, "Population ( Warwick ) " FLOAT, "Population ( Allora ) " FLOAT, "Population ( Glengallan ) " FLOAT, "Population ( Rosenthal ) " FLOAT)
What is the total population of Rosenthal that's less than 24,300 for the population and has a population for Glengallan less than 3,410?
SELECT SUM("Population (Rosenthal)") FROM table_67955 WHERE "Population (Region total)" < '24,300' AND "Population (Glengallan)" < '3,410'
SELECT SUM("Population (Rosenthal)") FROM "table_67955" WHERE "Population (Glengallan)" < '3,410' AND "Population (Region total)" < '24,300'
0.136719
CREATE TABLE table_204_496 (id DECIMAL, "pos" DECIMAL, "no" DECIMAL, "driver" TEXT, "team" TEXT, "laps" DECIMAL, "time/retired" TEXT, "grid" DECIMAL, "points" DECIMAL)
at the 2006 gran premio telmex , did oriol servia or katherine legge complete more laps ?
SELECT "driver" FROM table_204_496 WHERE "driver" IN ('oriol servia', 'katherine legge') ORDER BY "laps" DESC LIMIT 1
SELECT "driver" FROM "table_204_496" WHERE "driver" IN ('oriol servia', 'katherine legge') ORDER BY "laps" DESC NULLS LAST LIMIT 1
0.126953
CREATE TABLE table_name_69 (overall INT, college VARCHAR)
What is the average oveall pick for players from the college of Miami (FL)?
SELECT AVG(overall) FROM table_name_69 WHERE college = "miami (fl)"
SELECT AVG("overall") FROM "table_name_69" WHERE "college" = "miami (fl)"
0.071289
CREATE TABLE table_23995075_2 (qualifying_end_date VARCHAR)
What is the qualifying end date when the qualifying start date is qualifying start date?
SELECT qualifying_end_date FROM table_23995075_2 WHERE "qualifying_start_date" = "qualifying_start_date"
SELECT "qualifying_end_date" FROM "table_23995075_2" WHERE "qualifying_start_date" = "qualifying_start_date"
0.105469
CREATE TABLE station (name VARCHAR, lat VARCHAR, id VARCHAR) CREATE TABLE trip (duration INT, end_station_id VARCHAR)
For each station, find its latitude and the minimum duration of trips that ended at the station.
SELECT T1.name, T1.lat, MIN(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id
SELECT "T1"."name", "T1"."lat", MIN("T2"."duration") FROM "station" AS "T1" JOIN "trip" AS "T2" ON "T1"."id" = "T2"."end_station_id" GROUP BY "T2"."end_station_id"
0.15918
CREATE TABLE table_name_33 (score VARCHAR, set_1 VARCHAR)
What was the overall score when set 1 was 23 25?
SELECT score FROM table_name_33 WHERE set_1 = "23–25"
SELECT "score" FROM "table_name_33" WHERE "23–25" = "set_1"
0.057617
CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE course_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 requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE course_offering (offering_id INT, course_id INT, semester INT, section_number INT, start_time TIME, end_time TIME, monday VARCHAR, tuesday VARCHAR, wednesday VARCHAR, thursday VARCHAR, friday VARCHAR, saturday VARCHAR, sunday VARCHAR, has_final_project VARCHAR, has_final_exam VARCHAR, textbook VARCHAR, class_address VARCHAR, allow_audit VARCHAR) CREATE TABLE area (course_id INT, area VARCHAR) 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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR)
Which class is easier : EECS 633 or EECS 498 ?
SELECT DISTINCT course.number FROM course INNER JOIN program_course ON program_course.course_id = course.course_id WHERE (course.number = 633 OR course.number = 498) AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 INNER JOIN course AS COURSEalias1 ON PROGRAM_COURSEalias1.course_id = COURSEalias1.course_id WHERE (COURSEalias1.number = 633 OR COURSEalias1.number = 498) AND COURSEalias1.department = 'EECS')
WITH "_u_0" AS (SELECT MIN("PROGRAM_COURSEalias1"."workload") FROM "program_course" AS "PROGRAM_COURSEalias1" JOIN "course" AS "COURSEalias1" ON "COURSEalias1"."course_id" = "PROGRAM_COURSEalias1"."course_id" AND "COURSEalias1"."department" = 'EECS' AND ("COURSEalias1"."number" = 498 OR "COURSEalias1"."number" = 633)) SELECT DISTINCT "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "program_course"."workload" WHERE "course"."number" = 498 OR "course"."number" = 633
0.552734
CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE 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)
Most Viewed Questions by Tag.
SELECT Id AS "post_id", Title AS "post", AnswerCount, ViewCount FROM Posts WHERE PostTypeId = 1 ORDER BY ViewCount DESC LIMIT 2000
SELECT "Id" AS "post_id", "Title" AS "post", "AnswerCount", "ViewCount" FROM "Posts" WHERE "PostTypeId" = 1 ORDER BY "ViewCount" DESC NULLS LAST LIMIT 2000
0.151367
CREATE TABLE table_name_48 (position INT, played INT)
What is the highest position for less than 42 played?
SELECT MAX(position) FROM table_name_48 WHERE played < 42
SELECT MAX("position") FROM "table_name_48" WHERE "played" < 42
0.061523
CREATE TABLE table_name_6 (receptions VARCHAR, receiving_yards VARCHAR, rushing_tds VARCHAR)
How many receptions were smaller than 161 receiving yards but also had less than 14 rushing TDs?
SELECT COUNT(receptions) FROM table_name_6 WHERE receiving_yards < 161 AND rushing_tds < 14
SELECT COUNT("receptions") FROM "table_name_6" WHERE "receiving_yards" < 161 AND "rushing_tds" < 14
0.09668
CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE 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 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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
when was the first time that patient 004-86136 got a urine output today?
SELECT intakeoutput.intakeoutputtime FROM intakeoutput WHERE intakeoutput.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '004-86136')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine' AND DATETIME(intakeoutput.intakeoutputtime, 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') ORDER BY intakeoutput.intakeoutputtime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '004-86136' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "intakeoutput"."intakeoutputtime" FROM "intakeoutput" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "intakeoutput"."patientunitstayid" WHERE "intakeoutput"."celllabel" = 'urine' AND "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime", 'start of day') = DATETIME(CURRENT_TIME(), 'start of day', '-0 day') AND NOT "_u_1"."" IS NULL ORDER BY "intakeoutput"."intakeoutputtime" NULLS FIRST LIMIT 1
0.771484
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) 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 alive patients were administered oxazolidinone via injection?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.expire_flag = "0" AND procedures.short_title = "Injection oxazolidinone"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Injection oxazolidinone" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "0" = "demographic"."expire_flag"
0.231445
CREATE TABLE table_8663 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Record" TEXT, "Game site" TEXT)
What was the result of the game that took place on april 26, 2003?
SELECT "Result" FROM table_8663 WHERE "Date" = 'april 26, 2003'
SELECT "Result" FROM "table_8663" WHERE "Date" = 'april 26, 2003'
0.063477
CREATE TABLE table_68416 ("Vol." TEXT, "English title" TEXT, "Japanese title" TEXT, "Release date ( Japan ) " TEXT, "Sony Catalog No." TEXT)
What is the English title of ?
SELECT "English title" FROM table_68416 WHERE "Japanese title" = '餓狼伝説バトルアーカイブズ2'
SELECT "English title" FROM "table_68416" WHERE "Japanese title" = '餓狼伝説バトルアーカイブズ2'
0.081055
CREATE TABLE d_icd_procedures (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 labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT)
when was patient 69895 prescribed the drug ketorolac and pantoprazole sodium at the same time for the last time since 32 months ago?
SELECT t1.startdate FROM (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'ketorolac' AND admissions.subject_id = 69895 AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-32 month')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.startdate FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE prescriptions.drug = 'pantoprazole sodium' AND admissions.subject_id = 69895 AND DATETIME(prescriptions.startdate) >= DATETIME(CURRENT_TIME(), '-32 month')) AS t2 ON t1.subject_id = t2.subject_id WHERE DATETIME(t1.startdate) = DATETIME(t2.startdate) ORDER BY t1.startdate DESC LIMIT 1
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 69895 WHERE "prescriptions"."drug" = 'pantoprazole sodium' AND DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-32 month')) SELECT "prescriptions"."startdate" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 69895 JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND DATETIME("prescriptions"."startdate") = DATETIME("t2"."startdate") WHERE "prescriptions"."drug" = 'ketorolac' AND DATETIME("prescriptions"."startdate") >= DATETIME(CURRENT_TIME(), '-32 month') ORDER BY "prescriptions"."startdate" DESC NULLS LAST LIMIT 1
0.814453
CREATE TABLE table_560 ("Club" TEXT, "Played" TEXT, "Won" TEXT, "Drawn" TEXT, "Lost" TEXT, "Points for" TEXT, "Points against" TEXT, "Tries for" TEXT, "Tries against" TEXT, "Try bonus" TEXT, "Losing bonus" TEXT, "Points" TEXT)
How many losing bonus where there when points against is 439?
SELECT COUNT("Losing bonus") FROM table_560 WHERE "Points against" = '439'
SELECT COUNT("Losing bonus") FROM "table_560" WHERE "Points against" = '439'
0.074219
CREATE TABLE track (Track_ID INT, Name TEXT, Location TEXT, Seating FLOAT, Year_Opened FLOAT) CREATE TABLE race (Race_ID INT, Name TEXT, Class TEXT, Date TEXT, Track_ID TEXT)
Show the race class and number of races in each class, and could you display x axis in desc order please?
SELECT Class, COUNT(*) FROM race GROUP BY Class ORDER BY Class DESC
SELECT "Class", COUNT(*) FROM "race" GROUP BY "Class" ORDER BY "Class" DESC NULLS LAST
0.083984
CREATE TABLE table_38760 ("The Kennel Club ( UK ) Toy Group" TEXT, "Canadian Kennel Club Toy Dogs Group" TEXT, "American Kennel Club Toy Group" TEXT, "Australian National Kennel Council Toy Dogs Group" TEXT, "New Zealand Kennel Club Toy Group" TEXT)
What is the Australian National Kennel Council Toy Dogs Group with papillon as the Kennel Club breed?
SELECT "Australian National Kennel Council Toy Dogs Group" FROM table_38760 WHERE "The Kennel Club (UK) Toy Group" = 'papillon'
SELECT "Australian National Kennel Council Toy Dogs Group" FROM "table_38760" WHERE "The Kennel Club (UK) Toy Group" = 'papillon'
0.125977
CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT)
all flights leaving WASHINGTON to SAN FRANCISCO that are FIRST class
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, fare_basis, flight, flight_fare WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND fare_basis.class_type = 'FIRST' AND fare.fare_basis_code = fare_basis.fare_basis_code AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'WASHINGTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'WASHINGTON' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "flight_fare" ON "flight"."flight_id" = "flight_fare"."flight_id" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" JOIN "fare_basis" ON "fare"."fare_basis_code" = "fare_basis"."fare_basis_code" AND "fare_basis"."class_type" = 'FIRST'
0.745117
CREATE TABLE table_228973_7 (written_by VARCHAR, no_in_series VARCHAR)
When 129 is the number in the series who is the writer?
SELECT written_by FROM table_228973_7 WHERE no_in_series = 129
SELECT "written_by" FROM "table_228973_7" WHERE "no_in_series" = 129
0.066406
CREATE TABLE table_44386 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Attendance" FLOAT, "Record" TEXT, "Points" FLOAT)
Which Date has a Record of 4 2 0?
SELECT "Date" FROM table_44386 WHERE "Record" = '4–2–0'
SELECT "Date" FROM "table_44386" WHERE "Record" = '4–2–0'
0.055664
CREATE TABLE table_4783 ("City" TEXT, "Country" TEXT, "IATA" TEXT, "ICAO" TEXT, "Airport" TEXT)
What is the airport with ICAO code of WMKP?
SELECT "Airport" FROM table_4783 WHERE "ICAO" = 'wmkp'
SELECT "Airport" FROM "table_4783" WHERE "ICAO" = 'wmkp'
0.054688
CREATE TABLE table_39511 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Record" TEXT)
Who was the visitor that led to a 3-0-2 record?
SELECT "Visitor" FROM table_39511 WHERE "Record" = '3-0-2'
SELECT "Visitor" FROM "table_39511" WHERE "Record" = '3-0-2'
0.058594
CREATE TABLE Payments (payment_id INT, booking_id INT, customer_id INT, payment_type_code VARCHAR, amount_paid_in_full_yn VARCHAR, payment_date DATETIME, amount_due DECIMAL, amount_paid DECIMAL) CREATE TABLE Customers (customer_id INT, coupon_id INT, good_or_bad_customer VARCHAR, first_name VARCHAR, last_name VARCHAR, gender_mf VARCHAR, date_became_customer DATETIME, date_last_hire DATETIME) CREATE TABLE Discount_Coupons (coupon_id INT, date_issued DATETIME, coupon_amount DECIMAL) CREATE TABLE Bookings (booking_id INT, customer_id INT, booking_status_code VARCHAR, returned_damaged_yn VARCHAR, booking_start_date DATETIME, booking_end_date DATETIME, count_hired VARCHAR, amount_payable DECIMAL, amount_of_discount DECIMAL, amount_outstanding DECIMAL, amount_of_refund DECIMAL) CREATE TABLE View_Product_Availability (product_id INT, booking_id INT, status_date DATETIME, available_yn VARCHAR) CREATE TABLE Products_Booked (booking_id INT, product_id INT, returned_yn VARCHAR, returned_late_yn VARCHAR, booked_count INT, booked_amount FLOAT) CREATE TABLE Products_for_Hire (product_id INT, product_type_code VARCHAR, daily_hire_cost DECIMAL, product_name VARCHAR, product_description VARCHAR)
What are the payment date of the payment with amount paid higher than 300 or with payment type is 'Check, and count them by a line chart, and show X from high to low order.
SELECT payment_date, COUNT(payment_date) FROM Payments WHERE amount_paid > 300 OR payment_type_code = 'Check' GROUP BY payment_date ORDER BY payment_date DESC
SELECT "payment_date", COUNT("payment_date") FROM "Payments" WHERE "amount_paid" > 300 OR "payment_type_code" = 'Check' GROUP BY "payment_date" ORDER BY "payment_date" DESC NULLS LAST
0.178711
CREATE TABLE table_name_19 (home_team VARCHAR, venue VARCHAR)
What is the Home team score at junction oval?
SELECT home_team FROM table_name_19 WHERE venue = "junction oval"
SELECT "home_team" FROM "table_name_19" WHERE "junction oval" = "venue"
0.069336
CREATE TABLE station (id INT, name TEXT, lat DECIMAL, long DECIMAL, dock_count INT, city TEXT, installation_date TEXT) CREATE TABLE trip (id INT, duration INT, start_date TEXT, start_station_name TEXT, start_station_id INT, end_date TEXT, end_station_name TEXT, end_station_id INT, bike_id INT, subscription_type TEXT, zip_code INT) CREATE TABLE weather (date TEXT, max_temperature_f INT, mean_temperature_f INT, min_temperature_f INT, max_dew_point_f INT, mean_dew_point_f INT, min_dew_point_f INT, max_humidity INT, mean_humidity INT, min_humidity INT, max_sea_level_pressure_inches DECIMAL, mean_sea_level_pressure_inches DECIMAL, min_sea_level_pressure_inches DECIMAL, max_visibility_miles INT, mean_visibility_miles INT, min_visibility_miles INT, max_wind_Speed_mph INT, mean_wind_speed_mph INT, max_gust_speed_mph INT, precipitation_inches INT, cloud_cover INT, events TEXT, wind_dir_degrees INT, zip_code INT) CREATE TABLE status (station_id INT, bikes_available INT, docks_available INT, time TEXT)
I want a bar chart to show the average cloud cover of the dates that have the 5 highest cloud cover rates each year.
SELECT date, AVG(cloud_cover) FROM weather
SELECT "date", AVG("cloud_cover") FROM "weather"
0.046875
CREATE TABLE table_70405 ("Year" FLOAT, "Entrant" TEXT, "Chassis" TEXT, "Engine" TEXT, "Points" FLOAT)
How many years did barclay nordica arrows bmw enter with a bmw str-4 t/c engine with less than 1 point?
SELECT SUM("Year") FROM table_70405 WHERE "Engine" = 'bmw str-4 t/c' AND "Entrant" = 'barclay nordica arrows bmw' AND "Points" < '1'
SELECT SUM("Year") FROM "table_70405" WHERE "Engine" = 'bmw str-4 t/c' AND "Entrant" = 'barclay nordica arrows bmw' AND "Points" < '1'
0.130859
CREATE TABLE table_5851 ("Designation" TEXT, "Car numbers" TEXT, "Manufacturer" TEXT, "Model No." TEXT, "First used" TEXT, "Quantity" FLOAT)
Which Designation has a Manufacturer of siemens, and a Quantity of 52?
SELECT "Designation" FROM table_5851 WHERE "Manufacturer" = 'siemens' AND "Quantity" = '52'
SELECT "Designation" FROM "table_5851" WHERE "Manufacturer" = 'siemens' AND "Quantity" = '52'
0.09082
CREATE TABLE table_36707 ("Year" FLOAT, "Men's singles" TEXT, "Women's singles" TEXT, "Men's doubles" TEXT, "Women's doubles" TEXT, "Mixed doubles" TEXT)
Who won men's singles when petya nedelcheva won women's singles, petya nedelcheva diana dimova won women's doubles, stilian makarski diana dimova won mixed doubles, and stilian makarski peyo boichinov won men's doubles?
SELECT "Men's singles" FROM table_36707 WHERE "Women's singles" = 'petya nedelcheva' AND "Women's doubles" = 'petya nedelcheva diana dimova' AND "Mixed doubles" = 'stilian makarski diana dimova' AND "Men's doubles" = 'stilian makarski peyo boichinov'
SELECT "Men's singles" FROM "table_36707" WHERE "Men's doubles" = 'stilian makarski peyo boichinov' AND "Mixed doubles" = 'stilian makarski diana dimova' AND "Women's doubles" = 'petya nedelcheva diana dimova' AND "Women's singles" = 'petya nedelcheva'
0.246094
CREATE TABLE Student (StuID INT, LName VARCHAR, Fname VARCHAR, Age INT, Sex VARCHAR, Major INT, Advisor INT, city_code VARCHAR) CREATE TABLE Has_Allergy (StuID INT, Allergy VARCHAR) CREATE TABLE Allergy_Type (Allergy VARCHAR, AllergyType VARCHAR)
what are the allergy types and how many allergies correspond to each one?, and order in ascending by the x-axis.
SELECT AllergyType, COUNT(*) FROM Allergy_Type GROUP BY AllergyType ORDER BY AllergyType
SELECT "AllergyType", COUNT(*) FROM "Allergy_Type" GROUP BY "AllergyType" ORDER BY "AllergyType" NULLS FIRST
0.105469
CREATE TABLE table_203_583 (id DECIMAL, "title" TEXT, "release" DECIMAL, "6th gen" TEXT, "handheld" TEXT, "note" TEXT)
how many games were released for the psp ?
SELECT COUNT("title") FROM table_203_583 WHERE "handheld" = 'psp'
SELECT COUNT("title") FROM "table_203_583" WHERE "handheld" = 'psp'
0.06543
CREATE TABLE table_28059992_6 (college VARCHAR, cfl_team VARCHAR)
What college did the player who was drafted by Calgary go to?
SELECT college FROM table_28059992_6 WHERE cfl_team = "Calgary"
SELECT "college" FROM "table_28059992_6" WHERE "Calgary" = "cfl_team"
0.067383
CREATE TABLE visits_restaurant (stuid DECIMAL, resid DECIMAL, time TIME, spent DECIMAL) CREATE TABLE restaurant_type (restypeid DECIMAL, restypename TEXT, restypedescription TEXT) CREATE TABLE type_of_restaurant (resid DECIMAL, restypeid DECIMAL) CREATE TABLE restaurant (resid DECIMAL, resname TEXT, address TEXT, rating DECIMAL) CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)
Which city does student Linda Smith live in?
SELECT city_code FROM student WHERE fname = "Linda" AND lname = "Smith"
SELECT "city_code" FROM "student" WHERE "Linda" = "fname" AND "Smith" = "lname"
0.077148
CREATE TABLE table_name_22 (matches INT, round VARCHAR)
What is the highest number of matches that has a round of Third Round?
SELECT MAX(matches) FROM table_name_22 WHERE round = "third round"
SELECT MAX("matches") FROM "table_name_22" WHERE "round" = "third round"
0.070313
CREATE TABLE table_name_38 (rank VARCHAR, silver VARCHAR, gold VARCHAR)
Which rank has 1 silver medal and more than 1 gold medal?
SELECT rank FROM table_name_38 WHERE silver = 1 AND gold > 1
SELECT "rank" FROM "table_name_38" WHERE "gold" > 1 AND "silver" = 1
0.066406
CREATE TABLE table_name_31 (lane VARCHAR, time VARCHAR, rank VARCHAR)
What is the lane with a time of 1:56.64, and a tank smaller than 7?
SELECT COUNT(lane) FROM table_name_31 WHERE time = "1:56.64" AND rank < 7
SELECT COUNT("lane") FROM "table_name_31" WHERE "1:56.64" = "time" AND "rank" < 7
0.079102
CREATE TABLE table_name_42 (result VARCHAR, opponent VARCHAR)
What is the result of the match with Zab Judah as the opponent?
SELECT result FROM table_name_42 WHERE opponent = "zab judah"
SELECT "result" FROM "table_name_42" WHERE "opponent" = "zab judah"
0.06543
CREATE TABLE table_name_20 (game_site VARCHAR, week VARCHAR)
What is the Game site week 1?
SELECT game_site FROM table_name_20 WHERE week = 1
SELECT "game_site" FROM "table_name_20" WHERE "week" = 1
0.054688
CREATE TABLE table_51911 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Who was the away team at Windy Hill?
SELECT "Away team" FROM table_51911 WHERE "Venue" = 'windy hill'
SELECT "Away team" FROM "table_51911" WHERE "Venue" = 'windy hill'
0.064453
CREATE TABLE table_name_39 (points_1 INT, goal_difference VARCHAR, lost VARCHAR)
What is the most points 1 when the goal difference is +28 and lost is larger than 12?
SELECT MAX(points_1) FROM table_name_39 WHERE goal_difference = "+28" AND lost > 12
SELECT MAX("points_1") FROM "table_name_39" WHERE "+28" = "goal_difference" AND "lost" > 12
0.088867
CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) 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 Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE ReviewTaskTypes (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 PostTags (PostId DECIMAL, TagId DECIMAL)
First answer bias by number of answers.
WITH two_answers AS (SELECT q.Id AS question, MIN(a.Id) AS first, MAX(a.Id) AS last FROM Posts AS q JOIN Posts AS a ON q.Id = a.ParentId WHERE q.AnswerCount >= 2 GROUP BY q.Id HAVING CURRENT_TIMESTAMP() - MAX(a.CreationDate) > 30) SELECT COALESCE(q.AnswerCount, 0) AS answers, ROUND(AVG(CAST(COALESCE(f.Score, 0) AS FLOAT) - CAST(COALESCE(l.Score, 0) AS FLOAT)), 2) AS FGITW, LN(COUNT(*)) AS log_N FROM two_answers JOIN Posts AS f ON f.Id = first JOIN Posts AS l ON l.Id = last JOIN Posts AS q ON q.Id = question WHERE f.CreationDate < l.CreationDate GROUP BY COALESCE(q.AnswerCount, 0) ORDER BY COALESCE(q.AnswerCount, 0)
WITH "two_answers" AS (SELECT MAX(1) AS "_" FROM "Posts" AS "q" JOIN "Posts" AS "a" ON "a"."ParentId" = "q"."Id" WHERE "q"."AnswerCount" >= 2 GROUP BY "q"."Id" HAVING CURRENT_TIMESTAMP() - MAX("a"."CreationDate") > 30) SELECT COALESCE("q"."AnswerCount", 0) AS "answers", ROUND(AVG(CAST(COALESCE("f"."Score", 0) AS FLOAT) - CAST(COALESCE("l"."Score", 0) AS FLOAT)), 2) AS "FGITW", LN(COUNT(*)) AS "log_N" FROM "two_answers" JOIN "Posts" AS "f" ON "f"."Id" = "first" JOIN "Posts" AS "q" ON "q"."Id" = "question" JOIN "Posts" AS "l" ON "f"."CreationDate" < "l"."CreationDate" AND "l"."Id" = "last" GROUP BY COALESCE("q"."AnswerCount", 0) ORDER BY COALESCE("q"."AnswerCount", 0) NULLS FIRST
0.669922
CREATE TABLE table_5328 ("Season" TEXT, "Level" FLOAT, "Position" TEXT, "Nationality" TEXT, "Apps" FLOAT, "Goals" FLOAT)
What is the Position of the Level 3 winner from Saint Kitts and Nevis?
SELECT "Position" FROM table_5328 WHERE "Level" = '3' AND "Nationality" = 'saint kitts and nevis'
SELECT "Position" FROM "table_5328" WHERE "Level" = '3' AND "Nationality" = 'saint kitts and nevis'
0.09668
CREATE TABLE table_name_53 (survived INT, destroyed VARCHAR, to_iran VARCHAR, aircraft VARCHAR)
What's the average survived with a to Iran less than 1, more than 1 destroyed, and a brazil tucano aircraft?
SELECT AVG(survived) FROM table_name_53 WHERE to_iran < 1 AND aircraft = "brazil tucano" AND destroyed > 1
SELECT AVG("survived") FROM "table_name_53" WHERE "aircraft" = "brazil tucano" AND "destroyed" > 1 AND "to_iran" < 1
0.113281
CREATE TABLE table_32468 ("Date" TEXT, "Result" TEXT, "Score" TEXT, "Stadium" TEXT, "City" TEXT, "Crowd" FLOAT)
What city had a crowd larger than 11,346 and score of 24-16?
SELECT "City" FROM table_32468 WHERE "Crowd" > '11,346' AND "Score" = '24-16'
SELECT "City" FROM "table_32468" WHERE "Crowd" > '11,346' AND "Score" = '24-16'
0.077148
CREATE TABLE stadium (id INT, name TEXT, Home_Games INT, Average_Attendance FLOAT, Total_Attendance FLOAT, Capacity_Percentage FLOAT) CREATE TABLE injury_accident (game_id INT, id INT, Player TEXT, Injury TEXT, Number_of_matches TEXT, Source TEXT) CREATE TABLE game (stadium_id INT, id INT, Season INT, Date TEXT, Home_team TEXT, Away_team TEXT, Score TEXT, Competition TEXT)
List the number of games for each away team and group by home team in a stacked bar chart The x-axis is away team, could you display from low to high by the Y?
SELECT Away_team, COUNT(Away_team) FROM game GROUP BY Home_team, Away_team ORDER BY COUNT(Away_team)
SELECT "Away_team", COUNT("Away_team") FROM "game" GROUP BY "Home_team", "Away_team" ORDER BY COUNT("Away_team") NULLS FIRST
0.121094
CREATE TABLE company (Company_ID INT, Rank INT, Company TEXT, Headquarters TEXT, Main_Industry TEXT, Sales_billion FLOAT, Profits_billion FLOAT, Assets_billion FLOAT, Market_Value FLOAT) CREATE TABLE station_company (Station_ID INT, Company_ID INT, Rank_of_the_Year INT) CREATE TABLE gas_station (Station_ID INT, Open_Year INT, Location TEXT, Manager_Name TEXT, Vice_Manager_Name TEXT, Representative_Name TEXT)
Show the company name with the number of gas station by a bar chart, I want to show the total number from low to high order.
SELECT Company, COUNT(*) FROM station_company AS T1 JOIN company AS T2 ON T1.Company_ID = T2.Company_ID GROUP BY T1.Company_ID ORDER BY COUNT(*)
SELECT "Company", COUNT(*) FROM "station_company" AS "T1" JOIN "company" AS "T2" ON "T1"."Company_ID" = "T2"."Company_ID" GROUP BY "T1"."Company_ID" ORDER BY COUNT(*) NULLS FIRST
0.173828
CREATE TABLE table_name_56 (firefox VARCHAR, internet_explorer VARCHAR)
What is the firefox value with a 22.0% internet explorer?
SELECT firefox FROM table_name_56 WHERE internet_explorer = "22.0%"
SELECT "firefox" FROM "table_name_56" WHERE "22.0%" = "internet_explorer"
0.071289
CREATE TABLE table_name_76 (nation VARCHAR, total VARCHAR, silver VARCHAR, gold VARCHAR)
What Nation has more than 4 silver, more than 3 gold and 18 total medals?
SELECT nation FROM table_name_76 WHERE silver > 4 AND gold > 3 AND total = 18
SELECT "nation" FROM "table_name_76" WHERE "gold" > 3 AND "silver" > 4 AND "total" = 18
0.084961
CREATE TABLE table_21807 ("County" TEXT, "Kerry%" TEXT, "Kerry#" FLOAT, "Bush%" TEXT, "Bush#" FLOAT, "Others%" TEXT, "Others#" FLOAT, "2000 result" TEXT)
What was the highest vote number for Bush?
SELECT MAX("Bush#") FROM table_21807
SELECT MAX("Bush#") FROM "table_21807"
0.037109
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)
Show me a bar chart for what are the total enrollments of universities of each affiliation type?
SELECT Affiliation, SUM(Enrollment) FROM university GROUP BY Affiliation
SELECT "Affiliation", SUM("Enrollment") FROM "university" GROUP BY "Affiliation"
0.078125
CREATE TABLE table_204_246 (id DECIMAL, "department" TEXT, "total deputies" DECIMAL, "uninominal deputies" DECIMAL, "plurinominal deputies" DECIMAL, "special indigenous\ or campesino deputies" DECIMAL, "senators" DECIMAL)
which department of bolivia 's legislature has the least number of deputies ?
SELECT "department" FROM table_204_246 ORDER BY "total deputies" LIMIT 1
SELECT "department" FROM "table_204_246" ORDER BY "total deputies" NULLS FIRST LIMIT 1
0.083984
CREATE TABLE table_54842 ("Team" TEXT, "Nation" TEXT, "From" TEXT, "Matches" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Win %" FLOAT)
Tell me the team which has matches of 13
SELECT "Team" FROM table_54842 WHERE "Matches" = '13'
SELECT "Team" FROM "table_54842" WHERE "Matches" = '13'
0.053711
CREATE TABLE table_66337 ("Restaurant Name" TEXT, "Original Name" TEXT, "Location" TEXT, "Chef" TEXT, "Designer" TEXT, "Still Open?" TEXT)
Who is the chef at Lakes Bar and Grill?
SELECT "Chef" FROM table_66337 WHERE "Restaurant Name" = 'lakes bar and grill'
SELECT "Chef" FROM "table_66337" WHERE "Restaurant Name" = 'lakes bar and grill'
0.078125
CREATE TABLE table_17968 ("Round" FLOAT, "Circuit" TEXT, "Date" TEXT, "Length" TEXT, "Pole Position" TEXT, "GT3 Winner" TEXT, "GTC Winner" TEXT)
what is the maximum round for gt3 winner hector lester tim mullen and pole position of jonny cocker paul drayson
SELECT MAX("Round") FROM table_17968 WHERE "GT3 Winner" = 'Hector Lester Tim Mullen' AND "Pole Position" = 'Jonny Cocker Paul Drayson'
SELECT MAX("Round") FROM "table_17968" WHERE "GT3 Winner" = 'Hector Lester Tim Mullen' AND "Pole Position" = 'Jonny Cocker Paul Drayson'
0.132813
CREATE TABLE table_name_18 (finish VARCHAR, to_par VARCHAR)
What is the finish when the to par is +18?
SELECT finish FROM table_name_18 WHERE to_par = "+18"
SELECT "finish" FROM "table_name_18" WHERE "+18" = "to_par"
0.057617
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
what is the percentile of 3.83 in a lab test of rbc given the same age of patient 027-142451 during their current hospital encounter?
SELECT DISTINCT t1.c1 FROM (SELECT lab.labresult, PERCENT_RANK() OVER (ORDER BY lab.labresult) AS c1 FROM lab WHERE lab.labname = 'rbc' AND lab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.age = (SELECT patient.age FROM patient WHERE patient.uniquepid = '027-142451' AND patient.hospitaldischargetime IS NULL))) AS t1 WHERE t1.labresult = 3.83
WITH "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" JOIN "patient" AS "patient_2" ON "patient"."age" = "patient_2"."age" AND "patient_2"."hospitaldischargetime" IS NULL AND "patient_2"."uniquepid" = '027-142451' GROUP BY "patientunitstayid") SELECT DISTINCT PERCENT_RANK() OVER (ORDER BY "lab"."labresult" NULLS FIRST) FROM "lab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "lab"."patientunitstayid" WHERE "lab"."labname" = 'rbc' AND "lab"."labresult" = 3.83 AND NOT "_u_1"."" IS NULL
0.486328
CREATE TABLE table_48579 ("Goal" FLOAT, "Date" TEXT, "Venue" TEXT, "Score" TEXT, "Result" TEXT, "Competition" TEXT)
Which venue has a scoreof 2 0?
SELECT "Venue" FROM table_48579 WHERE "Score" = '2–0'
SELECT "Venue" FROM "table_48579" WHERE "Score" = '2–0'
0.053711
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
what is the average age of patients who are discharged due to home health care and diagnosed with primary disease gastrointestinal bleed?
SELECT AVG(demographic.age) FROM demographic WHERE demographic.discharge_location = "HOME HEALTH CARE" AND demographic.diagnosis = "GASTROINTESTINAL BLEED"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "GASTROINTESTINAL BLEED" = "demographic"."diagnosis" AND "HOME HEALTH CARE" = "demographic"."discharge_location"
0.165039
CREATE TABLE table_44332 ("Rider" TEXT, "Manufacturer" TEXT, "Laps" FLOAT, "Time" TEXT, "Grid" FLOAT)
what is the time when laps is less than 21, manufacturer is aprilia, grid is less than 17 and the rider is thomas luthi?
SELECT "Time" FROM table_44332 WHERE "Laps" < '21' AND "Manufacturer" = 'aprilia' AND "Grid" < '17' AND "Rider" = 'thomas luthi'
SELECT "Time" FROM "table_44332" WHERE "Grid" < '17' AND "Laps" < '21' AND "Manufacturer" = 'aprilia' AND "Rider" = 'thomas luthi'
0.126953
CREATE TABLE Course_Authors_and_Tutors (author_id INT, author_tutor_ATB VARCHAR, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR, gender_mf VARCHAR, address_line_1 VARCHAR) CREATE TABLE Student_Tests_Taken (registration_id INT, date_test_taken DATETIME, test_result VARCHAR) CREATE TABLE Students (student_id INT, date_of_registration DATETIME, date_of_latest_logon DATETIME, login_name VARCHAR, password VARCHAR, personal_name VARCHAR, middle_name VARCHAR, family_name VARCHAR) CREATE TABLE Courses (course_id INT, author_id INT, subject_id INT, course_name VARCHAR, course_description VARCHAR) CREATE TABLE Subjects (subject_id INT, subject_name VARCHAR) CREATE TABLE Student_Course_Enrolment (registration_id INT, student_id INT, course_id INT, date_of_enrolment DATETIME, date_of_completion DATETIME)
List the number of completion students in each day and bin date of completion by weekday with a bar chart.
SELECT date_of_completion, COUNT(date_of_completion) FROM Student_Course_Enrolment
SELECT "date_of_completion", COUNT("date_of_completion") FROM "Student_Course_Enrolment"
0.085938
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 d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE 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)
when patient 67005's birthday is?
SELECT patients.dob FROM patients WHERE patients.subject_id = 67005
SELECT "patients"."dob" FROM "patients" WHERE "patients"."subject_id" = 67005
0.075195
CREATE TABLE table_11674 ("Race" TEXT, "Date" TEXT, "Location" TEXT, "Pole Position" TEXT, "Fastest Lap" TEXT, "Race Winner" TEXT, "Constructor" TEXT, "Report" TEXT)
Who was the Constructor for the Long Beach race with Niki Lauda as winner?
SELECT "Constructor" FROM table_11674 WHERE "Race Winner" = 'niki lauda' AND "Location" = 'long beach'
SELECT "Constructor" FROM "table_11674" WHERE "Location" = 'long beach' AND "Race Winner" = 'niki lauda'
0.101563
CREATE TABLE table_name_98 (total INT, to_par VARCHAR)
How many totals have a To par of 1?
SELECT SUM(total) FROM table_name_98 WHERE to_par = "–1"
SELECT SUM("total") FROM "table_name_98" WHERE "to_par" = "–1"
0.060547
CREATE TABLE table_16494599_5 (years_for_grizzlies VARCHAR, school_club_team VARCHAR)
when was the school/club team for grizzles was maryland
SELECT years_for_grizzlies FROM table_16494599_5 WHERE school_club_team = "Maryland"
SELECT "years_for_grizzlies" FROM "table_16494599_5" WHERE "Maryland" = "school_club_team"
0.087891
CREATE TABLE table_name_49 (agg VARCHAR, opponent VARCHAR)
What was the aggregate total for the match against Koper?
SELECT agg FROM table_name_49 WHERE opponent = "koper"
SELECT "agg" FROM "table_name_49" WHERE "koper" = "opponent"
0.058594
CREATE TABLE table_name_28 (source VARCHAR, date VARCHAR)
Which source has a date of June 2008?
SELECT source FROM table_name_28 WHERE date = "june 2008"
SELECT "source" FROM "table_name_28" WHERE "date" = "june 2008"
0.061523
CREATE TABLE table_name_60 (overall_rank VARCHAR, heat_rank VARCHAR)
Tell me the overall rank for heat rank of 8
SELECT overall_rank FROM table_name_60 WHERE heat_rank = 8
SELECT "overall_rank" FROM "table_name_60" WHERE "heat_rank" = 8
0.0625
CREATE TABLE table_1153898_1 (ddm_class VARCHAR, comparisons VARCHAR)
Is the drawing tablet support part of the DDM class?
SELECT ddm_class FROM table_1153898_1 WHERE comparisons = "Drawing Tablet Support"
SELECT "ddm_class" FROM "table_1153898_1" WHERE "Drawing Tablet Support" = "comparisons"
0.085938
CREATE TABLE table_62426 ("Player" TEXT, "Country" TEXT, "Year ( s ) won" TEXT, "Total" FLOAT, "To par" TEXT, "Finish" TEXT)
What country had a Finish of t8?
SELECT "Country" FROM table_62426 WHERE "Finish" = 't8'
SELECT "Country" FROM "table_62426" WHERE "Finish" = 't8'
0.055664
CREATE TABLE table_203_296 (id DECIMAL, "country" TEXT, "total gdp ( nominal ) \ ( billion us$ ) " TEXT, "gdp per capita\ ( us$ , ppp ) " TEXT, "gdp growth , \ 2007-2011\ ( in % ) " DECIMAL, "hdi" TEXT)
seychelles and guinea bissau have the same total gdp -lrb- nominal -rrb- of ?
SELECT "total gdp (nominal)\n(billion us$)" FROM table_203_296 WHERE "country" = 'seychelles'
SELECT "total gdp (nominal)\n(billion us$)" FROM "table_203_296" WHERE "country" = 'seychelles'
0.092773
CREATE TABLE table_204_970 (id DECIMAL, "year" DECIMAL, "award" TEXT, "category" TEXT, "title" TEXT, "result" TEXT)
how many total awards did he win ?
SELECT COUNT("award") FROM table_204_970 WHERE "result" = 'won'
SELECT COUNT("award") FROM "table_204_970" WHERE "result" = 'won'
0.063477
CREATE TABLE table_name_29 (college VARCHAR, player VARCHAR)
Where did Dennis Byrd go to college?
SELECT college FROM table_name_29 WHERE player = "dennis byrd"
SELECT "college" FROM "table_name_29" WHERE "dennis byrd" = "player"
0.066406
CREATE TABLE table_18159601_1 (city VARCHAR, charter_date VARCHAR)
in which city was charter date december 4, 2011
SELECT city FROM table_18159601_1 WHERE charter_date = "December 4, 2011"
SELECT "city" FROM "table_18159601_1" WHERE "December 4, 2011" = "charter_date"
0.077148
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
How many of the female patients belonged to a black/haitian ethnic origin?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.ethnicity = "BLACK/HAITIAN"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "BLACK/HAITIAN" = "demographic"."ethnicity" AND "F" = "demographic"."gender"
0.147461
CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT)
what are the flights available in the morning between DENVER and SAN FRANCISCO
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'DENVER' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SAN FRANCISCO' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time BETWEEN 0 AND 1200
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'DENVER' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."departure_time" <= 1200 AND "flight"."departure_time" >= 0 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SAN FRANCISCO'
0.570313
CREATE TABLE table_name_84 (result VARCHAR, goal VARCHAR, date VARCHAR)
What is the result of the match on 16 October 2012 with less than 4 goals?
SELECT result FROM table_name_84 WHERE goal < 4 AND date = "16 october 2012"
SELECT "result" FROM "table_name_84" WHERE "16 october 2012" = "date" AND "goal" < 4
0.082031
CREATE TABLE table_16615 ("Rank" FLOAT, "Dismissals" FLOAT, "Player" TEXT, "Nationality" TEXT, "Catches" FLOAT, "Stumpings" FLOAT, "Career Span" TEXT)
What are the players whose rank is 2?
SELECT "Player" FROM table_16615 WHERE "Rank" = '2'
SELECT "Player" FROM "table_16615" WHERE "Rank" = '2'
0.051758
CREATE TABLE table_33918 ("Name" TEXT, "Faith" TEXT, "Type" TEXT, "DCSF number" FLOAT, "Ofsted number" FLOAT)
What is the name of the primary with a DCSF number larger than 2337 and an Ofsted number smaller than 135339?
SELECT "Name" FROM table_33918 WHERE "Type" = 'primary' AND "DCSF number" > '2337' AND "Ofsted number" < '135339'
SELECT "Name" FROM "table_33918" WHERE "DCSF number" > '2337' AND "Ofsted number" < '135339' AND "Type" = 'primary'
0.112305
CREATE TABLE table_52207 ("Rank" FLOAT, "Movie" TEXT, "Year" FLOAT, "Studio ( s ) " TEXT, "Third Week Nett. Gross" FLOAT)
Name the lowest rank for red chillies entertainment for 2013
SELECT MIN("Rank") FROM table_52207 WHERE "Year" = '2013' AND "Studio(s)" = 'red chillies entertainment'
SELECT MIN("Rank") FROM "table_52207" WHERE "Studio(s)" = 'red chillies entertainment' AND "Year" = '2013'
0.103516
CREATE TABLE table_64422 ("Rank" FLOAT, "Rowers" TEXT, "Country" TEXT, "Time" TEXT, "Notes" TEXT)
What is Italy's rank?
SELECT "Rank" FROM table_64422 WHERE "Country" = 'italy'
SELECT "Rank" FROM "table_64422" WHERE "Country" = 'italy'
0.056641
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) 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)
what is the number of patients whose admission location is clinic referral/premature and primary disease is sigmoid diverticulitis, colovestical fistula/sda?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.admission_location = "CLINIC REFERRAL/PREMATURE" AND demographic.diagnosis = "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "CLINIC REFERRAL/PREMATURE" = "demographic"."admission_location" AND "SIGMOID DIVERTICULITIS, COLOVESTICAL FISTULA/SDA" = "demographic"."diagnosis"
0.216797
CREATE TABLE table_204_721 (id DECIMAL, "rank" DECIMAL, "wrestler" TEXT, "no. of reigns" DECIMAL, "combined\ defenses" DECIMAL, "combined\ days" DECIMAL)
what is the total number of wrestlers on the chart
SELECT COUNT("wrestler") FROM table_204_721
SELECT COUNT("wrestler") FROM "table_204_721"
0.043945
CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT)
is there a fare from PITTSBURGH to CLEVELAND under 200 dollars
SELECT DISTINCT fare_id FROM fare WHERE (fare_id IN (SELECT FLIGHT_FARE_ID FROM flight_fare AS FLIGHT_FARE WHERE FLIGHT_FLIGHT_ID IN (SELECT FLIGHTalias0.flight_id FROM flight AS FLIGHTalias0 WHERE (FLIGHTalias0.from_airport IN (SELECT AIRPORT_SERVICEalias0.airport_code FROM airport_service AS AIRPORT_SERVICEalias0 WHERE AIRPORT_SERVICEalias0.city_code IN (SELECT CITYalias0.city_code FROM city AS CITYalias0 WHERE CITYalias0.city_name = 'PITTSBURGH')) AND FLIGHTalias0.to_airport IN (SELECT AIRPORT_SERVICEalias1.airport_code FROM airport_service AS AIRPORT_SERVICEalias1 WHERE AIRPORT_SERVICEalias1.city_code IN (SELECT CITYalias1.city_code FROM city AS CITYalias1 WHERE CITYalias1.city_name = 'CLEVELAND'))))) AND one_direction_cost < 200)
WITH "_u_0" AS (SELECT "CITYalias0"."city_code" FROM "city" AS "CITYalias0" WHERE "CITYalias0"."city_name" = 'PITTSBURGH' GROUP BY "city_code"), "_u_1" AS (SELECT "AIRPORT_SERVICEalias0"."airport_code" FROM "airport_service" AS "AIRPORT_SERVICEalias0" LEFT JOIN "_u_0" AS "_u_0" ON "AIRPORT_SERVICEalias0"."city_code" = "_u_0"."" WHERE NOT "_u_0"."" IS NULL GROUP BY "airport_code"), "_u_2" AS (SELECT "CITYalias1"."city_code" FROM "city" AS "CITYalias1" WHERE "CITYalias1"."city_name" = 'CLEVELAND' GROUP BY "city_code"), "_u_3" AS (SELECT "AIRPORT_SERVICEalias1"."airport_code" FROM "airport_service" AS "AIRPORT_SERVICEalias1" LEFT JOIN "_u_2" AS "_u_2" ON "AIRPORT_SERVICEalias1"."city_code" = "_u_2"."" WHERE NOT "_u_2"."" IS NULL GROUP BY "airport_code"), "_u_4" AS (SELECT "FLIGHTalias0"."flight_id" FROM "flight" AS "FLIGHTalias0" LEFT JOIN "_u_1" AS "_u_1" ON "FLIGHTalias0"."from_airport" = "_u_1"."" LEFT JOIN "_u_3" AS "_u_3" ON "FLIGHTalias0"."to_airport" = "_u_3"."" WHERE NOT "_u_1"."" IS NULL AND NOT "_u_3"."" IS NULL GROUP BY "flight_id") SELECT DISTINCT "fare_id" FROM "fare" WHERE "fare_id" IN (SELECT "FLIGHT_FARE_ID" FROM "flight_fare" AS "FLIGHT_FARE" LEFT JOIN "_u_4" AS "_u_4" ON "FLIGHT_FLIGHT_ID" = "_u_4"."" WHERE NOT "_u_4"."" IS NULL) AND "one_direction_cost" < 200
1.264648
CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what was the organism that was detected during patient 031-9128's last other test since 70 months ago?
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-9128')) AND microlab.culturesite = 'other' AND DATETIME(microlab.culturetakentime) >= DATETIME(CURRENT_TIME(), '-70 month') ORDER BY microlab.culturetakentime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '031-9128' 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 "microlab"."organism" FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'other' AND DATETIME("microlab"."culturetakentime") >= DATETIME(CURRENT_TIME(), '-70 month') AND NOT "_u_1"."" IS NULL ORDER BY "microlab"."culturetakentime" DESC NULLS LAST LIMIT 1
0.672852
CREATE TABLE table_name_93 (crowd INT, home_team VARCHAR)
What was total size of the crowd at a home game for north melbourne?
SELECT SUM(crowd) FROM table_name_93 WHERE home_team = "north melbourne"
SELECT SUM("crowd") FROM "table_name_93" WHERE "home_team" = "north melbourne"
0.076172
CREATE TABLE table_4334 ("Region" TEXT, "Date" TEXT, "Format" TEXT, "Label" TEXT, "Edition ( s ) " TEXT)
Tell me the format for geffen of the united states
SELECT "Format" FROM table_4334 WHERE "Label" = 'geffen' AND "Region" = 'united states'
SELECT "Format" FROM "table_4334" WHERE "Label" = 'geffen' AND "Region" = 'united states'
0.086914
CREATE TABLE store_district (store_id VARCHAR, district_id VARCHAR) CREATE TABLE store (store_id VARCHAR) CREATE TABLE district (headquartered_city VARCHAR, district_id VARCHAR)
Find the number of stores in each city.
SELECT t3.headquartered_city, COUNT(*) FROM store AS t1 JOIN store_district AS t2 ON t1.store_id = t2.store_id JOIN district AS t3 ON t2.district_id = t3.district_id GROUP BY t3.headquartered_city
SELECT "t3"."headquartered_city", COUNT(*) FROM "store" AS "t1" JOIN "store_district" AS "t2" ON "t1"."store_id" = "t2"."store_id" JOIN "district" AS "t3" ON "t2"."district_id" = "t3"."district_id" GROUP BY "t3"."headquartered_city"
0.226563
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) 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)
give me the number of patients whose age is less than 31 and item id is 50935?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "31" AND lab.itemid = "50935"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "50935" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "31" > "demographic"."age"
0.181641
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
let me know the long title of diagnoses for patient with patient id 21796.
SELECT diagnoses.long_title FROM diagnoses WHERE diagnoses.subject_id = "21796"
SELECT "diagnoses"."long_title" FROM "diagnoses" WHERE "21796" = "diagnoses"."subject_id"
0.086914
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE 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)
count the number of patients whose primary disease is mesenteric ischemia and year of death is less than or equal to 2164?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "MESENTERIC ISCHEMIA" AND demographic.dod_year <= "2164.0"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "2164.0" >= "demographic"."dod_year" AND "MESENTERIC ISCHEMIA" = "demographic"."diagnosis"
0.161133
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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 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_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE 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)
when was the last creatinine, urine lab test done for patient 96833 on this hospital encounter?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'creatinine, urine') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 96833 AND admissions.dischtime IS NULL) ORDER BY labevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'creatinine, urine' GROUP BY "itemid"), "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."dischtime" IS NULL AND "admissions"."subject_id" = 96833 GROUP BY "hadm_id") SELECT "labevents"."charttime" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."hadm_id" WHERE NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL ORDER BY "labevents"."charttime" DESC NULLS LAST LIMIT 1
0.55957
CREATE TABLE table_8388 ("Publication" TEXT, "Country" TEXT, "Accolade" TEXT, "Year" FLOAT, "Rank" FLOAT)
What country did Day & Age rank number 1 in Q prior to 2011?
SELECT "Country" FROM table_8388 WHERE "Year" < '2011' AND "Rank" > '1' AND "Publication" = 'q'
SELECT "Country" FROM "table_8388" WHERE "Publication" = 'q' AND "Rank" > '1' AND "Year" < '2011'
0.094727
CREATE TABLE table_75758 ("Information" TEXT, "Altade\\u00f1a" TEXT, "Aprende" TEXT, "Centennial" TEXT, "Kyrene MS" TEXT, "del Pueblo" TEXT)
Which Centennial has a Altade a of panthers?
SELECT "Centennial" FROM table_75758 WHERE "Altade\u00f1a" = 'panthers'
SELECT "Centennial" FROM "table_75758" WHERE "Altade\u00f1a" = 'panthers'
0.071289
CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (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 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 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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 PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT)
Top questions for a TAG.
SELECT CONCAT('https://stackoverflow.com/questions/', Id), AcceptedAnswerId, CreationDate AS Score, ViewCount, FavoriteCount, Title, Tags, AnswerCount, CommentCount, Body, OwnerUserId, LastEditDate FROM Posts WHERE PostTypeId = 1 AND Tags LIKE '%<##TagName##>%' ORDER BY ViewCount DESC LIMIT 50
SELECT CONCAT('https://stackoverflow.com/questions/', "Id"), "AcceptedAnswerId", "CreationDate" AS "Score", "ViewCount", "FavoriteCount", "Title", "Tags", "AnswerCount", "CommentCount", "Body", "OwnerUserId", "LastEditDate" FROM "Posts" WHERE "PostTypeId" = 1 AND "Tags" LIKE '%<##TagName##>%' ORDER BY "ViewCount" DESC NULLS LAST LIMIT 50
0.331055
CREATE TABLE View_Unit_Status (apt_id INT, apt_booking_id INT, status_date DATETIME, available_yn BIT) CREATE TABLE Apartment_Buildings (building_id INT, building_short_name CHAR, building_full_name VARCHAR, building_description VARCHAR, building_address VARCHAR, building_manager VARCHAR, building_phone VARCHAR) CREATE TABLE Guests (guest_id INT, gender_code CHAR, guest_first_name VARCHAR, guest_last_name VARCHAR, date_of_birth DATETIME) CREATE TABLE Apartment_Facilities (apt_id INT, facility_code CHAR) CREATE TABLE Apartments (apt_id INT, building_id INT, apt_type_code CHAR, apt_number CHAR, bathroom_count INT, bedroom_count INT, room_count CHAR) CREATE TABLE Apartment_Bookings (apt_booking_id INT, apt_id INT, guest_id INT, booking_status_code CHAR, booking_start_date DATETIME, booking_end_date DATETIME)
How many apartment bookings for each year? Draw a bar chart binning booking start date by year interval, sort by the Y-axis in ascending.
SELECT booking_start_date, COUNT(booking_start_date) FROM Apartment_Bookings AS T1 JOIN Guests AS T2 ON T1.guest_id = T2.guest_id ORDER BY COUNT(booking_start_date)
SELECT "booking_start_date", COUNT("booking_start_date") FROM "Apartment_Bookings" AS "T1" JOIN "Guests" AS "T2" ON "T1"."guest_id" = "T2"."guest_id" ORDER BY COUNT("booking_start_date") NULLS FIRST
0.193359
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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE CloseReasonTypes (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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId 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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT)
select top 10000 Posts.id, Posts.body from posts where posts.ViewCount>10000.
SELECT u.Id AS "user_link", p.Id, p.Body AS "message", u.LastAccessDate AS "last_access", u.Location AS "location", u.WebsiteUrl AS "url", u.Reputation AS "reputation" FROM Posts AS p JOIN Users AS u ON u.Id = p.Id WHERE p.ViewCount > 10000 AND u.Reputation > 5000 ORDER BY Id LIMIT 100
SELECT "u"."Id" AS "user_link", "p"."Id", "p"."Body" AS "message", "u"."LastAccessDate" AS "last_access", "u"."Location" AS "location", "u"."WebsiteUrl" AS "url", "u"."Reputation" AS "reputation" FROM "Posts" AS "p" JOIN "Users" AS "u" ON "p"."Id" = "u"."Id" AND "u"."Reputation" > 5000 WHERE "p"."ViewCount" > 10000 ORDER BY "Id" NULLS FIRST LIMIT 100
0.34375
CREATE TABLE table_26505 ("Rnd" FLOAT, "Circuit" TEXT, "LMP Winning Team" TEXT, "LMPC Winning Team" TEXT, "GT Winning Team" TEXT, "GTC Winning Team" TEXT, "Results" TEXT)
What was the winning team lmpc in rnd 3?
SELECT "LMPC Winning Team" FROM table_26505 WHERE "Rnd" = '3'
SELECT "LMPC Winning Team" FROM "table_26505" WHERE "Rnd" = '3'
0.061523