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 election (Election_ID INT, Counties_Represented TEXT, District INT, Delegate TEXT, Party INT, First_Elected FLOAT, Committee TEXT) CREATE TABLE party (Party_ID INT, Year FLOAT, Party TEXT, Governor TEXT, Lieutenant_Governor TEXT, Comptroller TEXT, Attorney_General TEXT, US_Senate TEXT) CREATE TABLE county (County_Id INT, County_name TEXT, Population FLOAT, Zip_code TEXT)
A pie chart for finding the number of the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
SELECT Comptroller, COUNT(Comptroller) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2 GROUP BY Comptroller
SELECT "Comptroller", COUNT("Comptroller") FROM "election" AS "T1" JOIN "party" AS "T2" ON "T1"."Party" = "T2"."Party_ID" WHERE "T1"."District" = 1 OR "T1"."District" = 2 GROUP BY "Comptroller"
0.188477
CREATE TABLE table_28176 ("Episode" FLOAT, "Reward" TEXT, "Leader Battle" TEXT, "Immunity" TEXT, "Individual Immunity" TEXT, "Eliminated" TEXT, "Vote" TEXT, "Finish" TEXT)
Name the finish for 4-4
SELECT "Finish" FROM table_28176 WHERE "Vote" = '4-4'
SELECT "Finish" FROM "table_28176" WHERE "Vote" = '4-4'
0.053711
CREATE TABLE table_203_174 (id DECIMAL, "rank" DECIMAL, "film" TEXT, "year" DECIMAL, "opening weekend\ ( three day ) " TEXT, "inflation-adjusted\ ( 2014 usd ) " TEXT)
which film had the least opening weekend ?
SELECT "film" FROM table_203_174 ORDER BY "opening weekend\n(three day)" LIMIT 1
SELECT "film" FROM "table_203_174" ORDER BY "opening weekend\n(three day)" NULLS FIRST LIMIT 1
0.091797
CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE 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 area (course_id INT, area VARCHAR) CREATE TABLE course_tags_count (course_id INT, clear_grading INT, pop_quiz INT, group_projects INT, inspirational INT, long_lectures INT, extra_credit INT, few_tests INT, good_feedback INT, tough_tests INT, heavy_papers INT, cares_for_students INT, heavy_assignments INT, respected INT, participation INT, heavy_reading INT, tough_grader INT, hilarious INT, would_take_again INT, good_lecture INT, no_skip INT) CREATE TABLE 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 offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year 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 (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 requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) 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 course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR)
Of the classes offered , which will be available during the next 6 semesters ?
SELECT DISTINCT course.name, course.number, semester.semester, semester.year FROM course, course_offering, semester WHERE ((semester.semester = 'FA' AND semester.year = 2016) OR (semester.semester = 'FA' AND semester.year = 2017) OR (semester.semester = 'FA' AND semester.year = 2018) OR (semester.semester = 'WN' AND semester.year = 2017) OR (semester.semester = 'WN' AND semester.year = 2018) OR (semester.semester = 'WN' AND semester.year = 2019)) AND course.course_id = course_offering.course_id AND course.department = 'EECS' AND semester.semester_id = course_offering.semester ORDER BY semester.year, semester.semester
SELECT DISTINCT "course"."name", "course"."number", "semester"."semester", "semester"."year" FROM "course" JOIN "course_offering" ON "course"."course_id" = "course_offering"."course_id" JOIN "semester" ON "course_offering"."semester" = "semester"."semester_id" AND (("semester"."semester" = 'FA' AND "semester"."year" = 2016) OR ("semester"."semester" = 'FA' AND "semester"."year" = 2017) OR ("semester"."semester" = 'FA' AND "semester"."year" = 2018) OR ("semester"."semester" = 'WN' AND "semester"."year" = 2017) OR ("semester"."semester" = 'WN' AND "semester"."year" = 2018) OR ("semester"."semester" = 'WN' AND "semester"."year" = 2019)) WHERE "course"."department" = 'EECS' ORDER BY "semester"."year" NULLS FIRST, "semester"."semester" NULLS FIRST
0.734375
CREATE TABLE table_42532 ("Week" FLOAT, "Date" TEXT, "Opponent" TEXT, "Result" TEXT, "Attendance" TEXT)
Which Opponent has a Date of november 21, 1999?
SELECT "Opponent" FROM table_42532 WHERE "Date" = 'november 21, 1999'
SELECT "Opponent" FROM "table_42532" WHERE "Date" = 'november 21, 1999'
0.069336
CREATE TABLE program_course (program_id INT, course_id INT, workload INT, category 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 (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 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 program_requirement (program_id INT, category VARCHAR, min_credit INT, additional_req VARCHAR) CREATE TABLE program (program_id INT, name VARCHAR, college VARCHAR, introduction VARCHAR) CREATE TABLE ta (campus_job_id INT, student_id INT, location VARCHAR) CREATE TABLE offering_instructor (offering_instructor_id INT, offering_id INT, instructor_id INT) CREATE TABLE student_record (student_id INT, course_id INT, semester INT, grade VARCHAR, how VARCHAR, transfer_source VARCHAR, earn_credit VARCHAR, repeat_term VARCHAR, test_id VARCHAR) CREATE TABLE 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 area (course_id INT, area VARCHAR) CREATE TABLE gsi (course_offering_id INT, student_id INT) CREATE TABLE instructor (instructor_id INT, name VARCHAR, uniqname VARCHAR) CREATE TABLE course_prerequisite (pre_course_id INT, course_id INT) CREATE TABLE semester (semester_id INT, semester VARCHAR, year INT) CREATE TABLE requirement (requirement_id INT, requirement VARCHAR, college VARCHAR) CREATE TABLE student (student_id INT, lastname VARCHAR, firstname VARCHAR, program_id INT, declare_major VARCHAR, total_credit INT, total_gpa FLOAT, entered_as VARCHAR, admit_term INT, predicted_graduation_semester INT, degree VARCHAR, minor VARCHAR, internship VARCHAR) CREATE TABLE comment_instructor (instructor_id INT, student_id INT, score INT, comment_text VARCHAR)
Among NEUROSCI classes , which are the ones that can be counted as PreMajor ?
SELECT DISTINCT course.department, course.name, course.number FROM course, program, program_course WHERE course.department LIKE '%NEUROSCI%' AND program_course.category LIKE '%PreMajor%' AND program_course.course_id = course.course_id AND program.name LIKE '%CS-LSA%' AND program.program_id = program_course.program_id
SELECT DISTINCT "course"."department", "course"."name", "course"."number" FROM "course" JOIN "program_course" ON "course"."course_id" = "program_course"."course_id" AND "program_course"."category" LIKE '%PreMajor%' JOIN "program" ON "program"."name" LIKE '%CS-LSA%' AND "program"."program_id" = "program_course"."program_id" WHERE "course"."department" LIKE '%NEUROSCI%'
0.361328
CREATE TABLE table_201_44 (id DECIMAL, "year" DECIMAL, "title" TEXT, "role" TEXT, "notes" TEXT)
how many of the films listed were a television movie ?
SELECT COUNT(*) FROM table_201_44 WHERE "notes" = 'television movie'
SELECT COUNT(*) FROM "table_201_44" WHERE "notes" = 'television movie'
0.068359
CREATE TABLE table_name_15 (title VARCHAR, year VARCHAR, genre VARCHAR, result VARCHAR)
Which title's genre was jazz when it was nominated in 1996?
SELECT title FROM table_name_15 WHERE genre = "jazz" AND result = "nominated" AND year = "1996"
SELECT "title" FROM "table_name_15" WHERE "1996" = "year" AND "genre" = "jazz" AND "nominated" = "result"
0.102539
CREATE TABLE locations (LOCATION_ID DECIMAL, STREET_ADDRESS VARCHAR, POSTAL_CODE VARCHAR, CITY VARCHAR, STATE_PROVINCE VARCHAR, COUNTRY_ID VARCHAR) CREATE TABLE jobs (JOB_ID VARCHAR, JOB_TITLE VARCHAR, MIN_SALARY DECIMAL, MAX_SALARY DECIMAL) CREATE TABLE job_history (EMPLOYEE_ID DECIMAL, START_DATE DATE, END_DATE DATE, JOB_ID VARCHAR, DEPARTMENT_ID DECIMAL) CREATE TABLE countries (COUNTRY_ID VARCHAR, COUNTRY_NAME VARCHAR, REGION_ID DECIMAL) CREATE TABLE regions (REGION_ID DECIMAL, REGION_NAME VARCHAR) 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)
For those employees who did not have any job in the past, visualize a bar chart about the distribution of hire_date and the sum of salary bin hire_date by time, sort total number in ascending order.
SELECT HIRE_DATE, SUM(SALARY) FROM employees WHERE NOT EMPLOYEE_ID IN (SELECT EMPLOYEE_ID FROM job_history) ORDER BY SUM(SALARY)
SELECT "HIRE_DATE", SUM("SALARY") FROM "employees" WHERE NOT "EMPLOYEE_ID" IN (SELECT "EMPLOYEE_ID" FROM "job_history") ORDER BY SUM("SALARY") NULLS FIRST
0.150391
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) 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)
what was the organism name of the first bronchial lavage microbiology test of patient 031-19622 until 42 months ago?
SELECT microlab.organism FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '031-19622')) AND microlab.culturesite = 'bronchial lavage' AND DATETIME(microlab.culturetakentime) <= DATETIME(CURRENT_TIME(), '-42 month') ORDER BY microlab.culturetakentime LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '031-19622' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT "microlab"."organism" FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'bronchial lavage' AND DATETIME("microlab"."culturetakentime") <= DATETIME(CURRENT_TIME(), '-42 month') AND NOT "_u_1"."" IS NULL ORDER BY "microlab"."culturetakentime" NULLS FIRST LIMIT 1
0.680664
CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE 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 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 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 allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME)
there is a microbiological test result for patient 025-19271's urine, voided specimen?
SELECT COUNT(*) FROM microlab WHERE microlab.patientunitstayid IN (SELECT patient.patientunitstayid FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '025-19271')) AND microlab.culturesite = 'urine, voided specimen'
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '025-19271' GROUP BY "patienthealthsystemstayid"), "_u_1" AS (SELECT "patient"."patientunitstayid" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_0"."" IS NULL GROUP BY "patientunitstayid") SELECT COUNT(*) FROM "microlab" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "microlab"."patientunitstayid" WHERE "microlab"."culturesite" = 'urine, voided specimen' AND NOT "_u_1"."" IS NULL
0.533203
CREATE TABLE table_54534 ("Res." TEXT, "Record" TEXT, "Opponent" TEXT, "Method" TEXT, "Round" TEXT, "Time" TEXT, "Location" TEXT)
What round has a method of submission?
SELECT "Round" FROM table_54534 WHERE "Method" = 'submission'
SELECT "Round" FROM "table_54534" WHERE "Method" = 'submission'
0.061523
CREATE TABLE roles (role_code TEXT, role_name TEXT, role_description TEXT) CREATE TABLE ref_locations (location_code TEXT, location_name TEXT, location_description TEXT) CREATE TABLE documents_to_be_destroyed (document_id DECIMAL, destruction_authorised_by_employee_id DECIMAL, destroyed_by_employee_id DECIMAL, planned_destruction_date TIME, actual_destruction_date TIME, other_details TEXT) CREATE TABLE ref_calendar (calendar_date TIME, day_number DECIMAL) CREATE TABLE employees (employee_id DECIMAL, role_code TEXT, employee_name TEXT, gender_mfu TEXT, date_of_birth TIME, other_details TEXT) CREATE TABLE all_documents (document_id DECIMAL, date_stored TIME, document_type_code TEXT, document_name TEXT, document_description TEXT, other_details TEXT) CREATE TABLE document_locations (document_id DECIMAL, location_code TEXT, date_in_location_from TIME, date_in_locaton_to TIME) CREATE TABLE ref_document_types (document_type_code TEXT, document_type_name TEXT, document_type_description TEXT)
What are the id of each employee and the number of document destroyed by that employee?
SELECT destroyed_by_employee_id, COUNT(*) FROM documents_to_be_destroyed GROUP BY destroyed_by_employee_id
SELECT "destroyed_by_employee_id", COUNT(*) FROM "documents_to_be_destroyed" GROUP BY "destroyed_by_employee_id"
0.109375
CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Users (Id DECIMAL, Reputation DECIMAL, CreationDate TIME, DisplayName TEXT, LastAccessDate TIME, WebsiteUrl TEXT, Location TEXT, AboutMe TEXT, Views DECIMAL, UpVotes DECIMAL, DownVotes DECIMAL, ProfileImageUrl TEXT, EmailHash TEXT, AccountId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId DECIMAL) CREATE TABLE SuggestedEdits (Id DECIMAL, PostId DECIMAL, CreationDate TIME, ApprovalDate TIME, RejectionDate TIME, OwnerUserId DECIMAL, Comment TEXT, Text TEXT, Title TEXT, Tags TEXT, RevisionGUID other) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) 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 PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT)
My Answers Most Upvoted Without selfie-Answers.
SELECT answers.Id AS "post_link", answers.Score AS pontuacao, answers.OwnerUserId AS "user_link" FROM Posts AS answers INNER JOIN Posts AS all_posts ON all_posts.AcceptedAnswerId = answers.Id WHERE answers.OwnerUserId = @UserId AND answers.PostTypeId = 2 AND answers.ClosedDate IS NULL AND answers.DeletionDate IS NULL AND answers.OwnerUserId != all_posts.OwnerUserId ORDER BY pontuacao DESC
SELECT "answers"."Id" AS "post_link", "answers"."Score" AS "pontuacao", "answers"."OwnerUserId" AS "user_link" FROM "Posts" AS "answers" JOIN "Posts" AS "all_posts" ON "all_posts"."AcceptedAnswerId" = "answers"."Id" AND "all_posts"."OwnerUserId" <> "answers"."OwnerUserId" WHERE "answers"."ClosedDate" IS NULL AND "answers"."DeletionDate" IS NULL AND "answers"."OwnerUserId" = $UserId AND "answers"."PostTypeId" = 2 ORDER BY "pontuacao" DESC NULLS LAST
0.441406
CREATE TABLE Movie (mID INT, title TEXT, year INT, director TEXT) CREATE TABLE Reviewer (rID INT, name TEXT) CREATE TABLE Rating (rID INT, mID INT, stars INT, ratingDate DATE)
Please visualize a bar chart, that the X-axis is the director and the Y-axis is thier corresponding lowest rating among all movies, and I want to list in ascending by the Y-axis.
SELECT director, MIN(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY director ORDER BY MIN(T1.stars)
SELECT "director", MIN("T1"."stars") FROM "Rating" AS "T1" JOIN "Movie" AS "T2" ON "T1"."mID" = "T2"."mID" GROUP BY "director" ORDER BY MIN("T1"."stars") NULLS FIRST
0.161133
CREATE TABLE table_42776 ("Club" TEXT, "Position in 2012" TEXT, "First season in top division" FLOAT, "Number of seasons in Meistriliiga" FLOAT, "First season of current spell in top division" FLOAT, "Top division titles" FLOAT)
How many seasons in Meistriliiga when the club was kuressaare also had a first season in top division of more than 2000?
SELECT COUNT("Number of seasons in Meistriliiga") FROM table_42776 WHERE "Club" = 'kuressaare' AND "First season in top division" > '2000'
SELECT COUNT("Number of seasons in Meistriliiga") FROM "table_42776" WHERE "Club" = 'kuressaare' AND "First season in top division" > '2000'
0.136719
CREATE TABLE table_26535 ("World record" TEXT, "Kenenisa Bekele ( ETH ) " TEXT, "12:37.35" TEXT, "Hengelo , Netherlands" TEXT, "31 May 2004" TEXT)
How many times is kenenisa bekele ( eth ) is mar lson gomes dos santos ( bra )?
SELECT COUNT("World record") FROM table_26535 WHERE "Kenenisa Bekele ( ETH )" = 'Marílson Gomes dos Santos ( BRA )'
SELECT COUNT("World record") FROM "table_26535" WHERE "Kenenisa Bekele ( ETH )" = 'Marílson Gomes dos Santos ( BRA )'
0.114258
CREATE TABLE table_name_87 (date VARCHAR, tournament VARCHAR)
What is Date, when Tournament is Alfred Dunhill Championship 1?
SELECT date FROM table_name_87 WHERE tournament = "alfred dunhill championship 1"
SELECT "date" FROM "table_name_87" WHERE "alfred dunhill championship 1" = "tournament"
0.084961
CREATE TABLE table_34554 ("Team 1" TEXT, "Agg." TEXT, "Team 2" TEXT, "1st leg" TEXT, "2nd leg" TEXT)
What is the 1st leg of Team 2 PSV Eindhoven?
SELECT "1st leg" FROM table_34554 WHERE "Team 2" = 'psv eindhoven'
SELECT "1st leg" FROM "table_34554" WHERE "Team 2" = 'psv eindhoven'
0.066406
CREATE TABLE table_name_61 (year VARCHAR, qual VARCHAR)
The qual of totals took place during what year?
SELECT year FROM table_name_61 WHERE qual = "totals"
SELECT "year" FROM "table_name_61" WHERE "qual" = "totals"
0.056641
CREATE TABLE room (roomnumber DECIMAL, roomtype TEXT, blockfloor DECIMAL, blockcode DECIMAL, unavailable BOOLEAN) CREATE TABLE appointment (appointmentid DECIMAL, patient DECIMAL, prepnurse DECIMAL, physician DECIMAL, start TIME, end TIME, examinationroom TEXT) CREATE TABLE on_call (nurse DECIMAL, blockfloor DECIMAL, blockcode DECIMAL, oncallstart TIME, oncallend TIME) CREATE TABLE department (departmentid DECIMAL, name TEXT, head DECIMAL) CREATE TABLE trained_in (physician DECIMAL, treatment DECIMAL, certificationdate TIME, certificationexpires TIME) CREATE TABLE prescribes (physician DECIMAL, patient DECIMAL, medication DECIMAL, date TIME, appointment DECIMAL, dose TEXT) CREATE TABLE block (blockfloor DECIMAL, blockcode DECIMAL) CREATE TABLE patient (ssn DECIMAL, name TEXT, address TEXT, phone TEXT, insuranceid DECIMAL, pcp DECIMAL) CREATE TABLE medication (code DECIMAL, name TEXT, brand TEXT, description TEXT) CREATE TABLE nurse (employeeid DECIMAL, name TEXT, position TEXT, registered BOOLEAN, ssn DECIMAL) CREATE TABLE physician (employeeid DECIMAL, name TEXT, position TEXT, ssn DECIMAL) CREATE TABLE procedures (code DECIMAL, name TEXT, cost DECIMAL) CREATE TABLE undergoes (patient DECIMAL, procedures DECIMAL, stay DECIMAL, dateundergoes TIME, physician DECIMAL, assistingnurse DECIMAL) CREATE TABLE affiliated_with (physician DECIMAL, department DECIMAL, primaryaffiliation BOOLEAN) CREATE TABLE stay (stayid DECIMAL, patient DECIMAL, room DECIMAL, staystart TIME, stayend TIME)
Find the number of rooms located on each block floor.
SELECT COUNT(*), T1.blockfloor FROM block AS T1 JOIN room AS T2 ON T1.blockfloor = T2.blockfloor AND T1.blockcode = T2.blockcode GROUP BY T1.blockfloor
SELECT COUNT(*), "T1"."blockfloor" FROM "block" AS "T1" JOIN "room" AS "T2" ON "T1"."blockcode" = "T2"."blockcode" AND "T1"."blockfloor" = "T2"."blockfloor" GROUP BY "T1"."blockfloor"
0.178711
CREATE TABLE table_193 ("Round" FLOAT, "Grand Prix" TEXT, "Pole Position" TEXT, "Fastest Lap" TEXT, "Winning Driver" TEXT, "Winning Constructor" TEXT, "Report" TEXT)
What is the report for round 3?
SELECT "Report" FROM table_193 WHERE "Round" = '3'
SELECT "Report" FROM "table_193" WHERE "Round" = '3'
0.050781
CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what are the five most frequently given laboratory tests since 2 years ago for patients who were previously diagnosed with sedated - unresponsive in the same hospital visit?
SELECT t3.labname FROM (SELECT t2.labname, DENSE_RANK() OVER (ORDER BY COUNT(*) DESC) AS c1 FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE diagnosis.diagnosisname = 'sedated - unresponsive' AND DATETIME(diagnosis.diagnosistime) >= DATETIME(CURRENT_TIME(), '-2 year')) AS t1 JOIN (SELECT patient.uniquepid, lab.labname, lab.labresulttime, patient.patienthealthsystemstayid FROM lab JOIN patient ON lab.patientunitstayid = patient.patientunitstayid WHERE DATETIME(lab.labresulttime) >= DATETIME(CURRENT_TIME(), '-2 year')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.labresulttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid GROUP BY t2.labname) AS t3 WHERE t3.c1 <= 5
WITH "t2" AS (SELECT "patient"."uniquepid", "lab"."labname", "lab"."labresulttime", "patient"."patienthealthsystemstayid" FROM "lab" JOIN "patient" ON "lab"."patientunitstayid" = "patient"."patientunitstayid" WHERE DATETIME("lab"."labresulttime") >= DATETIME(CURRENT_TIME(), '-2 year')), "t3" AS (SELECT "t2"."labname", DENSE_RANK() OVER (ORDER BY COUNT(*) DESC NULLS LAST) AS "c1" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."labresulttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'sedated - unresponsive' AND DATETIME("diagnosis"."diagnosistime") >= DATETIME(CURRENT_TIME(), '-2 year') GROUP BY "t2"."labname") SELECT "t3"."labname" FROM "t3" AS "t3" WHERE "t3"."c1" <= 5
0.880859
CREATE TABLE table_12027364_1 (womens_doubles VARCHAR, womens_singles VARCHAR)
Who won the womens doubles when wu jianqui won the womens singles?
SELECT womens_doubles FROM table_12027364_1 WHERE womens_singles = "Wu Jianqui"
SELECT "womens_doubles" FROM "table_12027364_1" WHERE "Wu Jianqui" = "womens_singles"
0.083008
CREATE TABLE table_2679061_2 (pick__number INT, nhl_team VARCHAR, college_junior_club_team VARCHAR)
what is the pick # when the nhl team is montreal canadiens and the college/junior/club team is trois-rivi res draveurs (qmjhl)?
SELECT MIN(pick__number) FROM table_2679061_2 WHERE nhl_team = "Montreal Canadiens" AND college_junior_club_team = "Trois-Rivières Draveurs (QMJHL)"
SELECT MIN("pick__number") FROM "table_2679061_2" WHERE "Montreal Canadiens" = "nhl_team" AND "Trois-Rivières Draveurs (QMJHL)" = "college_junior_club_team"
0.152344
CREATE TABLE table_25214321_1 (contestants INT, runner_up VARCHAR)
How many contestants were there when the runner-up was Monique Evans?
SELECT MAX(contestants) FROM table_25214321_1 WHERE runner_up = "Monique Evans"
SELECT MAX("contestants") FROM "table_25214321_1" WHERE "Monique Evans" = "runner_up"
0.083008
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE 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)
how many patients are admitted under urgent admission type and underwent percu gastrojejunostomy?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN procedures ON demographic.hadm_id = procedures.hadm_id WHERE demographic.admission_type = "URGENT" AND procedures.short_title = "Percu gastrojejunostomy"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "procedures" ON "Percu gastrojejunostomy" = "procedures"."short_title" AND "demographic"."hadm_id" = "procedures"."hadm_id" WHERE "URGENT" = "demographic"."admission_type"
0.239258
CREATE TABLE table_204_593 (id DECIMAL, "year" TEXT, "chairperson" TEXT)
tell me the total number of chairpersons .
SELECT COUNT("chairperson") FROM table_204_593
SELECT COUNT("chairperson") FROM "table_204_593"
0.046875
CREATE TABLE table_name_78 (quantity_made VARCHAR, wheel_arrangement VARCHAR, class VARCHAR)
what is the quantity made when the wheel arrangement is 2-6-0 and the class is k?
SELECT quantity_made FROM table_name_78 WHERE wheel_arrangement = "2-6-0" AND class = "k"
SELECT "quantity_made" FROM "table_name_78" WHERE "2-6-0" = "wheel_arrangement" AND "class" = "k"
0.094727
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 treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime 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 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 cost (costid DECIMAL, uniquepid TEXT, patienthealthsystemstayid DECIMAL, eventtype TEXT, eventid DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
what the last height of patient 002-20631 during a month before.
SELECT patient.admissionheight FROM patient WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '002-20631') AND NOT patient.admissionheight IS NULL AND DATETIME(patient.unitadmittime, 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') ORDER BY patient.unitadmittime DESC LIMIT 1
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '002-20631' GROUP BY "patienthealthsystemstayid") SELECT "patient"."admissionheight" FROM "patient" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" WHERE DATETIME("patient"."unitadmittime", 'start of month') = DATETIME(CURRENT_TIME(), 'start of month', '-1 month') AND NOT "_u_0"."" IS NULL AND NOT "patient"."admissionheight" IS NULL ORDER BY "patient"."unitadmittime" DESC NULLS LAST LIMIT 1
0.518555
CREATE TABLE table_23563 ("English Name" TEXT, "Simplified" TEXT, "Traditional" TEXT, "Pinyin" TEXT, "Foochow" TEXT, "Area" FLOAT, "Population" FLOAT, "Density" FLOAT)
Name the traditional for area 544
SELECT "Traditional" FROM table_23563 WHERE "Area" = '544'
SELECT "Traditional" FROM "table_23563" WHERE "Area" = '544'
0.058594
CREATE TABLE table_name_70 (year VARCHAR, film VARCHAR)
In what Year was the Film Your National Gallery winner?
SELECT year FROM table_name_70 WHERE film = "your national gallery"
SELECT "year" FROM "table_name_70" WHERE "film" = "your national gallery"
0.071289
CREATE TABLE table_name_44 (category VARCHAR, recipient_s_ VARCHAR, award VARCHAR, result VARCHAR, year VARCHAR)
What category was Joe Jonas nominated for at the Kids' Choice Awards Mexico in 2010?
SELECT category FROM table_name_44 WHERE result = "nominated" AND year = 2010 AND award = "kids' choice awards mexico" AND recipient_s_ = "joe jonas"
SELECT "category" FROM "table_name_44" WHERE "award" = "kids' choice awards mexico" AND "joe jonas" = "recipient_s_" AND "nominated" = "result" AND "year" = 2010
0.157227
CREATE TABLE table_50928 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( $ ) " TEXT)
For a country of Spain, place of t6, what is the Money ($)?
SELECT "Money ( $ )" FROM table_50928 WHERE "Place" = 't6' AND "Country" = 'spain'
SELECT "Money ( $ )" FROM "table_50928" WHERE "Country" = 'spain' AND "Place" = 't6'
0.082031
CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE 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)
give me the number of patients whose age is less than 55 and lab test name is immunoglobulin g?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.age < "55" AND lab.label = "Immunoglobulin G"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "lab" ON "Immunoglobulin G" = "lab"."label" AND "demographic"."hadm_id" = "lab"."hadm_id" WHERE "55" > "demographic"."age"
0.191406
CREATE TABLE table_204_736 (id DECIMAL, "party" TEXT, "candidate" TEXT, "votes" DECIMAL)
how many total votes did the independent party have ?
SELECT SUM("votes") FROM table_204_736 WHERE "party" = 'independent'
SELECT SUM("votes") FROM "table_204_736" WHERE "party" = 'independent'
0.068359
CREATE TABLE vocals (songid VARCHAR) CREATE TABLE songs (songid VARCHAR)
How many songs have a lead vocal?
SELECT COUNT(DISTINCT title) FROM vocals AS T1 JOIN songs AS T2 ON T1.songid = T2.songid WHERE TYPE = "lead"
SELECT COUNT(DISTINCT "title") FROM "vocals" AS "T1" JOIN "songs" AS "T2" ON "T1"."songid" = "T2"."songid" WHERE "TYPE" = "lead"
0.125
CREATE TABLE table_11677760_1 (college VARCHAR, school VARCHAR)
what is the college for the player who's school is camden high school?
SELECT college FROM table_11677760_1 WHERE school = "Camden High school"
SELECT "college" FROM "table_11677760_1" WHERE "Camden High school" = "school"
0.076172
CREATE TABLE Statements (Statement_ID INT, Statement_Details VARCHAR) CREATE TABLE Documents (Document_ID INT, Document_Type_Code CHAR, Project_ID INT, Document_Date DATETIME, Document_Name VARCHAR, Document_Description VARCHAR, Other_Details VARCHAR) CREATE TABLE Documents_with_Expenses (Document_ID INT, Budget_Type_Code CHAR, Document_Details VARCHAR) CREATE TABLE Projects (Project_ID INT, Project_Details VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR) CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR) CREATE TABLE Accounts (Account_ID INT, Statement_ID INT, Account_Details VARCHAR)
Show me a bar chart for what is the project id and detail for the project with at least two documents?, and could you display X-axis in descending order?
SELECT T1.Project_Details, T1.Project_ID FROM Projects AS T1 JOIN Documents AS T2 ON T1.Project_ID = T2.Project_ID ORDER BY T1.Project_Details DESC
SELECT "T1"."Project_Details", "T1"."Project_ID" FROM "Projects" AS "T1" JOIN "Documents" AS "T2" ON "T1"."Project_ID" = "T2"."Project_ID" ORDER BY "T1"."Project_Details" DESC NULLS LAST
0.181641
CREATE TABLE table_name_84 (score VARCHAR, visitor VARCHAR)
What was the score of the game where Philadelphia was the visitor?
SELECT score FROM table_name_84 WHERE visitor = "philadelphia"
SELECT "score" FROM "table_name_84" WHERE "philadelphia" = "visitor"
0.066406
CREATE TABLE table_name_88 (driver VARCHAR, laps VARCHAR, grid VARCHAR)
Which driver had a grid of 18 with 68 laps?
SELECT driver FROM table_name_88 WHERE laps = "68" AND grid = "18"
SELECT "driver" FROM "table_name_88" WHERE "18" = "grid" AND "68" = "laps"
0.072266
CREATE TABLE FlagTypes (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 Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE ReviewTaskStates (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 PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE CloseReasonTypes (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 Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId 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 PostTags (PostId DECIMAL, TagId 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 Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL)
Comments containing the given two keywords (case insensitive).
SELECT Id AS "comment_link", Text, UserId AS "user_link", CreationDate FROM Comments WHERE (Text LIKE '%##Word1?student##%' COLLATE Latin1_General_CI_AI) AND (Text LIKE '%##Word2?homework##%' COLLATE Latin1_General_CI_AI) ORDER BY CreationDate
SELECT "Id" AS "comment_link", "Text", "UserId" AS "user_link", "CreationDate" FROM "Comments" WHERE "Text" LIKE COLLATE('%##Word1?student##%', "Latin1_General_CI_AI") AND "Text" LIKE COLLATE('%##Word2?homework##%', "Latin1_General_CI_AI") ORDER BY "CreationDate" NULLS FIRST
0.268555
CREATE TABLE table_34590 ("Position" FLOAT, "Team" TEXT, "Points" FLOAT, "Played" FLOAT, "Drawn" FLOAT, "Lost" FLOAT, "Against" FLOAT, "Difference" TEXT)
Which average's against score has 2 as a difference and a lost of 5?
SELECT AVG("Against") FROM table_34590 WHERE "Difference" = '2' AND "Lost" = '5'
SELECT AVG("Against") FROM "table_34590" WHERE "Difference" = '2' AND "Lost" = '5'
0.080078
CREATE TABLE table_68222 ("Name" TEXT, "Entered office" TEXT, "Left office" TEXT, "Party" TEXT, "First Minister" TEXT)
What is the name of the minister who has an entered office of entered office?
SELECT "Name" FROM table_68222 WHERE "Entered office" = 'entered office'
SELECT "Name" FROM "table_68222" WHERE "Entered office" = 'entered office'
0.072266
CREATE TABLE table_name_61 (city_of_license__market VARCHAR, station VARCHAR)
What is the city containing the KDKA-TV station?
SELECT city_of_license__market FROM table_name_61 WHERE station = "kdka-tv"
SELECT "city_of_license__market" FROM "table_name_61" WHERE "kdka-tv" = "station"
0.079102
CREATE TABLE table_204_676 (id DECIMAL, "year" DECIMAL, "division" DECIMAL, "league" TEXT, "regular season" TEXT, "playoffs" TEXT, "open cup" TEXT)
tell me the number of times they qualified for the playoffs .
SELECT COUNT(*) FROM table_204_676 WHERE "playoffs" <> 'did not qualify'
SELECT COUNT(*) FROM "table_204_676" WHERE "playoffs" <> 'did not qualify'
0.072266
CREATE TABLE table_80169 ("Representative" TEXT, "Years" TEXT, "State" TEXT, "Party" TEXT, "Lifespan" TEXT)
What is the lifespan of Joseph Vance, a democratic-republican from Ohio?
SELECT "Lifespan" FROM table_80169 WHERE "State" = 'ohio' AND "Representative" = 'joseph vance' AND "Party" = 'democratic-republican'
SELECT "Lifespan" FROM "table_80169" WHERE "Party" = 'democratic-republican' AND "Representative" = 'joseph vance' AND "State" = 'ohio'
0.131836
CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE lab (labid DECIMAL, patientunitstayid DECIMAL, labname TEXT, labresult DECIMAL, labresulttime TIME) CREATE TABLE 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 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 vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME)
tell me the method of intake of pantoprazole 40 mg intravenous solution?
SELECT DISTINCT medication.routeadmin FROM medication WHERE medication.drugname = 'pantoprazole 40 mg intravenous solution'
SELECT DISTINCT "medication"."routeadmin" FROM "medication" WHERE "medication"."drugname" = 'pantoprazole 40 mg intravenous solution'
0.129883
CREATE TABLE table_name_99 (attendance INT, venue VARCHAR, result VARCHAR)
what was the attendance at the home venue with result w 3-1?
SELECT MAX(attendance) FROM table_name_99 WHERE venue = "home" AND result = "w 3-1"
SELECT MAX("attendance") FROM "table_name_99" WHERE "home" = "venue" AND "result" = "w 3-1"
0.088867
CREATE TABLE table_name_5 (tournament VARCHAR)
What tournament was at the 2011 Cincinnati Masters?
SELECT 2011 FROM table_name_5 WHERE tournament = "cincinnati masters"
SELECT 2011 FROM "table_name_5" WHERE "cincinnati masters" = "tournament"
0.071289
CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE 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)
calculate the maximum duration of hospital stay of the patients who had ruq pain as primary disease
SELECT MAX(demographic.days_stay) FROM demographic WHERE demographic.diagnosis = "RUQ PAIN"
SELECT MAX("demographic"."days_stay") FROM "demographic" WHERE "RUQ PAIN" = "demographic"."diagnosis"
0.098633
CREATE TABLE table_73013 ("Year" FLOAT, "Illinois" TEXT, "Indiana" TEXT, "Kentucky" TEXT, "Michigan" TEXT, "Ohio" TEXT, "Wisconsin" TEXT)
What was the little league team from Kentucky when the little league team from Indiana and Wisconsin were Brownsburg LL Brownsburg and Merrill LL Merrill?
SELECT "Kentucky" FROM table_73013 WHERE "Indiana" = 'Brownsburg LL Brownsburg' AND "Wisconsin" = 'Merrill LL Merrill'
SELECT "Kentucky" FROM "table_73013" WHERE "Indiana" = 'Brownsburg LL Brownsburg' AND "Wisconsin" = 'Merrill LL Merrill'
0.117188
CREATE TABLE table_18904831_7 (score VARCHAR, record VARCHAR)
What was the score in the game that had a record of 25-8?
SELECT score FROM table_18904831_7 WHERE record = "25-8"
SELECT "score" FROM "table_18904831_7" WHERE "25-8" = "record"
0.060547
CREATE TABLE table_name_48 (years VARCHAR, name VARCHAR)
Name the years for dannevirke south school
SELECT years FROM table_name_48 WHERE name = "dannevirke south school"
SELECT "years" FROM "table_name_48" WHERE "dannevirke south school" = "name"
0.074219
CREATE TABLE table_name_85 (event VARCHAR, time VARCHAR)
What is the Event with a Time that is 3:06?
SELECT event FROM table_name_85 WHERE time = "3:06"
SELECT "event" FROM "table_name_85" WHERE "3:06" = "time"
0.055664
CREATE TABLE Projects (Project_ID INT, Project_Details VARCHAR) CREATE TABLE Accounts (Account_ID INT, Statement_ID INT, Account_Details VARCHAR) CREATE TABLE Documents (Document_ID INT, Document_Type_Code CHAR, Project_ID INT, Document_Date DATETIME, Document_Name VARCHAR, Document_Description VARCHAR, Other_Details VARCHAR) CREATE TABLE Documents_with_Expenses (Document_ID INT, Budget_Type_Code CHAR, Document_Details VARCHAR) CREATE TABLE Statements (Statement_ID INT, Statement_Details VARCHAR) CREATE TABLE Ref_Budget_Codes (Budget_Type_Code CHAR, Budget_Type_Description VARCHAR) CREATE TABLE Ref_Document_Types (Document_Type_Code CHAR, Document_Type_Name VARCHAR, Document_Type_Description VARCHAR)
Show the number of documents created in each day and bin document date by year interval and group by document type description with a group line chart, and order by the x axis from low to high.
SELECT Document_Date, COUNT(Document_Date) FROM Ref_Document_Types AS T1 JOIN Documents AS T2 ON T1.Document_Type_Code = T2.Document_Type_Code GROUP BY Document_Type_Description ORDER BY Document_Date
SELECT "Document_Date", COUNT("Document_Date") FROM "Ref_Document_Types" AS "T1" JOIN "Documents" AS "T2" ON "T1"."Document_Type_Code" = "T2"."Document_Type_Code" GROUP BY "Document_Type_Description" ORDER BY "Document_Date" NULLS FIRST
0.230469
CREATE TABLE table_33276 ("Club" TEXT, "Played" FLOAT, "Lost" FLOAT, "Drawn" FLOAT, "Against" FLOAT, "Diff." FLOAT, "Points" FLOAT)
What is the total difference for teams that played less than 6 games?
SELECT SUM("Diff.") FROM table_33276 WHERE "Played" < '6'
SELECT SUM("Diff.") FROM "table_33276" WHERE "Played" < '6'
0.057617
CREATE TABLE table_23123 ("Pick #" FLOAT, "Player" TEXT, "Position" TEXT, "Nationality" TEXT, "NHL team" TEXT, "College/junior/club team" TEXT)
Name the nhl times for jeff jacques
SELECT "NHL team" FROM table_23123 WHERE "Player" = 'Jeff Jacques'
SELECT "NHL team" FROM "table_23123" WHERE "Player" = 'Jeff Jacques'
0.066406
CREATE TABLE table_name_24 (make VARCHAR, drivers VARCHAR)
What is the make of the vehicle for driver Hisashi Wada?
SELECT make FROM table_name_24 WHERE drivers = "hisashi wada"
SELECT "make" FROM "table_name_24" WHERE "drivers" = "hisashi wada"
0.06543
CREATE TABLE table_28563 ("Finished" TEXT, "Performance Order" FLOAT, "Percentage of votes" TEXT, "Artist" TEXT, "Act" TEXT, "Semi Finals Result" TEXT)
Name the performance order of the velasco brothers
SELECT "Performance Order" FROM table_28563 WHERE "Artist" = 'Velasco Brothers'
SELECT "Performance Order" FROM "table_28563" WHERE "Artist" = 'Velasco Brothers'
0.079102
CREATE TABLE table_30120566_1 (barony VARCHAR, townland VARCHAR)
What barony is Ballycunningham in?
SELECT barony FROM table_30120566_1 WHERE townland = "Ballycunningham"
SELECT "barony" FROM "table_30120566_1" WHERE "Ballycunningham" = "townland"
0.074219
CREATE TABLE Staff (staff_id INT, gender VARCHAR, first_name VARCHAR, last_name VARCHAR, email_address VARCHAR, phone_number VARCHAR) CREATE TABLE Products (product_id INT, parent_product_id INT, product_category_code VARCHAR, date_product_first_available DATETIME, date_product_discontinued DATETIME, product_name VARCHAR, product_description VARCHAR, product_price DECIMAL) CREATE TABLE Customers (customer_id INT, customer_type_code VARCHAR, address_line_1 VARCHAR, address_line_2 VARCHAR, town_city VARCHAR, state VARCHAR, email_address VARCHAR, phone_number VARCHAR) CREATE TABLE Complaints (complaint_id INT, product_id INT, customer_id INT, complaint_outcome_code VARCHAR, complaint_status_code VARCHAR, complaint_type_code VARCHAR, date_complaint_raised DATETIME, date_complaint_closed DATETIME, staff_id INT)
What are all the different product names, and how many complains has each received Show bar chart, sort by the X-axis from low to high please.
SELECT product_name, COUNT(*) FROM Products AS t1 JOIN Complaints AS t2 ON t1.product_id = t2.product_id GROUP BY t1.product_name ORDER BY product_name
SELECT "product_name", COUNT(*) FROM "Products" AS "t1" JOIN "Complaints" AS "t2" ON "t1"."product_id" = "t2"."product_id" GROUP BY "t1"."product_name" ORDER BY "product_name" NULLS FIRST
0.182617
CREATE TABLE table_name_98 (high_points VARCHAR, team VARCHAR)
Who had the high points in the game @ Charlotte?
SELECT high_points FROM table_name_98 WHERE team = "@ charlotte"
SELECT "high_points" FROM "table_name_98" WHERE "@ charlotte" = "team"
0.068359
CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE time_zone (time_zone_code TEXT, time_zone_name TEXT, hours_from_gmt INT) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE fare_basis (fare_basis_code TEXT, booking_class TEXT, class_type TEXT, premium TEXT, economy TEXT, discounted TEXT, night TEXT, season TEXT, basis_days TEXT) CREATE TABLE 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 time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE flight_fare (flight_id INT, fare_id INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE flight (aircraft_code_sequence TEXT, airline_code VARCHAR, airline_flight TEXT, arrival_time INT, connections INT, departure_time INT, dual_carrier TEXT, flight_days TEXT, flight_id INT, flight_number INT, from_airport VARCHAR, meal_code TEXT, stops INT, time_elapsed INT, to_airport VARCHAR) CREATE TABLE 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 code_description (code VARCHAR, description TEXT) 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) 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 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)
i want a flight from CINCINNATI to BURBANK on AA and leave in the afternoon
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (((flight.departure_time <= 1200 AND flight.departure_time >= 1800) AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'CINCINNATI' AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BURBANK' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code) AND flight.airline_code = 'AA'
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'BURBANK' JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "flight"."airline_code" = 'AA' AND "flight"."departure_time" <= 1200 AND "flight"."departure_time" >= 1800 JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'CINCINNATI'
0.605469
CREATE TABLE table_test_15 ("id" INT, "anemia" BOOLEAN, "cell_therapy" BOOLEAN, "hiv_infection" BOOLEAN, "hemoglobin_a1c_hba1c" FLOAT, "body_weight" FLOAT, "renal_disease" BOOLEAN, "creatinine_clearance_cl" FLOAT, "active_hepatitis" BOOLEAN, "chronic_inflammatory_disease" BOOLEAN, "platelet_count" FLOAT, "NOUSE" FLOAT)
chronic inflammatory disease
SELECT * FROM table_test_15 WHERE chronic_inflammatory_disease = 1
SELECT * FROM "table_test_15" WHERE "chronic_inflammatory_disease" = 1
0.068359
CREATE TABLE table_10026563_1 (ended_time_as_senior_g8_leader VARCHAR, person VARCHAR)
When did Jacques Chirac stop being a G8 leader?
SELECT ended_time_as_senior_g8_leader FROM table_10026563_1 WHERE person = "Jacques Chirac"
SELECT "ended_time_as_senior_g8_leader" FROM "table_10026563_1" WHERE "Jacques Chirac" = "person"
0.094727
CREATE TABLE table_1813 ("No. in series" FLOAT, "No. in season" FLOAT, "Title" TEXT, "Directed by" TEXT, "Written by" TEXT, "Original air date" TEXT, "U.S. viewers ( millions ) " TEXT)
How many millions of U.S. viewers watched the episode directed by Allison Liddi-Brown?
SELECT "U.S. viewers (millions)" FROM table_1813 WHERE "Directed by" = 'Allison Liddi-Brown'
SELECT "U.S. viewers (millions)" FROM "table_1813" WHERE "Directed by" = 'Allison Liddi-Brown'
0.091797
CREATE TABLE table_name_75 (date VARCHAR, home_team VARCHAR)
What date did Collingwood play as the home team?
SELECT date FROM table_name_75 WHERE home_team = "collingwood"
SELECT "date" FROM "table_name_75" WHERE "collingwood" = "home_team"
0.066406
CREATE TABLE table_63612 ("Place" TEXT, "Player" TEXT, "Country" TEXT, "Score" TEXT, "To par" TEXT, "Money ( \\u00a3 ) " TEXT)
Which Score has a To par of +1 in sweden?
SELECT "Score" FROM table_63612 WHERE "To par" = '+1' AND "Country" = 'sweden'
SELECT "Score" FROM "table_63612" WHERE "Country" = 'sweden' AND "To par" = '+1'
0.078125
CREATE TABLE date_day (month_number INT, day_number INT, year INT, day_name VARCHAR) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE 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 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 (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 state (state_code TEXT, state_name TEXT, country_name TEXT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE city (city_code VARCHAR, city_name VARCHAR, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare 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_fare (flight_id INT, fare_id INT) CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE compartment_class (compartment VARCHAR, class_type VARCHAR) CREATE TABLE code_description (code VARCHAR, description TEXT) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant INT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT)
what 's the earliest flight from PHOENIX to SALT LAKE CITY
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, flight WHERE (CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'PHOENIX' AND CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'SALT LAKE CITY' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND flight.departure_time = (SELECT MIN(FLIGHTalias1.departure_time) FROM airport_service AS AIRPORT_SERVICEalias2, airport_service AS AIRPORT_SERVICEalias3, city AS CITYalias2, city AS CITYalias3, flight AS FLIGHTalias1 WHERE CITYalias2.city_code = AIRPORT_SERVICEalias2.city_code AND CITYalias2.city_name = 'PHOENIX' AND CITYalias3.city_code = AIRPORT_SERVICEalias3.city_code AND CITYalias3.city_name = 'SALT LAKE CITY' AND FLIGHTalias1.from_airport = AIRPORT_SERVICEalias2.airport_code AND FLIGHTalias1.to_airport = AIRPORT_SERVICEalias3.airport_code)
WITH "_u_0" AS (SELECT MIN("FLIGHTalias1"."departure_time") FROM "airport_service" AS "AIRPORT_SERVICEalias2" JOIN "city" AS "CITYalias2" ON "AIRPORT_SERVICEalias2"."city_code" = "CITYalias2"."city_code" AND "CITYalias2"."city_name" = 'PHOENIX' 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 "city" AS "CITYalias3" ON "AIRPORT_SERVICEalias3"."city_code" = "CITYalias3"."city_code" AND "CITYalias3"."city_name" = 'SALT LAKE CITY') SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'PHOENIX' 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 "_u_0" AS "_u_0" ON "_u_0"."" = "flight"."departure_time" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'SALT LAKE CITY'
1.164063
CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE admissions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, admittime TIME, dischtime TIME, admission_type TEXT, admission_location TEXT, discharge_location TEXT, insurance TEXT, language TEXT, marital_status TEXT, ethnicity TEXT, age DECIMAL) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE icustays (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, first_careunit TEXT, last_careunit TEXT, first_wardid DECIMAL, last_wardid DECIMAL, intime TIME, outtime TIME) CREATE TABLE diagnoses_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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto 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 transfers (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, eventtype TEXT, careunit TEXT, wardid DECIMAL, intime TIME, outtime TIME)
when was the last time that patient 19981 was given a hemoglobin lab test in 02/last year?
SELECT labevents.charttime FROM labevents WHERE labevents.itemid IN (SELECT d_labitems.itemid FROM d_labitems WHERE d_labitems.label = 'hemoglobin') AND labevents.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 19981) AND DATETIME(labevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', labevents.charttime) = '02' ORDER BY labevents.charttime DESC LIMIT 1
WITH "_u_0" AS (SELECT "d_labitems"."itemid" FROM "d_labitems" WHERE "d_labitems"."label" = 'hemoglobin' GROUP BY "itemid"), "_u_1" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 19981 GROUP BY "hadm_id") SELECT "labevents"."charttime" FROM "labevents" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "labevents"."itemid" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "labevents"."hadm_id" WHERE DATETIME("labevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_0"."" IS NULL AND NOT "_u_1"."" IS NULL AND STRFTIME('%m', "labevents"."charttime") = '02' ORDER BY "labevents"."charttime" DESC NULLS LAST LIMIT 1
0.673828
CREATE TABLE intakeoutput (intakeoutputid DECIMAL, patientunitstayid DECIMAL, cellpath TEXT, celllabel TEXT, cellvaluenumeric DECIMAL, intakeoutputtime TIME) CREATE TABLE diagnosis (diagnosisid DECIMAL, patientunitstayid DECIMAL, diagnosisname TEXT, diagnosistime TIME, icd9code TEXT) CREATE TABLE allergy (allergyid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, allergyname TEXT, allergytime TIME) CREATE TABLE vitalperiodic (vitalperiodicid DECIMAL, patientunitstayid DECIMAL, temperature DECIMAL, sao2 DECIMAL, heartrate DECIMAL, respiration DECIMAL, systemicsystolic DECIMAL, systemicdiastolic DECIMAL, systemicmean DECIMAL, observationtime TIME) CREATE TABLE cost (costid DECIMAL, uniquepid 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 microlab (microlabid DECIMAL, patientunitstayid DECIMAL, culturesite TEXT, organism TEXT, culturetakentime TIME) CREATE TABLE medication (medicationid DECIMAL, patientunitstayid DECIMAL, drugname TEXT, dosage TEXT, routeadmin TEXT, drugstarttime TIME, drugstoptime TIME) CREATE TABLE treatment (treatmentid DECIMAL, patientunitstayid DECIMAL, treatmentname TEXT, treatmenttime TIME) CREATE TABLE patient (uniquepid TEXT, patienthealthsystemstayid DECIMAL, patientunitstayid DECIMAL, gender TEXT, age TEXT, ethnicity TEXT, hospitalid DECIMAL, wardid DECIMAL, admissionheight DECIMAL, admissionweight DECIMAL, dischargeweight DECIMAL, hospitaladmittime TIME, hospitaladmitsource TEXT, unitadmittime TIME, unitdischargetime TIME, hospitaldischargetime TIME, hospitaldischargestatus TEXT)
what is the name of a drug that patient 033-17325 was prescribed for in the same hospital visit after being diagnosed with valve replacement < 7days - mitral?
SELECT t2.drugname FROM (SELECT patient.uniquepid, diagnosis.diagnosistime, patient.patienthealthsystemstayid FROM diagnosis JOIN patient ON diagnosis.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-17325') AND diagnosis.diagnosisname = 'valve replacement < 7days - mitral') AS t1 JOIN (SELECT patient.uniquepid, medication.drugname, medication.drugstarttime, patient.patienthealthsystemstayid FROM medication JOIN patient ON medication.patientunitstayid = patient.patientunitstayid WHERE patient.patienthealthsystemstayid IN (SELECT patient.patienthealthsystemstayid FROM patient WHERE patient.uniquepid = '033-17325')) AS t2 ON t1.uniquepid = t2.uniquepid WHERE t1.diagnosistime < t2.drugstarttime AND t1.patienthealthsystemstayid = t2.patienthealthsystemstayid
WITH "_u_0" AS (SELECT "patient"."patienthealthsystemstayid" FROM "patient" WHERE "patient"."uniquepid" = '033-17325' GROUP BY "patienthealthsystemstayid"), "t2" AS (SELECT "patient"."uniquepid", "medication"."drugname", "medication"."drugstarttime", "patient"."patienthealthsystemstayid" FROM "medication" JOIN "patient" ON "medication"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_1" ON "_u_1"."" = "patient"."patienthealthsystemstayid" WHERE NOT "_u_1"."" IS NULL) SELECT "t2"."drugname" FROM "diagnosis" JOIN "patient" ON "diagnosis"."patientunitstayid" = "patient"."patientunitstayid" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "patient"."patienthealthsystemstayid" JOIN "t2" AS "t2" ON "diagnosis"."diagnosistime" < "t2"."drugstarttime" AND "patient"."patienthealthsystemstayid" = "t2"."patienthealthsystemstayid" AND "patient"."uniquepid" = "t2"."uniquepid" WHERE "diagnosis"."diagnosisname" = 'valve replacement < 7days - mitral' AND NOT "_u_0"."" IS NULL
0.969727
CREATE TABLE table_29705 ("School" TEXT, "Location" TEXT, "Mascot" TEXT, "Colors" TEXT, "Enrollment" FLOAT, "IHSA Classes 2/3/4" TEXT, "IHSA Music Class" TEXT, "IHSA Football Class" TEXT, "IHSA Cheerleading Class" TEXT)
What is the IHSA music class for the mascot that is the lancers?
SELECT "IHSA Music Class" FROM table_29705 WHERE "Mascot" = 'Lancers'
SELECT "IHSA Music Class" FROM "table_29705" WHERE "Mascot" = 'Lancers'
0.069336
CREATE TABLE month (month_number INT, month_name TEXT) CREATE TABLE dual_carrier (main_airline VARCHAR, low_flight_number INT, high_flight_number INT, dual_airline VARCHAR, service_name TEXT) CREATE TABLE days (days_code VARCHAR, day_name VARCHAR) CREATE TABLE airport_service (city_code VARCHAR, airport_code VARCHAR, miles_distant INT, direction VARCHAR, minutes_distant 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 class_of_service (booking_class VARCHAR, rank INT, class_description TEXT) CREATE TABLE restriction (restriction_code TEXT, advance_purchase INT, stopovers TEXT, saturday_stay_required TEXT, minimum_stay INT, maximum_stay INT, application TEXT, no_discounts TEXT) CREATE TABLE time_interval (period TEXT, begin_time INT, end_time INT) CREATE TABLE fare (fare_id INT, from_airport VARCHAR, to_airport VARCHAR, fare_basis_code TEXT, fare_airline TEXT, restriction_code TEXT, one_direction_cost INT, round_trip_cost INT, round_trip_required VARCHAR) CREATE TABLE airport (airport_code VARCHAR, airport_name TEXT, airport_location TEXT, state_code VARCHAR, country_name VARCHAR, time_zone_code VARCHAR, minimum_connect_time INT) CREATE TABLE flight_stop (flight_id INT, stop_number INT, stop_days TEXT, stop_airport TEXT, arrival_time INT, arrival_airline TEXT, arrival_flight_number INT, departure_time INT, departure_airline TEXT, departure_flight_number INT, stop_time INT) CREATE TABLE flight_leg (flight_id INT, leg_number INT, leg_flight INT) CREATE TABLE airline (airline_code VARCHAR, airline_name TEXT, note TEXT) CREATE TABLE food_service (meal_code TEXT, meal_number INT, compartment TEXT, meal_description VARCHAR) CREATE TABLE equipment_sequence (aircraft_code_sequence VARCHAR, aircraft_code VARCHAR) CREATE TABLE ground_service (city_code TEXT, airport_code TEXT, transport_type TEXT, ground_fare INT) CREATE TABLE aircraft (aircraft_code VARCHAR, aircraft_description VARCHAR, manufacturer VARCHAR, basic_type VARCHAR, engines INT, propulsion VARCHAR, wide_body VARCHAR, wing_span INT, length INT, weight INT, capacity INT, pay_load INT, cruising_speed INT, range_miles INT, pressurized VARCHAR) CREATE TABLE 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 code_description (code VARCHAR, description 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 compartment_class (compartment VARCHAR, class_type 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 date_day (month_number INT, day_number INT, year INT, day_name VARCHAR)
requesting flight information for flight from BOSTON to BALTIMORE on tuesday
SELECT DISTINCT flight.flight_id FROM airport_service AS AIRPORT_SERVICE_0, airport_service AS AIRPORT_SERVICE_1, city AS CITY_0, city AS CITY_1, date_day, days, flight WHERE (CITY_1.city_code = AIRPORT_SERVICE_1.city_code AND CITY_1.city_name = 'BALTIMORE' AND date_day.day_number = 22 AND date_day.month_number = 3 AND date_day.year = 1991 AND days.day_name = date_day.day_name AND flight.flight_days = days.days_code AND flight.to_airport = AIRPORT_SERVICE_1.airport_code) AND CITY_0.city_code = AIRPORT_SERVICE_0.city_code AND CITY_0.city_name = 'BOSTON' AND flight.from_airport = AIRPORT_SERVICE_0.airport_code
SELECT DISTINCT "flight"."flight_id" FROM "airport_service" AS "AIRPORT_SERVICE_0" JOIN "date_day" ON "date_day"."day_number" = 22 AND "date_day"."month_number" = 3 AND "date_day"."year" = 1991 JOIN "city" AS "CITY_0" ON "AIRPORT_SERVICE_0"."city_code" = "CITY_0"."city_code" AND "CITY_0"."city_name" = 'BOSTON' JOIN "days" ON "date_day"."day_name" = "days"."day_name" JOIN "flight" ON "AIRPORT_SERVICE_0"."airport_code" = "flight"."from_airport" AND "days"."days_code" = "flight"."flight_days" JOIN "airport_service" AS "AIRPORT_SERVICE_1" ON "AIRPORT_SERVICE_1"."airport_code" = "flight"."to_airport" JOIN "city" AS "CITY_1" ON "AIRPORT_SERVICE_1"."city_code" = "CITY_1"."city_code" AND "CITY_1"."city_name" = 'BALTIMORE'
0.706055
CREATE TABLE EMPLOYEE (EMP_NUM INT, EMP_LNAME VARCHAR, EMP_FNAME VARCHAR, EMP_INITIAL VARCHAR, EMP_JOBCODE VARCHAR, EMP_HIREDATE DATETIME, EMP_DOB DATETIME) CREATE TABLE CLASS (CLASS_CODE VARCHAR, CRS_CODE VARCHAR, CLASS_SECTION VARCHAR, CLASS_TIME VARCHAR, CLASS_ROOM VARCHAR, PROF_NUM INT) CREATE TABLE STUDENT (STU_NUM INT, STU_LNAME VARCHAR, STU_FNAME VARCHAR, STU_INIT VARCHAR, STU_DOB DATETIME, STU_HRS INT, STU_CLASS VARCHAR, STU_GPA FLOAT, STU_TRANSFER DECIMAL, DEPT_CODE VARCHAR, STU_PHONE VARCHAR, PROF_NUM INT) CREATE TABLE COURSE (CRS_CODE VARCHAR, DEPT_CODE VARCHAR, CRS_DESCRIPTION VARCHAR, CRS_CREDIT FLOAT) CREATE TABLE PROFESSOR (EMP_NUM INT, DEPT_CODE VARCHAR, PROF_OFFICE VARCHAR, PROF_EXTENSION VARCHAR, PROF_HIGH_DEGREE VARCHAR) CREATE TABLE DEPARTMENT (DEPT_CODE VARCHAR, DEPT_NAME VARCHAR, SCHOOL_CODE VARCHAR, EMP_NUM INT, DEPT_ADDRESS VARCHAR, DEPT_EXTENSION VARCHAR) CREATE TABLE ENROLL (CLASS_CODE VARCHAR, STU_NUM INT, ENROLL_GRADE VARCHAR)
Bar chart x axis dept code y axis minimal stu gpa, display from low to high by the X.
SELECT DEPT_CODE, MIN(STU_GPA) FROM STUDENT GROUP BY DEPT_CODE ORDER BY DEPT_CODE
SELECT "DEPT_CODE", MIN("STU_GPA") FROM "STUDENT" GROUP BY "DEPT_CODE" ORDER BY "DEPT_CODE" NULLS FIRST
0.100586
CREATE TABLE table_28274 ("Sr. No." FLOAT, "Name of Road" TEXT, "Passes Through - District ( s" TEXT, "Length ( in km ) " TEXT, "MDR No." FLOAT)
What is the Sr. number of Banikhet Dalhouse Khajiar?
SELECT MAX("Sr. No.") FROM table_28274 WHERE "Name of Road" = 'Banikhet Dalhouse Khajiar'
SELECT MAX("Sr. No.") FROM "table_28274" WHERE "Name of Road" = 'Banikhet Dalhouse Khajiar'
0.088867
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 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 chartevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom 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 microbiologyevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, charttime TIME, spec_type_desc TEXT, org_name TEXT) CREATE TABLE d_icd_diagnoses (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME) CREATE TABLE outputevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, value DECIMAL) CREATE TABLE d_items (row_id DECIMAL, itemid DECIMAL, label TEXT, linksto TEXT) CREATE TABLE patients (row_id DECIMAL, subject_id DECIMAL, gender TEXT, dob TIME, dod TIME) CREATE TABLE inputevents_cv (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icustay_id DECIMAL, charttime TIME, itemid DECIMAL, amount DECIMAL) CREATE TABLE d_icd_procedures (row_id DECIMAL, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE prescriptions (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, startdate TIME, enddate TIME, drug TEXT, dose_val_rx TEXT, dose_unit_rx TEXT, route TEXT) CREATE TABLE labevents (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, itemid DECIMAL, charttime TIME, valuenum DECIMAL, valueuom TEXT) CREATE TABLE cost (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, event_type TEXT, event_id DECIMAL, chargetime TIME, cost DECIMAL) CREATE TABLE d_labitems (row_id DECIMAL, itemid DECIMAL, label TEXT) CREATE TABLE diagnoses_icd (row_id DECIMAL, subject_id DECIMAL, hadm_id DECIMAL, icd9_code TEXT, charttime TIME)
has the respiratory rate of patient 5849 in 07/last year ever been less than 20.0?
SELECT COUNT(*) > 0 FROM chartevents WHERE chartevents.icustay_id IN (SELECT icustays.icustay_id FROM icustays WHERE icustays.hadm_id IN (SELECT admissions.hadm_id FROM admissions WHERE admissions.subject_id = 5849)) AND chartevents.itemid IN (SELECT d_items.itemid FROM d_items WHERE d_items.label = 'respiratory rate' AND d_items.linksto = 'chartevents') AND chartevents.valuenum < 20.0 AND DATETIME(chartevents.charttime, 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND STRFTIME('%m', chartevents.charttime) = '07'
WITH "_u_0" AS (SELECT "admissions"."hadm_id" FROM "admissions" WHERE "admissions"."subject_id" = 5849 GROUP BY "hadm_id"), "_u_1" AS (SELECT "icustays"."icustay_id" FROM "icustays" LEFT JOIN "_u_0" AS "_u_0" ON "_u_0"."" = "icustays"."hadm_id" WHERE NOT "_u_0"."" IS NULL GROUP BY "icustay_id"), "_u_2" AS (SELECT "d_items"."itemid" FROM "d_items" WHERE "d_items"."label" = 'respiratory rate' AND "d_items"."linksto" = 'chartevents' GROUP BY "itemid") SELECT COUNT(*) > 0 FROM "chartevents" LEFT JOIN "_u_1" AS "_u_1" ON "_u_1"."" = "chartevents"."icustay_id" LEFT JOIN "_u_2" AS "_u_2" ON "_u_2"."" = "chartevents"."itemid" WHERE "chartevents"."valuenum" < 20.0 AND DATETIME("chartevents"."charttime", 'start of year') = DATETIME(CURRENT_TIME(), 'start of year', '-1 year') AND NOT "_u_1"."" IS NULL AND NOT "_u_2"."" IS NULL AND STRFTIME('%m', "chartevents"."charttime") = '07'
0.859375
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 lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
calculate the average age of patients born after 2080 who had emergency hospital admission.
SELECT AVG(demographic.age) FROM demographic WHERE demographic.admission_type = "EMERGENCY" AND demographic.dob_year > "2080"
SELECT AVG("demographic"."age") FROM "demographic" WHERE "2080" < "demographic"."dob_year" AND "EMERGENCY" = "demographic"."admission_type"
0.135742
CREATE TABLE PostHistoryTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL) CREATE TABLE PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE 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 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 ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewTaskStates (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE ReviewRejectionReasons (Id DECIMAL, Name TEXT, Description TEXT, PostTypeId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostHistory (Id DECIMAL, PostHistoryTypeId DECIMAL, PostId DECIMAL, RevisionGUID other, CreationDate TIME, UserId DECIMAL, UserDisplayName TEXT, Comment TEXT, Text TEXT, ContentLicense TEXT) CREATE TABLE 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 VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE Posts (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) 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 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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) 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 PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN)
Top 10 developers from Morgantown, WV.
SELECT * FROM Users ORDER BY Reputation DESC LIMIT 10
SELECT * FROM "Users" ORDER BY "Reputation" DESC NULLS LAST LIMIT 10
0.066406
CREATE TABLE reviewer (rid DECIMAL, name TEXT) CREATE TABLE rating (rid DECIMAL, mid DECIMAL, stars DECIMAL, ratingdate TIME) CREATE TABLE movie (mid DECIMAL, title TEXT, year DECIMAL, director TEXT)
How many movie reviews does each director get?
SELECT COUNT(*), T1.director FROM movie AS T1 JOIN rating AS T2 ON T1.mid = T2.mid GROUP BY T1.director
SELECT COUNT(*), "T1"."director" FROM "movie" AS "T1" JOIN "rating" AS "T2" ON "T1"."mid" = "T2"."mid" GROUP BY "T1"."director"
0.124023
CREATE TABLE Allergy_type (Allergy VARCHAR, AllergyType VARCHAR) CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR) CREATE TABLE Has_allergy (Allergy VARCHAR, StuID VARCHAR)
What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies.
SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy
SELECT "T1"."Allergy", "T1"."AllergyType" FROM "Allergy_type" AS "T1" JOIN "Has_allergy" AS "T2" ON "T1"."Allergy" = "T2"."Allergy" JOIN "Student" AS "T3" ON "Lisa" = "T3"."Fname" AND "T2"."StuID" = "T3"."StuID" ORDER BY "T1"."Allergy" NULLS FIRST
0.241211
CREATE TABLE table_name_95 (country VARCHAR, television_service VARCHAR)
What is the name of the country when the television service is italia 1?
SELECT country FROM table_name_95 WHERE television_service = "italia 1"
SELECT "country" FROM "table_name_95" WHERE "italia 1" = "television_service"
0.075195
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 event (ID INT, Name TEXT, Stadium_ID INT, Year 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)
Show me about the distribution of Nationality and the sum of ID , and group by attribute Nationality in a bar chart, order by the X from high to low.
SELECT Nationality, SUM(ID) FROM swimmer GROUP BY Nationality ORDER BY Nationality DESC
SELECT "Nationality", SUM("ID") FROM "swimmer" GROUP BY "Nationality" ORDER BY "Nationality" DESC NULLS LAST
0.105469
CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT)
how many patients aged below 83 years had the primary disease celo-vessicle fistula?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic WHERE demographic.diagnosis = "CELO-VESSICLE FISTULA" AND demographic.age < "83"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" WHERE "83" > "demographic"."age" AND "CELO-VESSICLE FISTULA" = "demographic"."diagnosis"
0.15332
CREATE TABLE table_24812 ("Tournament" FLOAT, "Conference" TEXT, "Championship Game Opponent" TEXT, "Score" TEXT, "Location" TEXT, "Head Coach" TEXT)
What is the location of the 1999 tournament?
SELECT "Location" FROM table_24812 WHERE "Tournament" = '1999'
SELECT "Location" FROM "table_24812" WHERE "Tournament" = '1999'
0.0625
CREATE TABLE table_203_798 (id DECIMAL, "party" TEXT, "votes" TEXT, "%" DECIMAL, "swing" DECIMAL, "seats" DECIMAL, "change" DECIMAL)
what party had the least number of seats ?
SELECT "party" FROM table_203_798 ORDER BY "seats" LIMIT 1
SELECT "party" FROM "table_203_798" ORDER BY "seats" NULLS FIRST LIMIT 1
0.070313
CREATE TABLE table_203_376 (id DECIMAL, "no." DECIMAL, "name" TEXT, "term of office" TEXT, "president ( s ) served under" TEXT)
how many directors served more than 3 years ?
SELECT COUNT("name") FROM table_203_376 WHERE "term of office" - "term of office" > 3
SELECT COUNT("name") FROM "table_203_376" WHERE "term of office" - "term of office" > 3
0.084961
CREATE TABLE table_name_68 (date VARCHAR, score VARCHAR)
what is the date when the score is 115-93?
SELECT date FROM table_name_68 WHERE score = "115-93"
SELECT "date" FROM "table_name_68" WHERE "115-93" = "score"
0.057617
CREATE TABLE table_name_43 (home_team VARCHAR, away_team VARCHAR)
Which team was the home team when playing South Melbourne?
SELECT home_team AS score FROM table_name_43 WHERE away_team = "south melbourne"
SELECT "home_team" AS "score" FROM "table_name_43" WHERE "away_team" = "south melbourne"
0.085938
CREATE TABLE Votes (Id DECIMAL, PostId DECIMAL, VoteTypeId DECIMAL, UserId DECIMAL, CreationDate TIME, BountyAmount DECIMAL) CREATE TABLE PostNotices (Id DECIMAL, PostId DECIMAL, PostNoticeTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ExpiryDate TIME, Body TEXT, OwnerUserId DECIMAL, DeletionUserId DECIMAL) CREATE TABLE PostFeedback (Id DECIMAL, PostId DECIMAL, IsAnonymous BOOLEAN, VoteTypeId DECIMAL, CreationDate TIME) CREATE TABLE VoteTypes (Id DECIMAL, Name TEXT) CREATE TABLE PostsWithDeleted (Id DECIMAL, PostTypeId DECIMAL, AcceptedAnswerId DECIMAL, ParentId DECIMAL, CreationDate TIME, DeletionDate TIME, Score DECIMAL, ViewCount DECIMAL, Body TEXT, OwnerUserId DECIMAL, OwnerDisplayName TEXT, LastEditorUserId DECIMAL, LastEditorDisplayName TEXT, LastEditDate TIME, LastActivityDate TIME, Title TEXT, Tags TEXT, AnswerCount DECIMAL, CommentCount DECIMAL, FavoriteCount DECIMAL, ClosedDate TIME, CommunityOwnedDate TIME, ContentLicense TEXT) CREATE TABLE ReviewTaskResults (Id DECIMAL, ReviewTaskId DECIMAL, ReviewTaskResultTypeId DECIMAL, CreationDate TIME, RejectionReasonId DECIMAL, Comment TEXT) CREATE TABLE ReviewTaskTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE TagSynonyms (Id DECIMAL, SourceTagName TEXT, TargetTagName TEXT, CreationDate TIME, OwnerUserId DECIMAL, AutoRenameCount DECIMAL, LastAutoRename TIME, Score DECIMAL, ApprovedByUserId DECIMAL, ApprovalDate TIME) CREATE TABLE FlagTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE Badges (Id DECIMAL, UserId DECIMAL, Name TEXT, Date TIME, Class DECIMAL, TagBased BOOLEAN) 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 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 PendingFlags (Id DECIMAL, FlagTypeId DECIMAL, PostId DECIMAL, CreationDate TIME, CloseReasonTypeId DECIMAL, CloseAsOffTopicReasonTypeId DECIMAL, DuplicateOfQuestionId DECIMAL, BelongsOnBaseHostAddress TEXT) CREATE TABLE PostNoticeTypes (Id DECIMAL, ClassId DECIMAL, Name TEXT, Body TEXT, IsHidden BOOLEAN, Predefined BOOLEAN, PostNoticeDurationId DECIMAL) CREATE TABLE PostLinks (Id DECIMAL, CreationDate TIME, PostId DECIMAL, RelatedPostId DECIMAL, LinkTypeId DECIMAL) CREATE TABLE ReviewTasks (Id DECIMAL, ReviewTaskTypeId DECIMAL, CreationDate TIME, DeletionDate TIME, ReviewTaskStateId DECIMAL, PostId DECIMAL, SuggestedEditId DECIMAL, CompletedByReviewTaskId DECIMAL) CREATE TABLE PostTags (PostId DECIMAL, TagId DECIMAL) CREATE TABLE ReviewTaskResultTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE SuggestedEditVotes (Id DECIMAL, SuggestedEditId DECIMAL, UserId DECIMAL, VoteTypeId DECIMAL, CreationDate TIME, TargetUserId DECIMAL, TargetRepChange DECIMAL) CREATE TABLE CloseAsOffTopicReasonTypes (Id DECIMAL, IsUniversal BOOLEAN, InputTitle TEXT, MarkdownInputGuidance TEXT, MarkdownPostOwnerGuidance TEXT, MarkdownPrivilegedUserGuidance TEXT, MarkdownConcensusDescription TEXT, CreationDate TIME, CreationModeratorId DECIMAL, ApprovalDate TIME, ApprovalModeratorId DECIMAL, DeactivationDate TIME, DeactivationModeratorId 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 Comments (Id DECIMAL, PostId DECIMAL, Score DECIMAL, Text TEXT, CreationDate TIME, UserDisplayName TEXT, UserId DECIMAL, ContentLicense TEXT) CREATE TABLE PostHistoryTypes (Id DECIMAL, Name 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 CloseReasonTypes (Id DECIMAL, Name TEXT, Description TEXT) CREATE TABLE PostTypes (Id DECIMAL, Name TEXT) CREATE TABLE Tags (Id DECIMAL, TagName TEXT, Count DECIMAL, ExcerptPostId DECIMAL, WikiPostId DECIMAL)
Count: Answers by all users in year by month. Answers by all users in a year broken down by month
SELECT MONTH(p.CreationDate), COUNT(p.Id) FROM Posts AS p WHERE p.PostTypeId = 2 AND YEAR(p.CreationDate) = @Year GROUP BY MONTH(CreationDate)
SELECT MONTH("p"."CreationDate"), COUNT("p"."Id") FROM "Posts" AS "p" WHERE "p"."PostTypeId" = 2 AND $Year = YEAR("p"."CreationDate") GROUP BY MONTH("CreationDate")
0.160156
CREATE TABLE table_28261 ("AB - Angry boar" TEXT, "B - Bishop" TEXT, "BA - Running Bear" TEXT, "BB - Blind Bear" TEXT, "BC - Beast Cadet" TEXT)
what is ba - running bear where b - bishop is rn - running stag?
SELECT "BA - Running Bear" FROM table_28261 WHERE "B - Bishop" = 'RN - Running Stag'
SELECT "BA - Running Bear" FROM "table_28261" WHERE "B - Bishop" = 'RN - Running Stag'
0.083984
CREATE TABLE table_23912 ("School" TEXT, "Location ( s ) " TEXT, "Control" TEXT, "Type" TEXT, "Accreditation" TEXT, "Founded" FLOAT, "Enrollment" TEXT)
What is the control for Christopher Newport University?
SELECT "Control" FROM table_23912 WHERE "School" = 'Christopher Newport University'
SELECT "Control" FROM "table_23912" WHERE "School" = 'Christopher Newport University'
0.083008
CREATE TABLE procedures (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE lab (subject_id TEXT, hadm_id TEXT, itemid TEXT, charttime TEXT, flag TEXT, value_unit TEXT, label TEXT, fluid TEXT) CREATE TABLE diagnoses (subject_id TEXT, hadm_id TEXT, icd9_code TEXT, short_title TEXT, long_title TEXT) CREATE TABLE demographic (subject_id TEXT, hadm_id TEXT, name TEXT, marital_status TEXT, age TEXT, dob TEXT, gender TEXT, language TEXT, religion TEXT, admission_type TEXT, days_stay TEXT, insurance TEXT, ethnicity TEXT, expire_flag TEXT, admission_location TEXT, discharge_location TEXT, diagnosis TEXT, dod TEXT, dob_year TEXT, dod_year TEXT, admittime TEXT, dischtime TEXT, admityear TEXT) CREATE TABLE prescriptions (subject_id TEXT, hadm_id TEXT, icustay_id TEXT, drug_type TEXT, drug TEXT, formulary_drug_cd TEXT, route TEXT, drug_dose TEXT)
what is the number of patients whose ethnicity is white - russian and drug route is oral?
SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN prescriptions ON demographic.hadm_id = prescriptions.hadm_id WHERE demographic.ethnicity = "WHITE - RUSSIAN" AND prescriptions.route = "ORAL"
SELECT COUNT(DISTINCT "demographic"."subject_id") FROM "demographic" JOIN "prescriptions" ON "ORAL" = "prescriptions"."route" AND "demographic"."hadm_id" = "prescriptions"."hadm_id" WHERE "WHITE - RUSSIAN" = "demographic"."ethnicity"
0.227539
CREATE TABLE table_name_86 (save VARCHAR, opponent VARCHAR, date VARCHAR)
Name the save for braves for may 15
SELECT save FROM table_name_86 WHERE opponent = "braves" AND date = "may 15"
SELECT "save" FROM "table_name_86" WHERE "braves" = "opponent" AND "date" = "may 15"
0.082031
CREATE TABLE table_58852 ("Drug" TEXT, "Mean" FLOAT, "Pleasure" FLOAT, "Psychological dependence" FLOAT, "Physical dependence" FLOAT)
What is the average Mean, when Drug is 'Alcohol', and when Psychological Dependence is greater than 1.9?
SELECT AVG("Mean") FROM table_58852 WHERE "Drug" = 'alcohol' AND "Psychological dependence" > '1.9'
SELECT AVG("Mean") FROM "table_58852" WHERE "Drug" = 'alcohol' AND "Psychological dependence" > '1.9'
0.098633
CREATE TABLE table_3569 ("District" FLOAT, "Incumbent" TEXT, "Party" TEXT, "Elected" TEXT, "Status" TEXT, "2010 Candidates" TEXT)
What was the status of the election featuring incumbent margaret kaiser?
SELECT "Status" FROM table_3569 WHERE "Incumbent" = 'Margaret Kaiser'
SELECT "Status" FROM "table_3569" WHERE "Incumbent" = 'Margaret Kaiser'
0.069336
CREATE TABLE table_44801 ("Outcome" TEXT, "Date" TEXT, "Tournament" TEXT, "Surface" TEXT, "Opponent" TEXT, "Score" TEXT)
What is Tournament, when Outcome is Winner, and when Date is 13 July 2013?
SELECT "Tournament" FROM table_44801 WHERE "Outcome" = 'winner' AND "Date" = '13 july 2013'
SELECT "Tournament" FROM "table_44801" WHERE "Date" = '13 july 2013' AND "Outcome" = 'winner'
0.09082
CREATE TABLE table_name_15 (surface VARCHAR, date VARCHAR)
what is the surface on july 26, 2010?
SELECT surface FROM table_name_15 WHERE date = "july 26, 2010"
SELECT "surface" FROM "table_name_15" WHERE "date" = "july 26, 2010"
0.066406
CREATE TABLE table_2646656_3 (candidates VARCHAR, result VARCHAR, incumbent VARCHAR)
Who were the candidates where the result was retired Republican hold and the incumbent was Philemon Bliss?
SELECT candidates FROM table_2646656_3 WHERE result = "Retired Republican hold" AND incumbent = "Philemon Bliss"
SELECT "candidates" FROM "table_2646656_3" WHERE "Philemon Bliss" = "incumbent" AND "Retired Republican hold" = "result"
0.117188
CREATE TABLE table_name_97 (date VARCHAR, opponent VARCHAR)
When was andrea g miz the opponent?
SELECT date FROM table_name_97 WHERE opponent = "andrea gámiz"
SELECT "date" FROM "table_name_97" WHERE "andrea gámiz" = "opponent"
0.066406