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 PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) 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 ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE FlagTypes (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 PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) 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 PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
All the Minecraft Questions and Answers.
SELECT q.Id, q.Title, q.Body, q.Score, q.OwnerUserId, q.CreationDate, t.Name AS Type, u.Reputation, u.DisplayName, u.Location, '' AS ParentId, q.AcceptedAnswerId FROM Posts AS q INNER JOIN PostTypes AS t ON q.PostTypeId = t.Id INNER JOIN Users AS u ON q.OwnerUserId = u.Id WHERE q.Title LIKE '%minecraft%' OR q.Tags LIKE '%minecraft%' UNION SELECT a.Id, q.Title, a.Body, a.Score, a.OwnerUserId, a.CreationDate, t.Name AS Type, u.Reputation, u.DisplayName, u.Location, a.ParentId, '' AS AcceptedAnswerId FROM Posts AS q INNER JOIN Posts AS a ON a.ParentId = q.Id INNER JOIN PostTypes AS t ON a.PostTypeId = t.Id INNER JOIN Users AS u ON a.OwnerUserId = u.Id WHERE q.Title LIKE '%minecraft%' OR q.Tags LIKE '%minecraft%'
SELECT "q"."Id", "q"."Title", "q"."Body", "q"."Score", "q"."OwnerUserId", "q"."CreationDate", "t"."Name" AS "Type", "u"."Reputation", "u"."DisplayName", "u"."Location", '' AS "ParentId", "q"."AcceptedAnswerId" FROM "Posts" AS "q" JOIN "PostTypes" AS "t" ON "q"."PostTypeId" = "t"."Id" JOIN "Users" AS "u" ON "q"."OwnerUserId" = "u"."Id" WHERE "q"."Tags" LIKE '%minecraft%' OR "q"."Title" LIKE '%minecraft%' UNION SELECT "a"."Id", "q"."Title", "a"."Body", "a"."Score", "a"."OwnerUserId", "a"."CreationDate", "t"."Name" AS "Type", "u"."Reputation", "u"."DisplayName", "u"."Location", "a"."ParentId", '' AS "AcceptedAnswerId" FROM "Posts" AS "q" JOIN "Posts" AS "a" ON "a"."ParentId" = "q"."Id" JOIN "PostTypes" AS "t" ON "a"."PostTypeId" = "t"."Id" JOIN "Users" AS "u" ON "a"."OwnerUserId" = "u"."Id" WHERE "q"."Tags" LIKE '%minecraft%' OR "q"."Title" LIKE '%minecraft%'
0.847656
CREATE TABLE table_name_66 (place VARCHAR, to_par VARCHAR, player VARCHAR)
What is the place of To par of e when Arron Oberholser was the player ?
SELECT place FROM table_name_66 WHERE to_par = "e" AND player = "arron oberholser"
SELECT "place" FROM "table_name_66" WHERE "arron oberholser" = "player" AND "e" = "to_par"
0.087891
CREATE TABLE table_2668420_12 (candidates VARCHAR, first_elected VARCHAR)
Who was the candidate in 1791?
SELECT candidates FROM table_2668420_12 WHERE first_elected = 1791
SELECT "candidates" FROM "table_2668420_12" WHERE "first_elected" = 1791
0.070313
CREATE TABLE table_36837 ("Surname" TEXT, "First" TEXT, "D.O.B." TEXT, "Bats" TEXT, "Throws" TEXT, "Position" TEXT)
How many bats does Todd have?
SELECT "Bats" FROM table_36837 WHERE "First" = 'todd'
SELECT "Bats" FROM "table_36837" WHERE "First" = 'todd'
0.053711
CREATE TABLE table_25554 ("No." FLOAT, "#" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "U.S. viewers ( million ) " TEXT, "Rank ( week ) " FLOAT, "Original air date" TEXT)
List the number of shows that had 12.04 million viewers in the united states
SELECT COUNT("Title") FROM table_25554 WHERE "U.S. viewers (million)" = '12.04'
SELECT COUNT("Title") FROM "table_25554" WHERE "U.S. viewers (million)" = '12.04'
0.079102
CREATE TABLE appellations (No INT, Appelation TEXT, County TEXT, State TEXT, Area TEXT, isAVA TEXT) CREATE TABLE grapes (ID INT, Grape TEXT, Color TEXT) CREATE TABLE wine (No INT, Grape TEXT, Winery TEXT, Appelation TEXT, State TEXT, Name TEXT, Year INT, Price INT, Score INT, Cases INT, Drink TEXT)
Show me the total number by grape in a histogram, and show from low to high by the y axis.
SELECT Grape, COUNT(*) FROM wine GROUP BY Grape ORDER BY COUNT(*)
SELECT "Grape", COUNT(*) FROM "wine" GROUP BY "Grape" ORDER BY COUNT(*) NULLS FIRST
0.081055
CREATE TABLE table_name_86 (semimajor_axis___au__ VARCHAR, companion__in_order_from_star_ VARCHAR)
What Semimajor axis (AU) has a Companion (in order from star) of g?
SELECT semimajor_axis___au__ FROM table_name_86 WHERE companion__in_order_from_star_ = "g"
SELECT "semimajor_axis___au__" FROM "table_name_86" WHERE "companion__in_order_from_star_" = "g"
0.09375
CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year 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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE 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 requirement (requirement_id INT, requirement VARCHAR, college 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 student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE course (course_id INT, name VARCHAR, department VARCHAR, number VARCHAR, credits VARCHAR, advisory_requirement VARCHAR, enforced_requirement VARCHAR, description VARCHAR, num_semesters INT, num_enrolled INT, has_discussion VARCHAR, has_lab VARCHAR, has_projects VARCHAR, has_exams VARCHAR, num_reviews INT, clarity_score INT, easiness_score INT, helpfulness_score INT) CREATE TABLE area (course_id INT, area VARCHAR)
Name the courses taught by Prof. Bradley Moore .
SELECT DISTINCT course.department, course.name, course.number FROM course, course_offering, instructor, offering_instructor WHERE course.course_id = course_offering.course_id AND instructor.name LIKE '%Bradley Moore%' AND offering_instructor.instructor_id = instructor.instructor_id AND offering_instructor.offering_id = course_offering.offering_id
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "offering_instructor" ON "course_offering"."offering_id" = "offering_instructor"."offering_id" JOIN "instructor" ON "instructor"."instructor_id" = "offering_instructor"."instructor_id" AND "instructor"."name" LIKE '%Bradley Moore%'
0.393555
CREATE TABLE table_22050544_1 (prize VARCHAR, elapsed_time VARCHAR)
What is the prize for the elapsed time of 10 h 10 min?
SELECT prize FROM table_22050544_1 WHERE elapsed_time = "10 h 10 min"
SELECT "prize" FROM "table_22050544_1" WHERE "10 h 10 min" = "elapsed_time"
0.073242
CREATE TABLE table_27114708_2 (date_of_appointment VARCHAR, replaced_by VARCHAR)
Please mention those appointment dates those are replaced by alfredo aglietti
SELECT date_of_appointment FROM table_27114708_2 WHERE replaced_by = "Alfredo Aglietti"
SELECT "date_of_appointment" FROM "table_27114708_2" WHERE "Alfredo Aglietti" = "replaced_by"
0.09082
CREATE TABLE table_name_10 (losses INT, wins VARCHAR, ties VARCHAR)
what is the average losses when the wins is 9 and ties more than 0?
SELECT AVG(losses) FROM table_name_10 WHERE wins = 9 AND ties > 0
SELECT AVG("losses") FROM "table_name_10" WHERE "ties" > 0 AND "wins" = 9
0.071289
CREATE TABLE table_name_67 (departure VARCHAR, station_name VARCHAR)
What is the Departure time at Kanpur Central Station?
SELECT departure FROM table_name_67 WHERE station_name = "kanpur central"
SELECT "departure" FROM "table_name_67" WHERE "kanpur central" = "station_name"
0.077148
CREATE TABLE table_45569 ("Game" FLOAT, "Date" TEXT, "Opponent" TEXT, "Score" TEXT, "High points" TEXT, "High rebounds" TEXT, "High assists" TEXT, "Location/Attendance" TEXT, "Record" TEXT)
What is the location/attendance of the game with a 3-1 record?
SELECT "Location/Attendance" FROM table_45569 WHERE "Record" = '3-1'
SELECT "Location/Attendance" FROM "table_45569" WHERE "Record" = '3-1'
0.068359
CREATE TABLE table_69758 ("Team" TEXT, "Season" FLOAT, "Played" FLOAT, "Lost" FLOAT, "1 st" TEXT, "2 nd" TEXT, "3 rd" TEXT, "4 th" TEXT, "Debut" TEXT, "Since/Last App" TEXT, "Best" FLOAT)
Name the 3rd for season less than 4 and lost of 61
SELECT "3 rd" FROM table_69758 WHERE "Season" < '4' AND "Lost" = '61'
SELECT "3 rd" FROM "table_69758" WHERE "Lost" = '61' AND "Season" < '4'
0.069336
CREATE TABLE shop (Shop_ID INT, Shop_Name TEXT, Location TEXT, Open_Date TEXT, Open_Year INT) CREATE TABLE device (Device_ID INT, Device TEXT, Carrier TEXT, Package_Version TEXT, Applications TEXT, Software_Platform TEXT) CREATE TABLE stock (Shop_ID INT, Device_ID INT, Quantity INT)
Give a bar chart showing how many shops in each carrier, display in asc by the y axis.
SELECT Carrier, COUNT(Carrier) FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID JOIN shop AS T3 ON T1.Shop_ID = T3.Shop_ID GROUP BY Carrier ORDER BY COUNT(Carrier)
SELECT "Carrier", COUNT("Carrier") FROM "stock" AS "T1" JOIN "device" AS "T2" ON "T1"."Device_ID" = "T2"."Device_ID" JOIN "shop" AS "T3" ON "T1"."Shop_ID" = "T3"."Shop_ID" GROUP BY "Carrier" ORDER BY COUNT("Carrier") NULLS FIRST
0.222656
CREATE TABLE membership_register_branch (Member_ID INT, Branch_ID TEXT, Register_Year TEXT) CREATE TABLE branch (Branch_ID INT, Name TEXT, Open_year TEXT, Address_road TEXT, City TEXT, membership_amount TEXT) CREATE TABLE member (Member_ID INT, Card_Number TEXT, Name TEXT, Hometown TEXT, Level INT) CREATE TABLE purchase (Member_ID INT, Branch_ID TEXT, Year TEXT, Total_pounds FLOAT)
Show the hometown of all members, and list in descending by the Y.
SELECT Hometown, COUNT(Hometown) FROM member GROUP BY Hometown ORDER BY COUNT(Hometown) DESC
SELECT "Hometown", COUNT("Hometown") FROM "member" GROUP BY "Hometown" ORDER BY COUNT("Hometown") DESC NULLS LAST
0.110352
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 ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_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 area (course_id INT, area VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE course_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 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)
CS majors require which LHC prerequisites ?
SELECT DISTINCT course.department, course.name, course.number FROM program_course INNER JOIN course ON program_course.course_id = course.course_id WHERE course.department = 'LHC'
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "program_course" JOIN "course" ON "course"."course_id" = "program_course"."course_id" AND "course"."department" = 'LHC'
0.193359
CREATE TABLE departments (DEPARTMENT_ID DECIMAL, DEPARTMENT_NAME VARCHAR, MANAGER_ID DECIMAL, LOCATION_ID DECIMAL) CREATE TABLE employees (EMPLOYEE_ID DECIMAL, FIRST_NAME VARCHAR, LAST_NAME VARCHAR, EMAIL VARCHAR, PHONE_NUMBER VARCHAR, HIRE_DATE DATE, JOB_ID VARCHAR, SALARY DECIMAL, COMMISSION_PCT DECIMAL, MANAGER_ID DECIMAL, DEPARTMENT_ID DECIMAL) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR)
For those employees who was hired before 2002-06-21, show me about the distribution of hire_date and the average of manager_id bin hire_date by weekday in a bar chart, and sort in desc by the the average of manager id.
SELECT HIRE_DATE, AVG(MANAGER_ID) FROM employees WHERE HIRE_DATE < '2002-06-21' ORDER BY AVG(MANAGER_ID) DESC
SELECT "HIRE_DATE", AVG("MANAGER_ID") FROM "employees" WHERE "HIRE_DATE" < '2002-06-21' ORDER BY AVG("MANAGER_ID") DESC NULLS LAST
0.126953
CREATE TABLE table_7598 ("Mission name" TEXT, "Lunar lander" TEXT, "Lunar landing date" TEXT, "Lunar blastoff date" TEXT, "Lunar landing site" TEXT, "Duration on lunar surface" TEXT, "Crew" TEXT, "Number of s EVA" FLOAT, "Total EVA Time ( HH:MM ) " TEXT)
Where was the landing site when the duration on the lunar surface was 21:31?
SELECT "Lunar landing site" FROM table_7598 WHERE "Duration on lunar surface" = '21:31'
SELECT "Lunar landing site" FROM "table_7598" WHERE "Duration on lunar surface" = '21:31'
0.086914
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients whose admission year is less than 2111 and item id is 51001?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admityear < "2111" AND lab.itemid = "51001"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "51001" = "lab"."itemid" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "2111" > "demographic"."admityear"
0.189453
CREATE TABLE wrestler (Reign VARCHAR, LOCATION VARCHAR)
What are the distinct reigns of wrestlers whose location is not 'Tokyo,Japan' ?
SELECT DISTINCT Reign FROM wrestler WHERE LOCATION <> "Tokyo , Japan"
SELECT DISTINCT "Reign" FROM "wrestler" WHERE "LOCATION" <> "Tokyo , Japan"
0.073242
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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 outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT)
how many times did patient 90663 visit an icu in this year?
SELECT COUNT(DISTINCT icustays.icustay_id) FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 90663) AND DATETIME(icustays.intime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year')
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 90663 GROUP BY "hadm_id") SELECT COUNT(DISTINCT "icustays"."icustay_id") FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE DATETIME("icustays"."intime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-0 year') AND NOT "_u_0"."" IS NULL
0.374023
CREATE TABLE table_203_191 (id DECIMAL, "year" DECIMAL, "group" TEXT, "award" TEXT, "result" TEXT, "notes" TEXT)
which was erbedija 's first festival/event where he was nominated but did n't win an award ?
SELECT "group" FROM table_203_191 WHERE "result" = 'nominated' ORDER BY "year" LIMIT 1
SELECT "group" FROM "table_203_191" WHERE "result" = 'nominated' ORDER BY "year" NULLS FIRST LIMIT 1
0.097656
CREATE TABLE table_22220 ("Year" FLOAT, "Delegate" TEXT, "Hometown" TEXT, "Pageant" TEXT, "Result" TEXT, "Other awards" TEXT)
How many awards did milagros gutierrez win?
SELECT "Other awards" FROM table_22220 WHERE "Delegate" = 'Milagros Gutierrez'
SELECT "Other awards" FROM "table_22220" WHERE "Delegate" = 'Milagros Gutierrez'
0.078125
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime 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 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 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)
what was the average sao2 for patient 027-211129.
SELECT AVG(vitalperiodic.sao2) FROM vitalperiodic WHERE vitalperiodic.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '027-211129')) AND NOT vitalperiodic.sao2 IS NULL
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '027-211129' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT AVG("vitalperiodic"."sao2") FROM "vitalperiodic" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "vitalperiodic"."patientunitstayid" WHERE NOT "_u_1"."" IS NULL AND NOT "vitalperiodic"."sao2" IS NULL
0.545898
CREATE TABLE table_15302 ("Driver" TEXT, "Entrant" TEXT, "Chassis" TEXT, "Engine" TEXT, "Tyres" TEXT)
What engine was in the Theodore n183?
SELECT "Engine" FROM table_15302 WHERE "Chassis" = 'theodore n183'
SELECT "Engine" FROM "table_15302" WHERE "Chassis" = 'theodore n183'
0.066406
CREATE TABLE field (fieldid INT) CREATE TABLE journal (journalid INT, journalname VARCHAR) CREATE TABLE paperdataset (paperid INT, datasetid INT) CREATE TABLE cite (citingpaperid INT, citedpaperid INT) CREATE TABLE paper (paperid INT, title VARCHAR, venueid INT, year INT, numciting INT, numcitedby INT, journalid INT) CREATE TABLE dataset (datasetid INT, datasetname VARCHAR) CREATE TABLE writes (paperid INT, authorid INT) CREATE TABLE paperfield (fieldid INT, paperid INT) CREATE TABLE keyphrase (keyphraseid INT, keyphrasename VARCHAR) CREATE TABLE author (authorid INT, authorname VARCHAR) CREATE TABLE paperkeyphrase (paperid INT, keyphraseid INT) CREATE TABLE venue (venueid INT, venuename VARCHAR)
what is the most cited paper of ohad shamir ?
SELECT DISTINCT cite.citedpaperid, COUNT(cite.citedpaperid) FROM author, cite, paper, writes WHERE author.authorname = 'ohad shamir' AND paper.paperid = cite.citedpaperid AND writes.authorid = author.authorid AND writes.paperid = paper.paperid GROUP BY cite.citedpaperid ORDER BY COUNT(cite.citedpaperid) DESC
SELECT DISTINCT "cite"."citedpaperid", COUNT("cite"."citedpaperid") FROM "author" CROSS JOIN "cite" JOIN "paper" ON "cite"."citedpaperid" = "paper"."paperid" JOIN "writes" ON "author"."authorid" = "writes"."authorid" AND "paper"."paperid" = "writes"."paperid" WHERE "author"."authorname" = 'ohad shamir' GROUP BY "cite"."citedpaperid" ORDER BY COUNT("cite"."citedpaperid") DESC NULLS LAST
0.378906
CREATE TABLE table_name_11 (opponent_in_the_final VARCHAR, surface VARCHAR)
Who was the finals opponent on the hard surface tournament?
SELECT opponent_in_the_final FROM table_name_11 WHERE surface = "hard"
SELECT "opponent_in_the_final" FROM "table_name_11" WHERE "hard" = "surface"
0.074219
CREATE TABLE table_name_47 (opponent VARCHAR, week VARCHAR)
What was week 2's opponent?
SELECT opponent FROM table_name_47 WHERE week = 2
SELECT "opponent" FROM "table_name_47" WHERE "week" = 2
0.053711
CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value 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 admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
what was the name of the drug that patient 28910 was prescribed with within the same hospital visit after being diagnosed with rheumatic heart dis nos?
SELECT t2.drug FROM (SELECT admissions.subject_id, diagnoses_icd.charttime, admissions.hadm_id FROM diagnoses_icd JOIN admissions ON diagnoses_icd.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 28910 AND diagnoses_icd.icd9_code = (SELECT d_icd_diagnoses.icd9_code FROM d_icd_diagnoses WHERE d_icd_diagnoses.short_title = 'rheumatic heart dis nos')) AS t1 JOIN (SELECT admissions.subject_id, prescriptions.drug, prescriptions.startdate, admissions.hadm_id FROM prescriptions JOIN admissions ON prescriptions.hadm_id = admissions.hadm_id WHERE admissions.subject_id = 28910) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.startdate AND t1.hadm_id = t2.hadm_id
WITH "t2" AS (SELECT "admissions"."subject_id", "prescriptions"."drug", "prescriptions"."startdate", "admissions"."hadm_id" FROM "prescriptions" JOIN "admissions" ON "admissions"."hadm_id" = "prescriptions"."hadm_id" AND "admissions"."subject_id" = 28910) SELECT "t2"."drug" FROM "diagnoses_icd" JOIN "d_icd_diagnoses" ON "d_icd_diagnoses"."icd9_code" = "diagnoses_icd"."icd9_code" AND "d_icd_diagnoses"."short_title" = 'rheumatic heart dis nos' JOIN "admissions" ON "admissions"."hadm_id" = "diagnoses_icd"."hadm_id" AND "admissions"."subject_id" = 28910 JOIN "t2" AS "t2" ON "admissions"."hadm_id" = "t2"."hadm_id" AND "admissions"."subject_id" = "t2"."subject_id" AND "diagnoses_icd"."charttime" < "t2"."startdate"
0.700195
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_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 icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE 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 patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL)
what were the four most commonly ordered procedures for patients who had previously received serum transfusion nec within 2 months, during a year before?
SELECT d_icd_procedures.short_title FROM d_icd_procedures WHERE d_icd_procedures.icd9_code IN (SELECT t3.icd9_code FROM (SELECT t2.icd9_code, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT admissions.subject_id, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE procedures_icd.icd9_code = (SELECT d_icd_procedures.icd9_code FROM d_icd_procedures WHERE d_icd_procedures.short_title = 'serum transfusion nec') AND DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT admissions.subject_id, procedures_icd.icd9_code, procedures_icd.charttime FROM procedures_icd JOIN admissions ON procedures_icd.hadm_id = admissions.hadm_id WHERE DATETIME(procedures_icd.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 ON t1.subject_id = t2.subject_id WHERE t1.charttime < t2.charttime AND DATETIME(t2.charttime) BETWEEN DATETIME(t1.charttime) AND DATETIME(t1.charttime, '+2 month') GROUP BY t2.icd9_code) AS t3 WHERE t3.c1 <= 4)
WITH "t2" AS (SELECT "admissions"."subject_id", "procedures_icd"."icd9_code", "procedures_icd"."charttime" FROM "procedures_icd" JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')), "t3" AS (SELECT "t2"."icd9_code", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "procedures_icd" JOIN "d_icd_procedures" ON "d_icd_procedures"."icd9_code" = "procedures_icd"."icd9_code" AND "d_icd_procedures"."short_title" = 'serum transfusion nec' JOIN "admissions" ON "admissions"."hadm_id" = "procedures_icd"."hadm_id" JOIN "t2" AS "t2" ON "admissions"."subject_id" = "t2"."subject_id" AND "procedures_icd"."charttime" < "t2"."charttime" AND DATETIME("procedures_icd"."charttime") <= DATETIME("t2"."charttime") AND DATETIME("procedures_icd"."charttime", '+2 month') >= DATETIME("t2"."charttime") WHERE DATETIME("procedures_icd"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY "t2"."icd9_code"), "_u_1" AS (SELECT "t3"."icd9_code" FROM "t3" AS "t3" WHERE "t3"."c1" <= 4 GROUP BY "icd9_code") SELECT "d_icd_procedures"."short_title" FROM "d_icd_procedures" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "d_icd_procedures"."icd9_code" WHERE NOT "_u_1"."" IS NULL
1.314453
CREATE TABLE table_16499 ("Team" TEXT, "Stadium" TEXT, "Capacity" FLOAT, "Highest" FLOAT, "Lowest" FLOAT, "Average" FLOAT)
What is the minimum capacity where airdrie united is?
SELECT MIN("Capacity") FROM table_16499 WHERE "Team" = 'Airdrie United'
SELECT MIN("Capacity") FROM "table_16499" WHERE "Team" = 'Airdrie United'
0.071289
CREATE TABLE table_44344 ("Class" TEXT, "Wheel arrangement" TEXT, "Fleet number ( s ) " TEXT, "Manufacturer" TEXT, "Year made" TEXT, "Quantity made" TEXT, "Quantity preserved" TEXT)
What year had a quantity made of 11 and a wheel arrangement of 4-6-2?
SELECT "Year made" FROM table_44344 WHERE "Wheel arrangement" = '4-6-2' AND "Quantity made" = '11'
SELECT "Year made" FROM "table_44344" WHERE "Quantity made" = '11' AND "Wheel arrangement" = '4-6-2'
0.097656
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
count the number of patients whose admission location is emergency room admit and procedure short title is exc/dest hrt lesion open
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_location = "EMERGENCY ROOM ADMIT" AND procedures.short_title = "Exc/dest hrt lesion open"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Exc/dest hrt lesion open" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "EMERGENCY ROOM ADMIT" = "demographic"."admission_location"
0.257813
CREATE TABLE event (ID INT, Name TEXT, Stadium_ID INT, Year TEXT) CREATE TABLE swimmer (ID INT, name TEXT, Nationality TEXT, meter_100 FLOAT, meter_200 TEXT, meter_300 TEXT, meter_400 TEXT, meter_500 TEXT, meter_600 TEXT, meter_700 TEXT, Time TEXT) CREATE TABLE stadium (ID INT, name TEXT, Capacity INT, City TEXT, Country TEXT, Opening_year INT) CREATE TABLE record (ID INT, Result TEXT, Swimmer_ID INT, Event_ID INT)
Return a bar chart about the distribution of meter_600 and ID , list in asc by the names please.
SELECT meter_600, ID FROM swimmer ORDER BY meter_600
SELECT "meter_600", "ID" FROM "swimmer" ORDER BY "meter_600" NULLS FIRST
0.070313
CREATE TABLE table_name_48 (results VARCHAR, first_elected INT)
What are the results of a first elected prior to year 1982?
SELECT results FROM table_name_48 WHERE first_elected < 1982
SELECT "results" FROM "table_name_48" WHERE "first_elected" < 1982
0.064453
CREATE TABLE table_23950611_2 (rank__all__2013 VARCHAR, name VARCHAR)
How many companies named cenovus energy?
SELECT COUNT(rank__all__2013) FROM table_23950611_2 WHERE name = "Cenovus Energy"
SELECT COUNT("rank__all__2013") FROM "table_23950611_2" WHERE "Cenovus Energy" = "name"
0.084961
CREATE TABLE table_50387 ("Tournament" TEXT, "2003" TEXT, "2004" TEXT, "2005" TEXT, "2006" TEXT, "2007" TEXT, "2008" TEXT, "2009" TEXT, "2010" TEXT, "2011" TEXT, "2012" TEXT)
With a 2008 result of 153 what is the result for 2007?
SELECT "2007" FROM table_50387 WHERE "2008" = '153'
SELECT "2007" FROM "table_50387" WHERE "2008" = '153'
0.051758
CREATE TABLE table_name_83 (riding_penalties__pts_ VARCHAR, swimming_time__pts_ VARCHAR)
What is the riding penaltie (pts) for the athlete that has a Swimming Time (pts) of 2:18.16 (1264)?
SELECT riding_penalties__pts_ FROM table_name_83 WHERE swimming_time__pts_ = "2:18.16 (1264)"
SELECT "riding_penalties__pts_" FROM "table_name_83" WHERE "2:18.16 (1264)" = "swimming_time__pts_"
0.09668
CREATE TABLE table_25561560_2 (yacht VARCHAR)
What is the yacht type of Icap Leopard?
SELECT yacht AS type FROM table_25561560_2 WHERE yacht = "ICAP Leopard"
SELECT "yacht" AS "type" FROM "table_25561560_2" WHERE "ICAP Leopard" = "yacht"
0.077148
CREATE TABLE table_name_83 (actor VARCHAR, character VARCHAR)
Which actor plays the character Helga Beimer?
SELECT actor FROM table_name_83 WHERE character = "helga beimer"
SELECT "actor" FROM "table_name_83" WHERE "character" = "helga beimer"
0.068359
CREATE TABLE table_204_786 (id DECIMAL, "riding" TEXT, "candidate" TEXT, "gender" TEXT, "residence" TEXT, "occupation" TEXT, "votes" DECIMAL, "%" DECIMAL, "rank" TEXT, "biographical notes" TEXT)
who has the most votes ?
SELECT "riding" FROM table_204_786 ORDER BY "votes" DESC LIMIT 1
SELECT "riding" FROM "table_204_786" ORDER BY "votes" DESC NULLS LAST LIMIT 1
0.075195
CREATE TABLE table_25094 ("Year" FLOAT, "Network" TEXT, "Race caller" TEXT, "s Host" TEXT, "s Analyst" TEXT, "Reporters" TEXT, "Trophy presentation" TEXT)
How many reporters for the year 1993?
SELECT COUNT("Reporters") FROM table_25094 WHERE "Year" = '1993'
SELECT COUNT("Reporters") FROM "table_25094" WHERE "Year" = '1993'
0.064453
CREATE TABLE table_29080 ("Round #" TEXT, "Home Team" TEXT, "Win/Loss" TEXT, "Score" TEXT, "Opposition" TEXT, "Location" TEXT)
What is the score when the opposition is mid canterbury?
SELECT "Score" FROM table_29080 WHERE "Opposition" = 'Mid Canterbury'
SELECT "Score" FROM "table_29080" WHERE "Opposition" = 'Mid Canterbury'
0.069336
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many female patients died?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.gender = "F" AND demographic.expire_flag = "1"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "1" = "demographic"."expire_flag" AND "F" = "demographic"."gender"
0.137695
CREATE TABLE faculty_participates_in (facid DECIMAL, actid DECIMAL) CREATE TABLE faculty (facid DECIMAL, lname TEXT, fname TEXT, rank TEXT, sex TEXT, phone DECIMAL, room TEXT, building TEXT) CREATE TABLE activity (actid DECIMAL, activity_name TEXT) CREATE TABLE participates_in (stuid DECIMAL, actid DECIMAL) CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)
Show the first name and last name for all the instructors.
SELECT fname, lname FROM faculty WHERE rank = "Instructor"
SELECT "fname", "lname" FROM "faculty" WHERE "Instructor" = "rank"
0.064453
CREATE TABLE table_38570 ("Call sign" TEXT, "Frequency MHz" FLOAT, "City of license" TEXT, "ERP W" FLOAT, "Class" TEXT, "FCC info" TEXT)
Which Frequency MHz that has a ERP W larger than 205, and a Call sign of k230ap?
SELECT MAX("Frequency MHz") FROM table_38570 WHERE "ERP W" > '205' AND "Call sign" = 'k230ap'
SELECT MAX("Frequency MHz") FROM "table_38570" WHERE "Call sign" = 'k230ap' AND "ERP W" > '205'
0.092773
CREATE TABLE table_name_8 (dob VARCHAR, bats VARCHAR, position VARCHAR)
Which DOB has Bats of s, and a Position of inf?
SELECT dob FROM table_name_8 WHERE bats = "s" AND position = "inf"
SELECT "dob" FROM "table_name_8" WHERE "bats" = "s" AND "inf" = "position"
0.072266
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 equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE 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_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE 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 city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note 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 compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR)
what is the cheapest one way fare from DENVER to PITTSBURGH
SELECT DISTINCT fare.fare_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, fare, flight, flight_fare 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 = 'PITTSBURGH' AND fare.one_direction_cost = (SELECT MIN(FAREalias1.one_direction_cost) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, fare AS FAREalias1, flight AS FLIGHTalias1, flight_fare AS FLIGHT_FAREalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'DENVER' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'PITTSBURGH' AND FAREalias1.round_trip_required = 'NO' AND FLIGHT_FAREalias1.fare_id = FAREalias1.fare_id AND FLIGHTalias1.flight_id = FLIGHT_FAREalias1.flight_id AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code) AND fare.round_trip_required = 'NO' AND flight_fare.fare_id = fare.fare_id AND flight.flight_id = flight_fare.flight_id AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code
WITH "_u_0" AS (SELECT MIN("FAREalias1"."one_direction_cost") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'DENVER' JOIN "flight" AS "FLIGHTalias1" ON "AIRPORT_SERVICEalias2"."airport_code" = "FLIGHTalias1"."from_airport" JOIN "airport_service" AS "AIRPORT_SERVICEalias3" ON "AIRPORT_SERVICEalias3"."airport_code" = "FLIGHTalias1"."to_airport" JOIN "flight_fare" AS "FLIGHT_FAREalias1" ON "FLIGHT_FAREalias1"."flight_id" = "FLIGHTalias1"."flight_id" JOIN "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'PITTSBURGH' JOIN "fare" AS "FAREalias1" ON "FAREalias1"."fare_id" = "FLIGHT_FAREalias1"."fare_id" AND "FAREalias1"."round_trip_required" = 'NO') SELECT DISTINCT "fare"."fare_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" 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" = 'PITTSBURGH' JOIN "fare" ON "fare"."fare_id" = "flight_fare"."fare_id" AND "fare"."round_trip_required" = 'NO' JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "fare"."one_direction_cost"
1.551758
CREATE TABLE table_name_80 (artist_s_ VARCHAR, book_title VARCHAR)
what artist has a book called cyberella
SELECT artist_s_ FROM table_name_80 WHERE book_title = "cyberella"
SELECT "artist_s_" FROM "table_name_80" WHERE "book_title" = "cyberella"
0.070313
CREATE TABLE table_26128 ("Election Year" FLOAT, "Assembly" TEXT, "Winning Party/Coalition" TEXT, "Chief Minister" TEXT, "Speaker" TEXT)
Who is the winning party/coalition name in election year 1980?
SELECT "Winning Party/Coalition" FROM table_26128 WHERE "Election Year" = '1980'
SELECT "Winning Party/Coalition" FROM "table_26128" WHERE "Election Year" = '1980'
0.080078
CREATE TABLE table_1354805_6 (rank_by_average VARCHAR, number_of_dances VARCHAR)
tell the mean of the times competition for the 7 jigs
SELECT rank_by_average FROM table_1354805_6 WHERE number_of_dances = 7
SELECT "rank_by_average" FROM "table_1354805_6" WHERE "number_of_dances" = 7
0.074219
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT)
how many patients whose lab test abnormal status is abnormal and lab test name is cd4/cd8 ratio?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE lab.flag = "abnormal" AND lab.label = "CD4/CD8 Ratio"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "CD4/CD8 Ratio" = "lab"."label" AND "abnormal" = "lab"."flag" AND "demographic"."hadm_id" = "lab"."hadm_id"
0.185547
CREATE TABLE table_67412 ("2000" TEXT, "2004" TEXT, "2009" TEXT, "2013" TEXT, "Total" FLOAT)
What shows for 2000 when 2013 shows 3rd?
SELECT "2000" FROM table_67412 WHERE "2013" = '3rd'
SELECT "2000" FROM "table_67412" WHERE "2013" = '3rd'
0.051758
CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
tell me the time of hospital admission of patient 62918 in 2101?
SELECT admissions.admittime FROM admissions WHERE admissions.subject_id = 62918 AND STRFTIME('%y', admissions.admittime) = '2101'
SELECT "admissions"."admittime" FROM "admissions" WHERE "admissions"."subject_id" = 62918 AND STRFTIME('%y', "admissions"."admittime") = '2101'
0.139648
CREATE TABLE table_57617 ("Serial Title" TEXT, "Year" TEXT, "Chapters" TEXT, "Director" TEXT, "Cast" TEXT)
I want the cast for director of colbert clark and armand schaefer for burn 'em up barnes
SELECT "Cast" FROM table_57617 WHERE "Director" = 'colbert clark and armand schaefer' AND "Serial Title" = 'burn ''em up barnes'
SELECT "Cast" FROM "table_57617" WHERE "Director" = 'colbert clark and armand schaefer' AND "Serial Title" = 'burn \'em up barnes'
0.126953
CREATE TABLE playlisttrack (playlistid DECIMAL, trackid DECIMAL) CREATE TABLE album (albumid DECIMAL, title TEXT, artistid DECIMAL) CREATE TABLE genre (genreid DECIMAL, name TEXT) CREATE TABLE mediatype (mediatypeid DECIMAL, name TEXT) CREATE TABLE invoiceline (invoicelineid DECIMAL, invoiceid DECIMAL, trackid DECIMAL, unitprice DECIMAL, quantity DECIMAL) CREATE TABLE artist (artistid DECIMAL, name TEXT) CREATE TABLE track (trackid DECIMAL, name TEXT, albumid DECIMAL, mediatypeid DECIMAL, genreid DECIMAL, composer TEXT, milliseconds DECIMAL, bytes DECIMAL, unitprice DECIMAL) CREATE TABLE employee (employeeid DECIMAL, lastname TEXT, firstname TEXT, title TEXT, reportsto DECIMAL, birthdate TIME, hiredate TIME, address TEXT, city TEXT, state TEXT, country TEXT, postalcode TEXT, phone TEXT, fax TEXT, email TEXT) CREATE TABLE playlist (playlistid DECIMAL, name TEXT) CREATE TABLE invoice (invoiceid DECIMAL, customerid DECIMAL, invoicedate TIME, billingaddress TEXT, billingcity TEXT, billingstate TEXT, billingcountry TEXT, billingpostalcode TEXT, total DECIMAL) CREATE TABLE customer (customerid DECIMAL, firstname TEXT, lastname TEXT, company TEXT, address TEXT, city TEXT, state TEXT, country TEXT, postalcode TEXT, phone TEXT, fax TEXT, email TEXT, supportrepid DECIMAL)
Find the average millisecond length of Latin and Pop tracks.
SELECT AVG(milliseconds) FROM genre AS T1 JOIN track AS T2 ON T1.genreid = T2.genreid WHERE T1.name = "Latin" OR T1.name = "Pop"
SELECT AVG("milliseconds") FROM "genre" AS "T1" JOIN "track" AS "T2" ON "T1"."genreid" = "T2"."genreid" WHERE "Latin" = "T1"."name" OR "Pop" = "T1"."name"
0.150391
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 medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) 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 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 patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME)
when did patient 009-12985 the last time had urine catheter output until 2045 days ago?
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 = '009-12985')) AND intakeoutput.cellpath LIKE '%output%' AND intakeoutput.celllabel = 'urine catheter' AND DATETIME(intakeoutput.intakeoutputtime) <= DATETIME(CURRENT_TIME(), '-2045 day') ORDER BY intakeoutput.intakeoutputtime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '009-12985' 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 catheter' AND "intakeoutput"."cellpath" LIKE '%output%' AND DATETIME("intakeoutput"."intakeoutputtime") <= DATETIME(CURRENT_TIME(), '-2045 day') AND NOT "_u_1"."" IS NULL ORDER BY "intakeoutput"."intakeoutputtime" DESC NULLS LAST LIMIT 1
0.756836
CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college 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 student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE area (course_id INT, area VARCHAR) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) 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 comment_instructor (instructor_id INT, student_id INT, score INT, comment_text 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 jobs (job_id INT, job_title VARCHAR, description VARCHAR, requirement VARCHAR, city VARCHAR, state VARCHAR, country VARCHAR, zip 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 (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category VARCHAR)
Which class is the easiest class to fulfil the Other requirement that I can take ?
SELECT DISTINCT course.department, course.name, course.number, program_course.workload, program_course.workload FROM course, program_course WHERE program_course.category LIKE '%Other%' AND program_course.course_id = course.course_id AND program_course.workload = (SELECT MIN(PROGRAM_COURSEalias1.workload) FROM program_course AS PROGRAM_COURSEalias1 WHERE PROGRAM_COURSEalias1.category LIKE '%Other%')
WITH "_u_0" AS (SELECT MIN("PROGRAM_COURSEalias1"."workload") FROM "program_course" AS "PROGRAM_COURSEalias1" WHERE "PROGRAM_COURSEalias1"."category" LIKE '%Other%') SELECT DISTINCT "course"."department", "course"."name", "course"."number", "program_course"."workload", "program_course"."workload" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%Other%' JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "program_course"."workload"
0.488281
CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE 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)
count the number of people who were prescribed potassium chloride 10 meq in 100 ml ivpb **locked dose within 2 months following a diagnosis of sinus tachycardia during the last year.
SELECT COUNT(DISTINCT t1.uniquepid) FROM (SELECT patient.uniquepid, diagnosis.diagnosistime FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sinus tachycardia' AND DATETIME(diagnosis.diagnosistime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t1 JOIN (SELECT patient.uniquepid, medication.drugstarttime FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE medication.drugname = 'potassium chloride 10 meq in 100 ml ivpb **locked dose' AND DATETIME(medication.drugstarttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')) AS t2 WHERE t1.diagnosistime < t2.drugstarttime AND DATETIME(t2.drugstarttime) BETWEEN DATETIME(t1.diagnosistime) AND DATETIME(t1.diagnosistime, '+2 month')
SELECT COUNT(DISTINCT "patient"."uniquepid") FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "medication" ON "diagnosis"."diagnosistime" < "medication"."drugstarttime" AND "medication"."drugname" = 'potassium chloride 10 meq in 100 ml ivpb **locked dose' AND DATETIME("diagnosis"."diagnosistime") <= DATETIME("medication"."drugstarttime") AND DATETIME("diagnosis"."diagnosistime", '+2 month') >= DATETIME("medication"."drugstarttime") AND DATETIME("medication"."drugstarttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') JOIN "patient" AS "patient_2" ON "medication"."patientunitstayid" = "patient_2"."patientunitstayid" WHERE "diagnosis"."diagnosisname" = 'sinus tachycardia' AND DATETIME("diagnosis"."diagnosistime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year')
0.854492
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)
count the number of patients whose drug name is diphenhydramine?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE prescriptions.drug = "DiphenhydrAMINE"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "DiphenhydrAMINE" = "prescriptions"."drug" AND "demographic"."hadm_id" = "prescriptions"."hadm_id"
0.186523
CREATE TABLE workshop (Workshop_ID INT, Date TEXT, Venue TEXT, Name TEXT) CREATE TABLE submission (Submission_ID INT, Scores FLOAT, Author TEXT, College TEXT) CREATE TABLE Acceptance (Submission_ID INT, Workshop_ID INT, Result TEXT)
How many workshops did each author submit to? Return the author name and the number of workshops in a bar chart, and could you display by the X in asc?
SELECT Author, COUNT(DISTINCT T1.Workshop_ID) FROM Acceptance AS T1 JOIN submission AS T2 ON T1.Submission_ID = T2.Submission_ID ORDER BY Author
SELECT "Author", COUNT(DISTINCT "T1"."Workshop_ID") FROM "Acceptance" AS "T1" JOIN "submission" AS "T2" ON "T1"."Submission_ID" = "T2"."Submission_ID" ORDER BY "Author" NULLS FIRST
0.175781
CREATE TABLE table_name_1 (comp VARCHAR, date VARCHAR)
What's the comp for 1998-04-22?
SELECT comp FROM table_name_1 WHERE date = "1998-04-22"
SELECT "comp" FROM "table_name_1" WHERE "1998-04-22" = "date"
0.05957
CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId 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 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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL)
Top 1000 developers of Pakistan.
SELECT ROW_NUMBER() OVER (ORDER BY Reputation DESC) AS "#", Id AS "user_link", Reputation FROM Users WHERE LOWER(Location) LIKE '%germany%' OR UPPER(Location) LIKE '%DE%' ORDER BY Reputation DESC LIMIT 1000
SELECT ROW_NUMBER() OVER (ORDER BY "Reputation" DESC NULLS LAST) AS "#", "Id" AS "user_link", "Reputation" FROM "Users" WHERE LOWER("Location") LIKE '%germany%' OR UPPER("Location") LIKE '%DE%' ORDER BY "Reputation" DESC NULLS LAST LIMIT 1000
0.236328
CREATE TABLE table_name_66 (date_of_birth VARCHAR, begin_date VARCHAR)
What was the date of birth of the member of the United States House of Representatives that began their term on April 24, 1902?
SELECT date_of_birth FROM table_name_66 WHERE begin_date = "april 24, 1902"
SELECT "date_of_birth" FROM "table_name_66" WHERE "april 24, 1902" = "begin_date"
0.079102
CREATE TABLE table_51110 ("Rank" TEXT, "Nation" TEXT, "Gold" FLOAT, "Silver" FLOAT, "Bronze" FLOAT, "Total" FLOAT)
Name the Silver which has a Bronze of 19, and a Total larger than 58?
SELECT MIN("Silver") FROM table_51110 WHERE "Bronze" = '19' AND "Total" > '58'
SELECT MIN("Silver") FROM "table_51110" WHERE "Bronze" = '19' AND "Total" > '58'
0.078125
CREATE TABLE table_name_24 (engine VARCHAR, chassis VARCHAR, drivers VARCHAR)
What engine did Casey Mears use on the Reynard 01i Chassis?
SELECT engine FROM table_name_24 WHERE chassis = "reynard 01i" AND drivers = "casey mears"
SELECT "engine" FROM "table_name_24" WHERE "casey mears" = "drivers" AND "chassis" = "reynard 01i"
0.095703
CREATE TABLE table_21437 ("Fin. Pos" FLOAT, "Car No." FLOAT, "Driver" TEXT, "Team" TEXT, "Laps" FLOAT, "Time/Retired" TEXT, "Grid" FLOAT, "Laps Led" FLOAT, "Points" TEXT)
Which position earned 50 points?
SELECT MAX("Fin. Pos") FROM table_21437 WHERE "Points" = '50'
SELECT MAX("Fin. Pos") FROM "table_21437" WHERE "Points" = '50'
0.061523
CREATE TABLE table_13115 ("Shooter" TEXT, "Event" TEXT, "Rank points" TEXT, "Score points" TEXT, "Total" TEXT)
What event did the shooter, who had 29 total points, compete in?
SELECT "Event" FROM table_13115 WHERE "Total" = '29'
SELECT "Event" FROM "table_13115" WHERE "Total" = '29'
0.052734
CREATE TABLE table_203_9 (id DECIMAL, "state" TEXT, "last execution date" TEXT, "name" TEXT, "crime" TEXT, "method" TEXT)
how many states have done executions in 2014 ?
SELECT COUNT("state") FROM table_203_9 WHERE "last execution date" = 2014
SELECT COUNT("state") FROM "table_203_9" WHERE "last execution date" = 2014
0.073242
CREATE TABLE table_57461 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
Which home team has a score of 10.15 (75)?
SELECT "Home team" FROM table_57461 WHERE "Home team score" = '10.15 (75)'
SELECT "Home team" FROM "table_57461" WHERE "Home team score" = '10.15 (75)'
0.074219
CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) 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 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) 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 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)
Most frequent users of a word in posts.
SELECT OwnerUserId AS "user_link", COUNT(Id) AS "posts" FROM Posts WHERE LOWER(Body) LIKE LOWER('%##word##%') AND CreationDate < '##date##' GROUP BY OwnerUserId ORDER BY COUNT(Id) DESC
SELECT "OwnerUserId" AS "user_link", COUNT("Id") AS "posts" FROM "Posts" WHERE "CreationDate" < '##date##' AND LOWER("Body") LIKE LOWER('%##word##%') GROUP BY "OwnerUserId" ORDER BY COUNT("Id") DESC NULLS LAST
0.204102
CREATE TABLE table_63037 ("Player" TEXT, "County" TEXT, "Tally" TEXT, "Total" FLOAT, "Matches" FLOAT, "Average" FLOAT)
How many total points did Oisin McConville have from his 5 matches?
SELECT COUNT("Total") FROM table_63037 WHERE "Player" = 'oisin mcconville' AND "Matches" < '5'
SELECT COUNT("Total") FROM "table_63037" WHERE "Matches" < '5' AND "Player" = 'oisin mcconville'
0.09375
CREATE TABLE table_name_86 (city VARCHAR, erp__analog__digital_ VARCHAR)
Which City has 600kw 500kw ERP ?
SELECT city FROM table_name_86 WHERE erp__analog__digital_ = "600kw 500kw"
SELECT "city" FROM "table_name_86" WHERE "600kw 500kw" = "erp__analog__digital_"
0.078125
CREATE TABLE table_2562572_27 (settlement VARCHAR, cyrillic_name_other_names VARCHAR)
How many places have as their cyrillic name and other names ?
SELECT COUNT(settlement) FROM table_2562572_27 WHERE cyrillic_name_other_names = "Његошево"
SELECT COUNT("settlement") FROM "table_2562572_27" WHERE "cyrillic_name_other_names" = "Његошево"
0.094727
CREATE TABLE table_261895_1 (type VARCHAR, institution VARCHAR)
which categories fit under the institution calvin college?
SELECT type FROM table_261895_1 WHERE institution = "Calvin College"
SELECT "type" FROM "table_261895_1" WHERE "Calvin College" = "institution"
0.072266
CREATE TABLE table_204_248 (id DECIMAL, "rank" DECIMAL, "nation" TEXT, "gold" DECIMAL, "silver" DECIMAL, "bronze" DECIMAL, "total" DECIMAL)
did vietnam or south korea had the more silver medals ?
SELECT "nation" FROM table_204_248 WHERE "nation" IN ('vietnam', 'south korea') ORDER BY "silver" DESC LIMIT 1
SELECT "nation" FROM "table_204_248" WHERE "nation" IN ('vietnam', 'south korea') ORDER BY "silver" DESC NULLS LAST LIMIT 1
0.120117
CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME)
what is the minimum total hospital cost that includes the calcium during the last year?
SELECT MIN(t1.c1) FROM (SELECT SUM(cost.cost) AS c1 FROM cost WHERE cost.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.patientunitstayid IN (SELECT lab.patientunitstayid FROM lab WHERE lab.labname = 'calcium')) AND DATETIME(cost.chargetime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') GROUP BY cost.patienthealthsystemstayid) AS t1
WITH "_u_0" AS (SELECT "lab"."patientunitstayid" FROM "lab" WHERE "lab"."labname" = 'calcium' GROUP BY "patientunitstayid"), "_u_1" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patientunitstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patienthealthsystemstayid"), "t1" AS (SELECT SUM("cost"."cost") AS "c1" FROM "cost" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "cost"."patienthealthsystemstayid" WHERE DATETIME("cost"."chargetime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL GROUP BY "cost"."patienthealthsystemstayid") SELECT MIN("t1"."c1") FROM "t1" AS "t1"
0.668945
CREATE TABLE table_name_34 (rank VARCHAR, qual VARCHAR)
What is the rank of the 150.163 qual?
SELECT rank FROM table_name_34 WHERE qual = "150.163"
SELECT "rank" FROM "table_name_34" WHERE "150.163" = "qual"
0.057617
CREATE TABLE table_21848 ("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)
What is the try bonus when the tries against are 17?
SELECT "Try bonus" FROM table_21848 WHERE "Tries against" = '17'
SELECT "Try bonus" FROM "table_21848" WHERE "Tries against" = '17'
0.064453
CREATE TABLE table_name_26 (result VARCHAR, venue VARCHAR)
What is the result of the game played at Jinan?
SELECT result FROM table_name_26 WHERE venue = "jinan"
SELECT "result" FROM "table_name_26" WHERE "jinan" = "venue"
0.058594
CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId 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 ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) 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 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 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 SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange 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 ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE 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 ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) 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)
Number of votes from a certain to another user.
SELECT * FROM PostTypes
SELECT * FROM "PostTypes"
0.024414
CREATE TABLE railway (Railway_ID INT, Railway TEXT, Builder TEXT, Built TEXT, Wheels TEXT, Location TEXT, ObjectNumber TEXT) CREATE TABLE train (Train_ID INT, Train_Num TEXT, Name TEXT, From TEXT, Arrival TEXT, Railway_ID INT) CREATE TABLE manager (Manager_ID INT, Name TEXT, Country TEXT, Working_year_starts TEXT, Age INT, Level INT) CREATE TABLE railway_manage (Railway_ID INT, Manager_ID INT, From_Year TEXT)
Tell me the distribution of the number of trains at each arrival time with a bar chart, and display by the Y-axis from high to low.
SELECT Arrival, COUNT(Arrival) FROM train GROUP BY Arrival ORDER BY COUNT(Arrival) DESC
SELECT "Arrival", COUNT("Arrival") FROM "train" GROUP BY "Arrival" ORDER BY COUNT("Arrival") DESC NULLS LAST
0.105469
CREATE TABLE table_19787093_1 (vehicle_category VARCHAR, till_agra VARCHAR)
What kind of vehicle is the agra 1050?
SELECT vehicle_category FROM table_19787093_1 WHERE till_agra = 1050
SELECT "vehicle_category" FROM "table_19787093_1" WHERE "till_agra" = 1050
0.072266
CREATE TABLE table_name_95 (title VARCHAR, release_date VARCHAR)
What's the title of the film with the release date of 1954-12-18?
SELECT title FROM table_name_95 WHERE release_date = "1954-12-18"
SELECT "title" FROM "table_name_95" WHERE "1954-12-18" = "release_date"
0.069336
CREATE TABLE table_55275 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" FLOAT)
Which December 4, 1976 week has an attendance less than 57,366?
SELECT MIN("Week") FROM table_55275 WHERE "Date" = 'december 4, 1976' AND "Attendance" < '57,366'
SELECT MIN("Week") FROM "table_55275" WHERE "Attendance" < '57,366' AND "Date" = 'december 4, 1976'
0.09668
CREATE TABLE table_55058 ("Home team" TEXT, "Home team score" TEXT, "Away team" TEXT, "Away team score" TEXT, "Venue" TEXT, "Crowd" FLOAT, "Date" TEXT)
If the Home team is carlton, what's the lowest Crowd found?
SELECT MIN("Crowd") FROM table_55058 WHERE "Home team" = 'carlton'
SELECT MIN("Crowd") FROM "table_55058" WHERE "Home team" = 'carlton'
0.066406
CREATE TABLE table_name_58 (date VARCHAR, crowd INT)
What was the date when the crowd was larger than 30,495?
SELECT date FROM table_name_58 WHERE crowd > 30 OFFSET 495
SELECT "date" FROM "table_name_58" WHERE "crowd" > 30 OFFSET 495
0.0625
CREATE TABLE table_11854 ("Client" TEXT, "Windows" TEXT, "GNU/Linux" TEXT, "Mac OS X" TEXT, "Haiku" TEXT)
Which Mac OSX's GNU/Linux was yes when Windows was no?
SELECT "Mac OS X" FROM table_11854 WHERE "GNU/Linux" = 'yes' AND "Windows" = 'no'
SELECT "Mac OS X" FROM "table_11854" WHERE "GNU/Linux" = 'yes' AND "Windows" = 'no'
0.081055
CREATE TABLE table_203_864 (id DECIMAL, "place" TEXT, "player" TEXT, "country" TEXT, "score" TEXT, "to par" DECIMAL, "money ( $ ) " DECIMAL)
gene sarazen and denny shute are both from which country ?
SELECT "country" FROM table_203_864 WHERE "player" = 'gene sarazen'
SELECT "country" FROM "table_203_864" WHERE "player" = 'gene sarazen'
0.067383
CREATE TABLE table_51440 ("Date" TEXT, "Visitor" TEXT, "Score" TEXT, "Home" TEXT, "Decision" TEXT, "Attendance" FLOAT, "Record" TEXT)
What was the lowest attendance at a game when Pittsburgh was the home team?
SELECT MIN("Attendance") FROM table_51440 WHERE "Home" = 'pittsburgh'
SELECT MIN("Attendance") FROM "table_51440" WHERE "Home" = 'pittsburgh'
0.069336
CREATE TABLE table_30945 ("Episode" FLOAT, "Broadcast date" TEXT, "Guest ( s ) " TEXT, "Singer ( s ) " TEXT, "Comedian" TEXT, "Ratings" TEXT)
Name the singer for joe wilkinson
SELECT "Singer(s)" FROM table_30945 WHERE "Comedian" = 'Joe Wilkinson'
SELECT "Singer(s)" FROM "table_30945" WHERE "Comedian" = 'Joe Wilkinson'
0.070313
CREATE TABLE table_20426 ("Issuing network" TEXT, "IIN ranges" TEXT, "Active" TEXT, "Length" TEXT, "Validation" TEXT)
Is the iin range 4 active?
SELECT "Active" FROM table_20426 WHERE "IIN ranges" = '4'
SELECT "Active" FROM "table_20426" WHERE "IIN ranges" = '4'
0.057617
CREATE TABLE table_203_799 (id DECIMAL, "year" DECIMAL, "date" TEXT, "title" TEXT, "format ( s ) " TEXT, "award description ( s ) " TEXT, "result ( s ) " TEXT)
prior to 1993 how many releases were in album format ?
SELECT COUNT(*) FROM table_203_799 WHERE "year" < 1993 AND "format(s)" = 'album'
SELECT COUNT(*) FROM "table_203_799" WHERE "format(s)" = 'album' AND "year" < 1993
0.080078
CREATE TABLE table_35837 ("Year" FLOAT, "Location" TEXT, "Gold" TEXT, "Silver" TEXT, "Bronze" TEXT)
Who won gold in the games where Pan Cheng-Tsung won silver?
SELECT "Gold" FROM table_35837 WHERE "Silver" = 'pan cheng-tsung'
SELECT "Gold" FROM "table_35837" WHERE "Silver" = 'pan cheng-tsung'
0.06543
CREATE TABLE table_10840 ("Year" FLOAT, "Title" TEXT, "Role" TEXT, "Leading Lady" TEXT, "Director" TEXT)
Who is the leading lady in a yank in the r.a.f.?
SELECT "Leading Lady" FROM table_10840 WHERE "Title" = 'a yank in the r.a.f.'
SELECT "Leading Lady" FROM "table_10840" WHERE "Title" = 'a yank in the r.a.f.'
0.077148
CREATE TABLE table_56496 ("Date" TEXT, "Venue" TEXT, "Opponent" TEXT, "Result" TEXT, "Tournament" TEXT, "Scored" FLOAT)
Who was the opponent with a score of 40-20?
SELECT "Opponent" FROM table_56496 WHERE "Result" = '40-20'
SELECT "Opponent" FROM "table_56496" WHERE "Result" = '40-20'
0.05957
CREATE TABLE table_203_322 (id DECIMAL, "club" TEXT, "played" DECIMAL, "won" DECIMAL, "drawn" DECIMAL, "lost" DECIMAL, "points for" DECIMAL, "points against" DECIMAL, "bonus points" DECIMAL, "points" DECIMAL)
which club had the most losses ?
SELECT "club" FROM table_203_322 ORDER BY "lost" DESC LIMIT 1
SELECT "club" FROM "table_203_322" ORDER BY "lost" DESC NULLS LAST LIMIT 1
0.072266
CREATE TABLE table_name_38 (to_par INT, player VARCHAR)
What is average to par when Bud Holscher is the player?
SELECT AVG(to_par) FROM table_name_38 WHERE player = "bud holscher"
SELECT AVG("to_par") FROM "table_name_38" WHERE "bud holscher" = "player"
0.071289
CREATE TABLE table_name_10 (athlete VARCHAR, rank INT)
who is the athlete with the rank smaller than 2?
SELECT athlete FROM table_name_10 WHERE rank < 2
SELECT "athlete" FROM "table_name_10" WHERE "rank" < 2
0.052734